高级网络配置

高级网络配置:
1,配置网络桥接
桥接作用使你的虚拟机和真机使用同一块网络设备
#brctl show
#brctl delif br0 eth0
#brctl addif br0 eth0
#vim  /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
ONBOOT=yes
BOOTPROTO=none
PEERDNS=no
BRIDGE=br0
vim  /etc/sysconfig/network-scripts/ifcfg-br0
DEVICE=br0
ONBOOT=yes
BOOTPROTO=none
IPADDR=172.25.254.100
NETMASK=255.255.255.0
PEERDNS=no
TYPE=Bridge
#systemctl restart  network //启动两次
 brctl
### 桥接管理命令
�C show ### 显示
�C addbr ### 添加网桥
�C delbr ### 删除网桥
�C addif ### 添加网桥连接
�C delif ### 删除网桥连接
2,bond网络配置
(1),使用命令配置即临时配置
nmcli connect add type bond con-name bond0 ifname bond0 mode active-backup ip4 172.25.254.100/24 gw4 172.25.254.250 //建立绑定接口 bond0
nmcli connection add type bond-slave con-name eth0 ifname eth0 master bond0  //建立 Slave 接口 eth0
nmcli connection add type bond-slave con-name eth1 ifname eth1 master bond0  //建立 Slave 接口 eth1
监控watch -n 1  /proc/net/bonding/bond0
需要关掉#systemctl stop  NetworkManager
排错,有时候不成功,需要nmcli connection show/delete/add
(2),
 建立绑定接口 bond0 配置文件 :
#vim /etc/sysconfig/network-scripts/ifcfg-bond0
DEVICE=bond0
NAME=bond0
TYPE=bond
BOOTPROTO=none
IPADDR=172.25.254.100
PREFIX0=24
ONBOOT=yes
BONDING_OPTS=”mode=1 miimon=50”
#vim /etc/sysconfig/network-scripts/ifcfg-eth0
TYPE=Ethernet
NAME=eth0
DEVICE=eth0
ONBOOT=yes
MASTER=bond0
SLAVE=yes
#############
#vim /etc/sysconfig/network-scripts/ifcfg-eth1
TYPE=Ethernet
NAME=eth1
DEVICE=eth1
ONBOOT=yes
MASTER=bond0
SLAVE=yes
#vim /etc/modprobe.d/bonding.conf
alias bond0  bonding
systemctl restart network
cat /proc/net/bonding/bond0
查看bonding状态
bond默认支持两块网卡,team默认支持8块网卡
3, 配置team网络
配置team接口
#nmcli connection add type team con-name team0 ifname team0 config '{"runner": {"name": "activebackup"}}' ip4 172.25.254.100 gw4 172.25.254.250
#nmcli connection add con-name eth0 ifname eth0 type team-slave master team0
#nmcli connection add con-name eth1 ifname eth1 type team-slave master team0
#systemctl restart network
#teamdctl team0 state
#ifconfig eth0 down
#teamdctl team0 state
#ifconfig eth0 up
#teamdctl team0 state











你可能感兴趣的:(虚拟机,网络,NetWork,网桥)