Ubuntu second static IP, ifconfig, /etc/network/interfaces

Posted by Schmoove on Server Fault See other posts from Server Fault or by Schmoove
Published on 2012-12-04T08:58:07Z Indexed on 2012/12/04 11:12 UTC
Read the original article Hit count: 343

Filed under:
|
|
|
|

I would like to add a second static IP to my local Ubuntu 11.10 desktop machine and have it automatically available after rebooting. So far I am successfully using ifconfig to to temporarily set up an alias for my primary network interface:

# ifconfig eth1:0 192.168.178.3 up
# ifconfig
eth1      Link encap:Ethernet  HWaddr c8:60:00:ef:a3:d9  
          inet addr:192.168.178.2  Bcast:192.168.0.255  Mask:255.255.255.0
          inet6 addr: fe80::ca60:ff:feef:a3d9/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:61929 errors:0 dropped:0 overruns:0 frame:0
          TX packets:64034 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:45330863 (45.3 MB)  TX bytes:28175192 (28.1 MB)
          Interrupt:42 Base address:0x4000 

eth1:0    Link encap:Ethernet  HWaddr c8:60:00:ef:a3:d9  
          inet addr:192.168.178.3  Bcast:192.168.178.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          Interrupt:42 Base address:0x4000

However, when I add the following to /etc/network/interfaces, the alias is not up and running as expected after a reboot:

# vi /etc/network/interfaces
auto eth1:0
iface eth1:0 inet static
    address 192.168.178.3
    netmask 255.255.255.0

I would like to know what to configure to get this to work. As a side note, I am running gnome shell.

© Server Fault or respective owner

Related posts about ubuntu

Related posts about networking