11

I've been searching the internet for the last 2 hours and can't seem to find a solution to the following problem.

I just installed Xen in a fresh Xubuntu 13.04 and in order to setup the networking, I had to remove network_manager. So, all network configuration is done through /etc/network/interfaces. At least, that's what should happen. However, it seems what I put in there is just being ignored: my xenbr0 interface doesn't get an IPv4 address assigned, there's no default gateway and no nameserver is setup.

Here's what's in the /etc/network/interfaces file:

auto lo
iface lo inet loopback

# There are no IP configurations for eth0, it’s all defined under xenbr0:
#auto eth0

# Static configuration
auto xenbr0
iface xenbr0 inet static
  bridge_ports    eth0
  address         192.168.1.200 # the IP address of the Ethernet port
  broadcast       192.168.1.255
  netmask         255.255.255.0
  gateway         192.168.1.1   # the address of the router
  bridge_stp      off           # disable Spanning Tree Protocol - optional
  bridge_waitport 0             # no delay before a port becomes available - optional, comment out if this gives you troubles
  bridge_fd       0             # no forwarding delay - optional
  dns-nameservers 192.168.1.1

In order to fix my network connection, I run a small "fix" script:

#!/bin/bash
ifconfig xenbr0 192.168.1.200 netmask 255.255.255.0 up
route add default gw 192.168.1.1 xenbr0

I would like to fix at the core though. Right now booting takes at least 1 minute extra, because the system waits for a working network connection.

Edit: I also had to add the following to /etc/resolvconf/resolv.conf.d/base and run sudo resolvconf -u:

nameserver 192.168.1.1

Without this I can only ping IP addresses, no DNS requests get passed through. This is actually what convinced me that the interfaces file is completely ignored.

Edit 2: Doing either sudo restart networking or sudo /etc/init.d/networking restart doesn't do anything.

Edit 3: Some extra info. Here is what ifconfig output should look like (working network/internet connection):

eth0      Link encap:Ethernet  HWaddr 00:1c:c0:77:09:9d  
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:3346 errors:0 dropped:0 overruns:0 frame:0
          TX packets:2903 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:2931429 (2.9 MB)  TX bytes:661616 (661.6 KB)
          Interrupt:20 Memory:e3200000-e3220000 

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:1720 (1.7 KB)  TX bytes:1720 (1.7 KB)

xenbr0    Link encap:Ethernet  HWaddr 00:1c:c0:77:09:9d  
          inet addr:192.168.1.200  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fe80::21c:c0ff:fe77:99d/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:3329 errors:0 dropped:0 overruns:0 frame:0
          TX packets:2875 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:2870029 (2.8 MB)  TX bytes:647394 (647.3 KB)

Here is what it looks like right after boot. The only thing missing is the xenbr0 IPv4 address (and the routing/DNS data, but you can't see that in ifconfig's output):

eth0      Link encap:Ethernet  HWaddr 00:1c:c0:77:09:9d  
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:0 (0 B)  TX bytes:0 (0 B)

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:0 (0 B)  TX bytes:0 (0 B)

xenbr0    Link encap:Ethernet  HWaddr 00:1c:c0:77:09:9d  
          inet6 addr: fe80::21c:c0ff:fe77:99d/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:0 (0 B)  TX bytes:0 (0 B)
jdthood
  • 12,287
  • 2
  • 48
  • 66
AVH
  • 201
  • 1
  • 3
  • 14
  • When you type `/etc/init.d/networking restart` do you get the configuration of the interfaces file? – ortang Jun 01 '13 at 14:37
  • Try with `auto eth0` and `iface eth0 inet manual`. – Eric Carvalho Jun 01 '13 at 14:44
  • When you run `ifconfig` right after boot, is there any interface up? – Eric Carvalho Jun 01 '13 at 14:46
  • Check init.d and the other start-up scripts for the missing network interface initialization info. Let us know what you found. – RGS Jun 01 '13 at 13:59
  • @ortang: No, I tried that as well, nothing happens. – AVH Jun 01 '13 at 16:14
  • @ERicCarvalho: I can't, that will break the Xen hypervisor bridge and then my virtual machines won't have a network connection. Anyway, that is not the problem, I can get the xenbr0 interface working manually, I just want the system to do what my interfaces file says. Also: right after boot, lo/eth0/xenbr0 are up, but xenbr0 doesn't have an IPv4 IP. – AVH Jun 01 '13 at 16:15
  • @EricCarvalho I tried uncommenting `auto eth0` and that seems to have fixed it. If you add it as an answer, I'll accept it. – AVH Jun 06 '13 at 07:21

3 Answers3

17

You have:

address         192.168.1.200 # the IP address of the Ethernet port

and report that this is the line that isn't working. Are you aware, from interfaces(5), that:

   Lines starting with `#' are ignored. Note  that  end-of-line  comments
   are NOT supported, comments must be on a line of their own.

Did you add the end-of-line comments for the question, or do you actually have them in your /etc/network/intefaces file? If so, try removing them.

Robie Basak
  • 15,524
  • 4
  • 61
  • 86
  • @Darhuuk Robie is right. I think this is what's wrong in your interfaces file. – Eric Carvalho Jun 06 '13 at 11:22
  • Ah, nice find. Those comments where added by the Xen install and are indeed at the end of the line. Uncommenting `auto eth0` seems to have fixed my problem, even though the comments are still there. – AVH Jun 06 '13 at 14:44
  • Inline comments are also not supported in /etc/network/interfaces, it seems. Thanks, this allowed me to get my second network interface working in my VPS. – Escher May 09 '16 at 07:41
4

Perhaps, despite having removed the network-manager package, you still have the file /etc/NetworkManager/NetworkManager.conf containing

[ifupdown]
managed=true

which causes ifup not automatically to bring up interfaces.

If this is the cause of the problem then I suggest either dpkg --purge network-manager or setting managed=false.

I filed a bug report about this: https://bugs.launchpad.net/ubuntu/+source/ifupdown/+bug/1187693

jdthood
  • 12,287
  • 2
  • 48
  • 66
  • I'll check this tonight when I get home. However, the interfaces are up after booting, just not correctly configured. Manually running `sudo restart networking` also doesn't fix the problem. – AVH Jun 05 '13 at 09:34
  • @jdthood, don't you mean to say that ifupdown might actuall be already set to `managed=false`, and that he needs to set it to `true` in order for it to start using the settings in `/etc/network/interfaces`? – Alaa Ali Jun 05 '13 at 10:16
  • @Alaa, no I didn't mean what you suggest. In Ubuntu, `ifup` actually looks in `/etc/NetworkManager/NetworkManager.conf` and refrains from auto-upping interfaces if NM is configured to configure those interfaces my means of "`[ifupdown] managed=true`". – jdthood Jun 05 '13 at 20:58
  • I just tried with both managed true & false (this was what it was set to), neither of those worked. Then did a dpkg --purge, which didn't help either, my /etc/network/interfaces still isn't taken into account. – AVH Jun 05 '13 at 21:26
3

I managed to fix my problem by changing 2 files. First of all, as suggested by Eric Carvalho, I uncommented auto eth0 in /etc/networking/interfaces. (Note that this is quite odd, several tutorials online seem to suggest this shouldn't be required for Xen.)

That by itself did not fix the slow boot though. It seems that on startup it still took a few seconds before the interfaces came up and in the meantime Ubuntu was already stuck in a 60 seconds idle wait. This I fixed by modifying the delay time in /etc/init/failsafe.conf from 60 seconds to 1 second. (I found out about this file through Google, no idea which one it was exactly.)

AVH
  • 201
  • 1
  • 3
  • 14