MirageOS 和 Xen - 虚拟接口无法获取 IP 地址

MirageOS and Xen - Virtual interface unable to acquire IP address

我已经按照本指南https://github.com/mirage/mirage-www/blob/master/tmpl/wiki/hello-world.md(主要是最后一部分,第 4 步,stackv4)为 XEN 编译并构建了一个 MirageOS unikernel,但是在我启动它之后我无法通过 DHCP 发现阶段,如下日志所示:

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

....

我的 MirageOS unikernel 配置:

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' ]

我的网络配置:

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)

我的网桥配置:

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

我的/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

我正在尝试了解问题所在,但一切似乎都是正确的(根据其他指南 http://wiki.xen.org/wiki/Network_Configuration_Examples_(Xen_4.1%2B)#Example_Debian-style_bridge_configuration_.28e.g._Debian.2C_Ubuntu.29)。

一些建议:

  1. 检查您实际上是 运行 DHCP 服务器。
  2. 运行 tcpdump or wireshark 在网桥机器上(可能是dom0)看看有什么流量。您看到 DHCP 请求了吗?
  3. 尝试配置一个静态 IP 地址,看看是否可行。
  4. 尝试 运行 Linux 来宾并查看 DHCP 是否在那里工作(并比较数据包捕获)。