10

I am completely new to network administration, and so am finding things a bit tough. I have a machine, whose 1 interface I have to set to the subnet 10.0.20.0/24, another to 10.1.0.0/24 and a third to 10.128.0.0/24. My eth0 is already running, and the ifconfig command shows the result:

eth0      Link encap:Ethernet  HWaddr fa:16:3e:31:bc:c9  
          inet addr:10.0.20.3  Bcast:10.0.20.255  Mask:255.255.255.0
          inet6 addr: fe80::f816:3eff:fe31:bcc9/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1454  Metric:1
          RX packets:8941 errors:0 dropped:0 overruns:0 frame:0
          TX packets:5324 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:5662823 (5.6 MB)  TX bytes:616960 (616.9 KB)

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:8 errors:0 dropped:0 overruns:0 frame:0
          TX packets:8 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:672 (672.0 B)  TX bytes:672 (672.0 B)

Looking at this and elsewhere, I configured my /etc/network/interfaces thus:

auto eth0
iface eth0 inet static
    address 10.0.20.3
    netmask 255.255.255.0

auto eth1
iface eth1 inet static
    address 10.1.0.1
    netmask 255.255.255.0

auto eth2
iface eth2 inet static
    address 10.128.0.1
    netmask 255.255.255.0

I did not do anything to eth0 as it is already running. I tried "sudo ifdown eth1". I am getting:

ifdown: interface eth1 not configured

I looked in these forums, and people are talking about a gateway, but I am not sure what to set this gateway to, and for which interface. Could someone please help me?

When running "sudo ifup eth1", I got the result:

Cannot find device "eth1"
Failed to bring up eth1.

OK, here is what I did - instead of using eth1 and eth2, I replaced them with eth0:1 and eth0:2 respectively, as given below:

auto eth0:1
iface eth0:1 inet static
    address 10.1.0.1
    netmask 255.255.255.0

auto eth0:2
iface eth0:2 inet static
    address 10.128.0.1
    netmask 255.255.255.0

Now, when I am doing "sudo ifup eth0:1" and "sudo ifup eth0:2", the the interface correctly starts. So the output of "ifconfig -a" is:

eth0      Link encap:Ethernet  HWaddr fa:16:3e:31:bc:c9  
          inet addr:10.0.20.3  Bcast:10.0.20.255  Mask:255.255.255.0
          inet6 addr: fe80::f816:3eff:fe31:bcc9/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1454  Metric:1
          RX packets:1498 errors:0 dropped:0 overruns:0 frame:0
          TX packets:1220 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:149182 (149.1 KB)  TX bytes:148374 (148.3 KB)

eth0:1    Link encap:Ethernet  HWaddr fa:16:3e:31:bc:c9  
          inet addr:10.1.0.1  Bcast:10.1.0.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1454  Metric:1

eth0:2    Link encap:Ethernet  HWaddr fa:16:3e:31:bc:c9  
          inet addr:10.128.0.1  Bcast:10.128.0.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1454  Metric:1

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:16 errors:0 dropped:0 overruns:0 frame:0
          TX packets:16 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:1184 (1.1 KB)  TX bytes:1184 (1.1 KB)

But, I am still confused. I am supposed to do the same with the devices eth1 and eth2. If these interfaces are not present, how do I add them?

OK, I finally got it. When I created my OpenStack instance, I did so using only one network interface. Thus only eth0 was created. I deleted the instance and created a new one specifying the additional interfaces. eth1 and eth2 were successfully configured!

9
  • Did you restart networking after making the changes to /etc/network/interfaces?
    – EEAA
    Jan 20, 2015 at 3:19
  • yes, I ran the command "sudo /etc/init.d/networking restart"
    – user2994590
    Jan 20, 2015 at 3:39
  • Restart your networking and check your logs. Post the data from syslog and any other relevant logs. Is that Ubuntu SERVER or Desktop?
    – ETL
    Jan 20, 2015 at 4:07
  • 1
    why ifdown? The interface is already down. To get it up, you should use ifup.
    – etagenklo
    Jan 20, 2015 at 8:26
  • I edited my post above to include the result of ifup.
    – user2994590
    Jan 20, 2015 at 12:24

1 Answer 1

1

The commands ifup and ifdown are using temporary files below /var/lib to remember, which interface is soon up and which isn't. Other commands (ifconfig) don't know this. Thus, if you configurate your interfaces with ifconfig, the ifup / ifdown will think the are yet down.

In around 1998 it was soon so, and probably nobody can say, why.

Edit /etc/networking/interfaces (or maybe another distrib-dependent config in /etc), and use the ifup / ifdown commands, if you can. These settings will be remembered between reboots. Good luck!

You must log in to answer this question.