大网数据广告活动
服务器运维问答

Virtual interface gets static IP, actual interface doesn't?

· 52CE 我爱测

I have a server running Debian 6 with two static IP addresses assigned: eth0 and eth0:1 (virtual interface of eth0). On boot, both should get their assigned IPs...but eth0 does not. /etc/network/interfaces : iface eth0 inet stati…

问题原文

原帖链接 · Nathan C · CC BY-SA 4.0

I have a server running Debian 6 with two static IP addresses assigned: eth0 and eth0:1 (virtual interface of eth0). On boot, both should get their assigned IPs...but eth0 does not.

/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)

Any ideas? The only way it'll get an IP is if I do ifconfig eth0 192.168.9.171.

已采纳解答

原帖链接 · Claudiu · CC BY-SA 3.0

That is your problem, by default debian comes with: allow-hotplug eth0

Check out the official documentation here: http://www.debian.org/doc/manuals/debian-reference/ch05.en.html#_the_basic_syntax_of_etc_network_interfaces

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2013-06-03)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 4.0 / CC BY-SA 3.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。