Adding an IP address to Debian/Ubuntu Linux

# sudo vi /etc/network/interfaces

Your original will look something like this:

# Used by ifup(8) and ifdown(8). See the interfaces(5) manpage or
# /usr/share/doc/ifupdown/examples for more information.

auto lo eth0

iface lo inet loopback

iface eth0 inet static
address XXX.XXX.XXX.XXX
netmask 255.255.255.255
broadcast 0.0.0.0

Add the following below it to add another address to the same interface:

auto eth0:1
iface eth0:1 inet static
address XXX.XXX.XXX.XXX
netmask 255.255.255.255
broadcast 0.0.0.0

Exit.

# sudo /etc/init.d/networking restart

Ping the interface and check to see if the IP is up.

Advertisements

2 responses to “Adding an IP address to Debian/Ubuntu Linux

  1. Fido

    Hi

    I made the configuration but it doesnot work, the address doesn´t answer to ping, this is my interface configuration:

    #—————————————–
    # This file describes the network interfaces available on your system
    # and how to activate them. For more information, see interfaces(5).

    # The loopback network interface
    auto lo
    iface lo inet loopback

    # The primary network interface
    allow-hotplug eth0
    iface eth0 inet static
    address 197.0.2.76
    netmask 255.255.0.0
    network 197.0.2.0
    broadcast 197.0.2.255
    gateway 197.0.0.1
    # dns-* options are implemented by the resolvconf package, if installed
    dns-nameservers 197.0.0.6
    dns-search heinsohn.com.co

    #This were the lines that I add to the file but it doesn´t work

    auto eth0:1
    iface eth0:1 inet static
    address 197.0.2.231
    netmask 255.255.0.0
    broadcast 0.0.0.0

    Thanks if anybody knows why it doesn´t work

    Bye

  2. Fido

    Hi

    I find the solution:

    Only missed to activate the interface with:

    ifup eth0:1

    Bye

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: