桥接器在启动时未从 DHCP 服务器获取 IP

桥接器在启动时未从 DHCP 服务器获取 IP

我在 ubunut 16.04 机器上创建了一个网桥。启动时,网桥不会从网络上的 DHCP 服务器获取 IP。

在/etc/网络/接口:

# interfaces(5) file used by ifup(8) and ifdown(8)  
auto br0  
iface br0 inet dhcp  
    bridge-ifaces eno1  
    bridge-ports eno1  
    up ifconfig eno1 up  
iface eno1 inet manual  
auto lo  
iface lo inet loopback  

机器启动时,它没有连接到 LAN,也没有互联网连接。我的局域网上的 IP 是 192.168.11.xx。启动时网桥的 IP 是 10.255.212.1。

启动时:

bas@Viky:~$ ifconfig
br0       Link encap:Ethernet  HWaddr fc:aa:14:72:d0:af  
          inet addr:10.255.212.1  Bcast:0.0.0.0  Mask:255.255.255.0
          inet6 addr: fe80::feaa:14ff:fe72:d0af/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:397 errors:0 dropped:0 overruns:0 frame:0
          TX packets:212 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:506043 (506.0 KB)  TX bytes:18913 (18.9 KB)

eno1      Link encap:Ethernet  HWaddr fc:aa:14:72:d0:af  
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:1191 errors:0 dropped:4 overruns:0 frame:0
          TX packets:951 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:1285826 (1.2 MB)  TX bytes:108134 (108.1 KB)
          Interrupt:20 Memory:f7c00000-f7c20000 

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:189 errors:0 dropped:0 overruns:0 frame:0
          TX packets:189 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1 
          RX bytes:13790 (13.7 KB)  TX bytes:13790 (13.7 KB)

vethVOCFUV Link encap:Ethernet  HWaddr fe:4e:32:1f:b7:f4  
          inet6 addr: fe80::fc4e:32ff:fe1f:b7f4/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:743 errors:0 dropped:0 overruns:0 frame:0
          TX packets:793 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:85052 (85.0 KB)  TX bytes:776556 (776.5 KB)

启动后,可以通过 ifdown -a 和 ifup -a 来纠正这个问题。

bas@Viky:~$ sudo ifdown -a
[sudo] password for bas: 
Killed old client process
Internet Systems Consortium DHCP Client 4.3.3
Copyright 2004-2015 Internet Systems Consortium.
All rights reserved.
For info, please visit https://www.isc.org/software/dhcp/

Listening on LPF/br0/fc:aa:14:72:d0:af
Sending on   LPF/br0/fc:aa:14:72:d0:af
Sending on   Socket/fallback
DHCPRELEASE on br0 to 192.168.11.1 port 67 (xid=0x79a7a104)

启动网络:

bas@Viky:~$ sudo ifup -a

Waiting for br0 to get ready (MAXWAIT is 32 seconds).
Internet Systems Consortium DHCP Client 4.3.3
Copyright 2004-2015 Internet Systems Consortium.
All rights reserved.
For info, please visit https://www.isc.org/software/dhcp/

Listening on LPF/br0/fc:aa:14:72:d0:af
Sending on   LPF/br0/fc:aa:14:72:d0:af
Sending on   Socket/fallback
DHCPDISCOVER on br0 to 255.255.255.255 port 67 interval 3 (xid=0x177d1021)
DHCPDISCOVER on br0 to 255.255.255.255 port 67 interval 3 (xid=0x177d1021)
DHCPREQUEST of 192.168.11.28 on br0 to 255.255.255.255 port 67 (xid=0x21107d17)
DHCPOFFER of 192.168.11.28 from 192.168.11.1
DHCPACK of 192.168.11.28 from 192.168.11.1
bound to 192.168.11.28 -- renewal in 274608 seconds.

我不明白为什么网桥在启动时没有从 DHCP 服务器获取 IP 地址。
有人能帮我解决这个问题吗?
我应该从哪里开始解决这个网络挑战?

巴什

(因为我没有收到任何回复问题,我觉得它太宽泛了。因此提出了这个子问题。

答案1

我相信你的桥梁部分应该是这样的:

是 bridge_ports 而不是 bridge-ports

auto br0  
iface br0 inet dhcp   
    bridge_ports eno1
    bridge_stp off
    bridge_fd 0
    bridge_maxwait 0 
iface eno1 inet manual

更多信息请见这里


我的系统中的示例:

$ cat /etc/network/interfaces
# The network interface
auto br0
iface br0 inet dhcp
   bridge_ports eth0
   bridge_stp off
   bridge_fd 0
   bridge_maxwait 0
iface eth0 inet manual
auto lo
iface lo inet loopback



$ ifconfig
br0       Link encap:Ethernet  HWaddr 00:21:85:94:46:a4  
          inet addr:10.0.0.100  Bcast:10.0.0.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:195 errors:0 dropped:0 overruns:0 frame:0
          TX packets:211 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:39400 (39.4 KB)  TX bytes:27433 (27.4 KB)

eth0      Link encap:Ethernet  HWaddr 00:21:85:94:46:a4  
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:278675 errors:0 dropped:0 overruns:0 frame:0
          TX packets:263759 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:110002223 (110.0 MB)  TX bytes:408874062 (408.8 MB)

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:64269 errors:0 dropped:0 overruns:0 frame:0
          TX packets:64269 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1 
          RX bytes:23474196 (23.4 MB)  TX bytes:23474196 (23.4 MB)

希望这可以帮助!

相关内容