![配置与 DHCP 的绑定](https://linux22.com/image/99768/%E9%85%8D%E7%BD%AE%E4%B8%8E%20DHCP%20%E7%9A%84%E7%BB%91%E5%AE%9A.png)
我正在尝试在主动-被动模式下使用绑定,并带有 2 个以太网接口。我希望系统始终连接到网络,同时至少连接一根电缆。我必须能够通过 DHCP 服务器使用该系统。
目前,我在互联网上没有找到任何有效的答案,所以现在我问你们:)
粉红公关
答案1
来自内核文档,这个配置过去对我有用(/etc/network/interfaces):
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
# The loopback network interface
auto lo
iface lo inet loopback
# Define primary network interface
auto eth0
iface eth0 inet manual
bond-master bond0
bond-primary eth0 eth1
# Define secondary network interface
auto eth1
iface eth1 inet manual
# delay ifup to allow eth0 to come up first in the bond
pre-up sleep 2
bond-master bond0
bond-primary eth0 eth1
# Define master bond interface with link local address.
auto bond0
iface bond0 inet dhcp
bond-slaves none
bond-mode active-backup
bond-miimon 100
答案2
你应该尝试这个:
$/etc/modprobe.d/somefile
alias bond0 bonding
options bonding mode=1 arp_interval=1000
$/etc/network/interfaces
auto bond0
iface bond0 inet manual
up ifconfig bond0 up
up ifenslave bond0 eth0 eth1
up dhclient3 -e IF_METRIC=100 -pf /var/run/dhclient.bond0.pid -lf /var/lib/dhcp3/dhclient.bond0.leases bond0
down ifenslave -d bond0 eth0 eth1
让我知道它是否有效。