引导时网桥无法通过DHCP获取IP


8

我正在运行CentOS7。我没有在运行NetworkManager,实际上已经将其卸载。

我的系统应该br0在启动时通过DHCP获取IPv4地址。但是,当我登录时,没有地址。

我的配置:

# pwd
/etc/sysconfig/network-scripts

# cat ifcfg-enp5s0 
DEVICE=enp5s0
ONBOOT="yes"
BRIDGE=br0

# cat ifcfg-br0 
DEVICE=br0
ONBOOT=yes
TYPE=Bridge
BOOTPROTO=dhcp
STP=on
DELAY=0

请注意,我没有手动配置此网桥。virt-manager当我br0在此对话框中添加内容时:

virt-manager屏幕截图,在“网络接口”选项卡上显示了br0

相关journalctl --boot | grep '\(\<br0\>\|enp5s0\)'和上下文:

Jan 08 21:04:32 jonathon-centos7 kernel: r8169 0000:05:00.0 enp5s0: link down
Jan 08 21:04:32 jonathon-centos7 kernel: IPv6: ADDRCONF(NETDEV_UP): enp5s0: link is not ready
Jan 08 21:04:32 jonathon-centos7 kernel: r8169 0000:05:00.0 enp5s0: link down
Jan 08 21:04:32 jonathon-centos7 kernel: device enp5s0 entered promiscuous mode
Jan 08 21:04:32 jonathon-centos7 network[947]: Bringing up interface enp5s0:  [  OK  ]
...
Jan 08 21:04:32 jonathon-centos7 network[947]: Bringing up interface br0:
Jan 08 21:04:32 jonathon-centos7 kernel: IPv6: ADDRCONF(NETDEV_UP): br0: link is not ready
...
Jan 08 21:04:34 jonathon-centos7 kernel: r8169 0000:05:00.0 enp5s0: link up
Jan 08 21:04:34 jonathon-centos7 kernel: IPv6: ADDRCONF(NETDEV_CHANGE): enp5s0: link becomes ready
Jan 08 21:04:34 jonathon-centos7 kernel: br0: port 1(enp5s0) entered listening state
Jan 08 21:04:34 jonathon-centos7 kernel: br0: port 1(enp5s0) entered listening state
//// (Note: 2 second delay here, with no other events)
Jan 08 21:04:36 jonathon-centos7 avahi-daemon[957]: Registering new address record for fe80::f66d:4ff:fe3b:c24e on enp5s0.*.
Jan 08 21:04:36 jonathon-centos7 kernel: br0: port 1(enp5s0) entered learning state
///// (Too soon!)
Jan 08 21:04:38 jonathon-centos7 network[947]: Determining IP information for br0... failed; no link present.  Check cable?
Jan 08 21:04:38 jonathon-centos7 network[947]: [FAILED]
Jan 08 21:04:38 jonathon-centos7 systemd[1]: network.service: control process exited, code=exited status=1
Jan 08 21:04:38 jonathon-centos7 systemd[1]: Failed to start LSB: Bring up/down networking.
Jan 08 21:04:38 jonathon-centos7 systemd[1]: Unit network.service entered failed state.
...
Jan 08 21:04:38 jonathon-centos7 kernel: br0: topology change detected, propagating
Jan 08 21:04:38 jonathon-centos7 kernel: br0: port 1(enp5s0) entered forwarding state
Jan 08 21:04:38 jonathon-centos7 kernel: IPv6: ADDRCONF(NETDEV_CHANGE): br0: link becomes ready
Jan 08 21:04:39 jonathon-centos7 avahi-daemon[957]: Registering new address record for fe80::f66d:4ff:fe3b:c24e on br0.*.
Jan 08 21:04:41 jonathon-centos7 avahi-daemon[957]: Registering new address record for 2605:a000:1315:8119:f66d:4ff:fe3b:c24e on br0.*.
Jan 08 21:04:41 jonathon-centos7 avahi-daemon[957]: Withdrawing address record for fe80::f66d:4ff:fe3b:c24e on br0.

///// (Here's where I entered `ifup br0`)
Jan 08 22:43:30 jonathon-centos7 dhclient[5009]: DHCPDISCOVER on br0 to 255.255.255.255 port 67 interval 6 (xid=0x25f649b7)
Jan 08 22:43:31 jonathon-centos7 dhclient[5009]: DHCPREQUEST on br0 to 255.255.255.255 port 67 (xid=0x25f649b7)
Jan 08 22:43:34 jonathon-centos7 avahi-daemon[957]: Joining mDNS multicast group on interface br0.IPv4 with address 10.0.1.128.
Jan 08 22:43:34 jonathon-centos7 avahi-daemon[957]: New relevant interface br0.IPv4 for mDNS.
Jan 08 22:43:34 jonathon-centos7 avahi-daemon[957]: Registering new address record for 10.0.1.128 on br0.IPv4.
Jan 08 23:43:17 jonathon-centos7 dhclient[5124]: DHCPREQUEST on br0 to 10.0.1.1 port 67 (xid=0x25f649b7)

系统启动并登录后,我可以打开一个终端,并:

# ifup br0
set forward delay failed: Numerical result out of range

Determining IP information for br0... done.

然后,我连接到我的网络。

为什么我br0在启动时无法获得IP ?

有关:

笔记:

  • brctl showstp br0显示前向延迟设置为2.00。brctl setfd br0 0显示与相同的错误ifup br0。看来virt-manager指定了的无效DELAY=0br0
  • 在日志中找到重要条目后,似乎systemd正在尝试获取IP,br0然后再进入转发状态。
  • 我已经在CentOS错误跟踪上打开了错误8086

1
更新STP=yes从我的配置中删除可以让我赢得这场比赛。
乔纳森·莱因哈特

Answers:


1

您的网桥不受网络初始化脚本的控制,而由libvirt控制。libvirtd服务启动时,网桥应该启动。

我不会这样跑。我将使网桥由网络初始化脚本控制,而在libvirt配置中没有网桥。

您现在拥有的ifcfg-文件就可以了。只需从libvirt中删除配置,确保您仍然有那些文件,然后chkconfig network on

是的,chkconfig可在EL7上使用。


1
“只需从libvirt中删除配置,”我该怎么做?为什么virt-manager能够如此轻松地创建这样一个损坏的设置?
Jonathon Reinhart 2015年


0

当网桥启动时,您的物理链接没有建立。给您的物理接口增加延迟。

By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.