Search code examples
network-programmingdhcpxenmirage

MirageOS and Xen - Virtual interface unable to acquire IP address


I've compiled and built a MirageOS unikernel for XEN following this guide https://github.com/mirage/mirage-www/blob/master/tmpl/wiki/hello-world.md (mostly last part, Step 4, stackv4) but after I launch it I'm not able to pass the DHCP discovery phase, as shown in the following log:

Parsing config from stackv4.xl
Xen Minimal OS!
Initialising console ... done.
getenv(OCAMLRUNPARAM) -> null
getenv(CAMLRUNPARAM) -> null
getenv(PATH) -> null
Unsupported function lseek called in Mini-OS kernel
Unsupported function lseek called in Mini-OS kernel
Unsupported function lseek called in Mini-OS kernel
getenv(OCAMLRUNPARAM) -> null
getenv(CAMLRUNPARAM) -> null
getenv(TMPDIR) -> null
getenv(TEMP) -> null
Netif: add resume hook
Netif.connect 0
Netfront.create: id=0 domid=0
 sg:true gso_tcpv4:true rx_copy:true rx_flip:false smart_poll:false
MAC: 00:16:3e:7e:c0:0d
Attempt to open(/dev/urandom)!
Unsupported function getpid called in Mini-OS kernel
Unsupported function getppid called in Mini-OS kernel
Manager: connect
Manager: configuring
DHCP: start discovery

Sending DHCP broadcast (length 552)
DHCP: start discovery

Sending DHCP broadcast (length 552)
DHCP: start discovery

Sending DHCP broadcast (length 552)
DHCP: start discovery

....

My MirageOS unikernel configuration:

name = 'stackv4'
kernel = '/home/mirage/mirage-skeleton/stackv4/mir-stackv4.xen'
builder = 'linux'
memory = 256
on_crash = 'preserve'

disk = [  ]

# if your system uses openvswitch then either edit /etc/xen/xl.conf and set
#     vif.default.script="vif-openvswitch"
# or add "script=vif-openvswitch," before the "bridge=" below:
vif = [ 'bridge=xenbr0' ]

My network configuration:

eth0      Link encap:Ethernet  HWaddr 02:01:06:02:83:c0
          inet6 addr: fe80::1:6ff:fe02:83c0/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:110876 errors:0 dropped:0 overruns:0 frame:0
          TX packets:14602 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:9736700 (9.7 MB)  TX bytes:1999992 (1.9 MB)
          Interrupt:117

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:384394 errors:0 dropped:0 overruns:0 frame:0
          TX packets:384394 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:26761500 (26.7 MB)  TX bytes:26761500 (26.7 MB)

vif16.0   Link encap:Ethernet  HWaddr fe:ff:ff:ff:ff:ff
          inet6 addr: fe80::fcff:ffff:feff:ffff/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:58 errors:0 dropped:0 overruns:0 frame:0
          TX packets:11289 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:32
          RX bytes:33640 (33.6 KB)  TX bytes:778590 (778.5 KB)

xenbr0    Link encap:Ethernet  HWaddr 02:01:06:02:83:c0
          inet addr:131.159.24.167  Bcast:131.159.25.255  Mask:255.255.254.0
          inet6 addr: fe80::1:6ff:fe02:83c0/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:110689 errors:0 dropped:0 overruns:0 frame:0
          TX packets:11987 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:8328727 (8.3 MB)  TX bytes:1703101 (1.7 MB)

My bridge configuration:

bridge name     bridge id               STP enabled     interfaces
xenbr0          8000.0201060283c0       no              eth0
                                                        vif16.0

My /etc/network/interface:

auto lo
iface lo inet loopback

auto eth0
#iface eth0 inet dhcp
#  up ip link set eth0 up

iface eth0 inet manual

auto xenbr0
    iface xenbr0 inet dhcp
            bridge_ports eth0

I'm trying to understand what is the problem but everything appears to be correct (according to this other guide http://wiki.xen.org/wiki/Network_Configuration_Examples_(Xen_4.1%2B)#Example_Debian-style_bridge_configuration_.28e.g._Debian.2C_Ubuntu.29).


Solution

  • Some suggestions:

    1. Check you're actually running a DHCP server.
    2. Run tcpdump or wireshark on the bridge machine (probably dom0) and see what traffic there is. Do you see the DHCP request?
    3. Try configuring a static IP address and see if that works.
    4. Try running a Linux guest and see if DHCP works there (and compare packet captures for that).