1.bond 网络
* 链路聚合,支持两块网卡
* 作用:主动备份模式 一次只能只能使用一个接口,如果接口故障,另一个会接替它
命令:nmcli connection add con-name bond0 ifname bond0 type bond mode active-backup ip4 172.25.254.100/24 ##添加主动备份模式的bond0,ip为172.25.254.100
命令:nmcli connection add con-name eth0 ifname eth0 type bond-slave master bond0 ##给bond0网络添加接口
测试
观测命令:watch -n 1 cat /proc/net/bonding/bond0
ifconfig eth0 down ##让eth0故障
eth1接替eth0工作,且网络没断
2.team网络
* 链路聚合的一种,最多支持8块网卡
* 模式:广播容错 轮询 主备 负载均衡
nmcli connection add con-name team0 ifname team0 type team config '{"runner":{"name":"activebackup"}}' ip4 172.25.254.174/24
##添加team网络,名称为team0,IP为172.25.254.174,模式为主备
ifconfig ##查看网络
nmcli connection add con-name eth0 ifname eth0 type team-slave master team0
nmcli connection add con-name eth0 ifname eth0 type team-slave master team0
##给team0添加网卡eth1和eth0
测试
watch -n 1 teamdctl team0 stat ##监控命令
ifconfig eth0 down ##关闭eth0网卡
测试结果
eth1接替eth0工作,且网络没有中断
3.网桥
* 网桥是早期的两端口二层网络设备,用来连接不同网段。
* 配置
vim /etc/sysconfig/network-scripts/ifcfg-enp0s25
DEVICE=p1p1 ##设备名称为p1p1
ONBOOT=yes ##开启服务设备自动激活
BOOTPROTO=none ##网卡工作状态为静态
BRIDGE=br0 ##网卡开启的网桥接口为br0
vim /etc/sysconfig/network-scripts/ifcfg-br0
DEVICE=br0 ##设备名称为br0
ONBOOT=yes ##开启服务设备自动激活
BOOTPROTO=none ##网卡工作状态为静态
IPADDR=172.25.254.74 ##ip为172.25.254.74
NETMASK=255.255.255.0 ##子网掩码为255.255.255.0
TYPE=Bridge ##网络接口类型是桥接
systemctl stop NetworkManager.service
systemctl restart network
systemctl start NetworkManager.service
*查看网络配置
ifconfig
*命令管理方式
给虚拟机添加网桥类型网卡
*添加网桥网络
systemctl stop NetworkManager.service
brctl addbr br0 ##添加网桥br0
brctl addif br0 eth0 ##给网桥添加网卡eth0
ifconfig eth0 up ##开启网卡eth0
ifconfig br0 172.25.254.126 netmask 255.255.255.0 ##临时设定网桥IP为172.25.254.126 子网掩码为255.255.255.0
检测
brctl show ##查看网桥配置
ping 172.25.254.74
*删除网桥配置
ifconfig br0 down ##关闭br0网桥
brctl delif br0 eth0 ##删除br0网桥的eth0网卡
brctl delbr br0 ##删除br0网桥
检测
4.ipv6
*由于ipv4网络地址资源有限提出ipv6,ipv6是Internet Protocol Version6的缩写,即第六代互 联网协议,号称可以为全世界的每一粒沙子编上一个网址。
vim /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0 ##设备名称为eth0
ONBOOT=yes ##开启服务设备自动激活
BOOTPROTO=none ##网卡工作状态为静态
IPADDDR=172.25.254.174 ##ipv4地址
NETMASK=255.255.255.0 ##子网掩码
IPV6INIT=yes ##ipv6初始化
IPV6_AUTOCONF=on ##不自动获取地址
IPV6ADDR=2017::174/64 ##ipv6地址
systemctl restart network ##重启网络服务
测试
ping6 2017::174
本文转自 red777 51CTO博客,原文链接:http://blog.51cto.com/12314711/1926649