Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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.

share|improve this question
1  
Is there network-manager on this machine ? If it is the case, it takes precedence on /etc/network/interfaces –  Dom Dec 4 '12 at 9:09
    
The package network-manager seems to be installed on my system. I just tried configuring the network manager and I failed. I have the feeling the network manager might be buggy or maybe just not intuitive enough for me. I tried Gnome System Settings > Network > Wired > Configure == which opened a window to configure my "Wired connection 1". It allowed me to add a second IP address, but after saving, closing and reopening the dialog, my changes were gone. –  Schmoove Dec 6 '12 at 10:01
    
Now it gets even weirder, I clicked twice on the "Configure" button to open the dialog for editing my "Wired connection 1", the second click opened a completely different dialog, namely an overview of all connections and the option to add a new connection. I added a new connection, messed up a setting, saved, closed, reopened, edited, saved, closed... and my changes are gone again. I give up. If anyone has a solution, please help :) –  Schmoove Dec 6 '12 at 10:02
    
As MKzero says : remove Network Manager to come back in standard mode as you want. –  Dom Dec 6 '12 at 11:18
    
What's up with your broadcast (bcast) addresses? –  ptman Jan 25 at 13:52
add comment

3 Answers

Is Network Manager managing the interface? I have configured network manager not to touch the interfaces that I manage through /etc/network/interfaces by having the following in /etc/NetworkManager/NetworkManager.conf:

[ifupdown]
managed=false

When Network Manager is disabled for sure we can take a look at /etc/network/interfaces. Interface aliases are no longer recommended, but ip(8) can add more than one address to one interface. This can be done in /etc/network/interfaces as follows:

auto eth1
iface eth1 inet static
        address 192.168.178.2
        netmask 255.255.255.0
        gateway 192.168.178.1
        up ip addr add 192.168.178.3/24 dev eth1
        down ip addr del 192.168.178.3/24 dev eth1

Read the manpage of interfaces(5) and ip(8) for more information.

share|improve this answer
add comment

In my experience you have to disable Network Manager for those kind of setups as it interferes with static configurations and has loads of bugs with pseudo-interfaces.

You have several options here:

  • You could disable IP management in /etc/NetworkManager/NetworkManager.conf and manage the interface yourself via /etc/network/interfaces
  • You could remove Network Manager and install Gnome Network Manager instead.
  • You could stick with NM and write a hook script in /etc/NetworkManager/dispatcher.d - for more information on this see NetworkManager(8)
share|improve this answer
add comment

does you main eth1 configuration is defined in the interfaces file or did you do it using network-manager? I would recommend you do it all in the interfaces file. it's much more robust for a server. but of course if you manage eth1 in nm and eth1:0 in the interfaces file... you will probably run into problems. having said that the syntax in you for seems correct at first look (given that you also have iface eth1 defined in that same file.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.