ubuntu lxd 多网卡 负载均衡 bonding 加 bridge 配置

分类

多网卡 负载均衡 bonding


# 确保安装 ifenslave
sudo apt install ifenslave

# /etc/network/interfaces

auto lo
iface lo inet loopback

auto bond0
iface bond0 inet static
	address 192.168.0.22
	netmask 255.255.255.0
	gateway 192.168.0.1
	dns-nameservers 192.168.0.1
	bond-mode 0 # bond-mode有多个参数 不同的参数对应不同的负载均衡方案
	bond-lacp-rate fast
	bond-miimon 100
	post-up ifup eth0 eth1

iface eth0 inet manual
	bond-master bond0

iface eth1 inet manual
	bond-master bond0

bridge配置 kvm虚拟机也是这么配置


# 确保安装 bridge-utils
sudo apt install bridge-utils

# The loopback network interface
auto lo
iface lo inet loopback
# The primary network interface
auto br0
iface br0 inet static
	address 192.168.0.22
    netmask 255.255.255.0
	gateway 192.168.0.1
	dns-nameservers 192.168.0.1
	bridge_ports eth0
	bridge_fd 0
	bridge_hello 2
	bridge_maxage 0
	bridge_ageing 0
	bridge_maxwait 0
	bridge_stp off

多网卡 负载均衡 bonding 加 bridge


# 确保安装  ifenslave bridge-utils
sudo apt install ifenslave bridge-utils

# /etc/network/interfaces

auto lo
iface lo inet loopback

auto bond0
iface bond0 inet manual
	bond-mode 0
	# bond-mode 4
	bond-lacp-rate fast
	bond-miimon 100
	post-up ifup eth0 eth1

iface eth0 inet manual
	bond-master bond0
	bond-primary eth0

iface eth1 inet manual
	bond-master bond0

auto br0
iface br0 inet static
	address 192.168.0.22
	netmask 255.255.255.0
	gateway 192.168.0.1
	dns-nameservers 192.168.0.1
	bridge_ports bond0
	bridge_fd 0
	bridge_hello 2
	bridge_maxage 0
	bridge_ageing 0
	bridge_maxwait 0
	bridge_stp off

lxd使用该bridge


# 基于 bridge-utils 的网络配置
dpkg-reconfigure -p medium lxd
# Would you like to setup a network bridge for LXD containers now? 
NO
#  Do you want to use an existing bridge? 
YES
# Bridge interface name: 
# 自己建的bridge名称
br0
# 完成
'OK'