我正在尝试设置在 ubuntu 上运行的 UML 实例作为主机之间的网络。
UML--eth0-(192.168.0.254) ----------------tap0--(192.168.0.253)--VM
但是,我无法将 eth0 设备带入向上状态,即使在配置了 IP 地址之后。
UML :
[root@localhost ~]# ifconfig -a
eth0: flags=4098<BROADCAST,MULTICAST> mtu 1500
inet 192.168.0.254 netmask 255.255.255.0 broadcast 192.168.0.255
ether fa:df:23:a2:22:4b txqueuelen 1000 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
device interrupt 5
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
loop txqueuelen 1 (Local Loopback)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
如您所见,eth0 状态是 onlybroadcast
和multicast
但不是up
。但是,VM 端的 tap0 已启动并正在运行。
Host VM
vm@vm:/dev/net$ ifconfig tap0
tap0 Link encap:Ethernet HWaddr 96:e1:8c:c9:09:54
inet addr:192.168.0.253 Bcast:192.168.0.255 Mask:255.255.255.0
UP BROADCAST 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:500
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
我以 root 身份登录,即使这样我也不允许触发下面的命令。
[root@localhost ~]# ifconfig eth0 up
SIOCSIFFLAGS: Operation not permitted
[root@localhost ~]# ip link set eth0 up
RTNETLINK answers: Operation not permitted
答案1
找到了解决方案,我需要以 root 身份启动 mu UML 进程,之后配置 IP 地址将启动接口。
只需以 root 身份运行 uml 即可:
sudo ./linux ubda=Fedora21-x86-root_fs