我有一台运行 Debian 6 的服务器,分配了两个静态 IP 地址:eth0 和 eth0:1(eth0 的虚拟接口)。在启动时,两者都应该获得分配的 IP...但是 eth0 没有。
/etc/network/interfaces
:
iface eth0 inet static
address 192.168.9.171
netmask 255.255.255.0
network 192.168.9.0
broadcast 192.168.9.255
gateway 192.168.9.23
# dns-* options are implemented by the resolvconf package, if installed
dns-nameservers 192.168.9.23 192.168.9.41
dns-search ourdomain.local
auto eth0:1
iface eth0:1 inet static address 192.168.9.11 netmask 255.255.255.0 network 192.168.9.0 broadcast 192.168.9.255 gateway 192.168.9.23 # dns-* options are implemented by the resolvconf package, if installed dns-nameservers 192.168.9.23 192.168.9.41 dns-search ourdomain.local
ifconfig
:
eth0 Link encap:Ethernet HWaddr 00:12:79:95:a4:e7
inet6 addr: fe80::212:79ff:fe95:a4e7/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:10378 errors:0 dropped:8 overruns:0 frame:0
TX packets:2256 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:1634657 (1.5 MiB) TX bytes:453396 (442.7 KiB)
Interrupt:17
eth0:1 Link encap:Ethernet HWaddr 00:12:79:95:a4:e7
inet addr:192.168.9.11 Bcast:192.168.9.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
Interrupt:17
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:16436 Metric:1
RX packets:550 errors:0 dropped:0 overruns:0 frame:0
TX packets:550 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:189714 (185.2 KiB) TX bytes:189714 (185.2 KiB)
有任何想法吗?它获得 IP 的唯一方法是如果我这样做ifconfig eth0 192.168.9.171
。
那是你的问题,默认情况下 debian 自带:allow-hotplug eth0
在此处查看官方文档:http: //www.debian.org/doc/manuals/debian-reference/ch05.en.html#_the_basic_syntax_of_etc_network_interfaces