我过去两个小时一直在互联网上搜索,但是似乎找不到以下问题的解决方案。
我刚刚在新的Xubuntu 13.04中安装了Xen,并且为了设置网络,我必须删除network_manager。因此,所有网络配置都是通过/ etc / network / interfaces完成的。至少,这应该发生。但是,似乎放在这里的内容只是被忽略了:我的xenbr0接口没有得到分配的IPv4地址,没有默认网关,也没有设置名称服务器。
这是/ etc / network / interfaces文件中的内容:
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
为了修复我的网络连接,我运行一个小的“修复”脚本:
#!/bin/bash
ifconfig xenbr0 192.168.1.200 netmask 255.255.255.0 up
route add default gw 192.168.1.1 xenbr0
我想解决核心问题。现在,启动至少要花费1分钟,因为系统会等待网络连接正常。
编辑:我还必须将以下内容添加到/etc/resolvconf/resolv.conf.d/base并运行sudo resolvconf -u
:
nameserver 192.168.1.1
没有这个,我只能ping IP地址,没有DNS请求通过。实际上,这就是使我确信完全忽略了interfaces文件的原因。
编辑2:做sudo restart networking
或sudo /etc/init.d/networking restart
不做任何事情。
编辑3:一些额外的信息。以下是ifconfig
输出应该像(工作网络/互联网连接):
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)
这是启动后的样子。唯一缺少的是xenbr0 IPv4地址(以及路由/ DNS数据,但是在ifconfig的输出中看不到):
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)
/etc/init.d/networking restart
,您是否获得interfaces文件的配置?
auto eth0
和iface eth0 inet manual
。
ifconfig
引导后立即运行时,是否有任何接口?