-
实验:路由实验
-
路由表构成
目标网络:网络ID 子网掩码
接口:到达目标网络,从哪个接口出来,此接口
网关:gateway,下一个邻近路由器的邻近接口的IP地址,如果目标网络和本路由器直接,网关的地址为接口的IP -
centos6 关闭NetworkManager服务
chkconfig NetworkManager
service NetworkManager stop
1 按网络配置IP,并关闭防火墙 下面所有路由器执行 iptables -F 下次开机不执行防火墙 chkconfig iptables off centos6 systemctl disable firewalld.service centos7 2 在所有路由器上启用路由功能 echo 1 > /proc/sys/net/ipv4/ip_forward 3 添加路由记录 在R1 route add -net 172.16.0.0/16 gw 192.168.33.129 dev ens33 在R2 route add -net 10.0.0.0/8 gw 192.168.33.235 dev eth0 cat f2|tr -s " " |cut -d " " -f5|grep -oE '([0-9]{1,3}\.){3}[0-9]{1,3}'
-
-
实验:在centos6实现多网卡bonding
1service NetworkManager stop 2 vim ifcfg-bond0 DEVICE=bond0 BONDING_OPTS="mode=3 miimon=100" IPADDR=192.168.33.100 PREFIX=24 3 vim ifcfg-eth0 DEVICE=eth0 MASTER=bond0 SLAVE=yes vim ifcfg-eth1 DEVICE=eth1 MASTER=bond0 SLAVE=yes 4 service network restart 5 cat /proc/net/bonding/bond0 6 删除bond0的配置文件 修改相关网卡的配置文件 MASTER=bond0 SLAVE=yes 7 ifconfig bond0 down rmmod bonding
-
CentOS 7:nmcli实现bonding
添加bonding接口(逻辑接口): nmcli con add type bond con-name mybond0 ifname mybond0 mode active-backup 添加从属接口(物理接口): nmcli con add type bond-slave ifname ens7 master mybond0 nmcli con add type bond-slave ifname ens3 master mybond0 `注:如无为从属接口提供连接名,则该名称是接口名称加类型构成` 要启动绑定,则必须首先启动从属接口: nmcli con up bond-slave-ens7 nmcli con up bond-slave-ens3 现在可使用以下方法启动绑定: nmcli con up mybond0
-
实验:网络组示例:
# nmcli con add type team con-name team0 ifname team0 config ‘{"runner": {"name": "loadbalance"}}' # nmcli con mod team0 ipv4.addresses 192.168.1.100/24 # nmcli con mod team0 ipv4.method manual # nmcli con add con-name team0-eth1 type team- slave ifname eth1 master team0 # nmcli con add con-name team0-eth2 type team- slave ifname eth2 master team0 # nmcli con up team0 # nmcli con up team0-eth1 # nmcli con up team0-eth2 # teamdctl team0 state; # nmcli dev dis eth1
-
实验:创建网络组team
# ip link # nmcli con add type team con-name team0 ifname team0 config '{"runner": {"name": "activebackup"}}' # nmcli con mod team0 ipv4.addresses '192.168.0.100/24' # nmcli con mod team0 ipv4.method manual # nmcli con add con-name team0-port1 type team-slave ifname eth1 master team0 # nmcli con add con-name team0-port2 type team-slave ifname eth2 master team0 # teamdctl team0 state # ping -I team0 192.168.0.254 # nmcli dev dis eno1 # teamdctl team0 state # nmcli con up team0-port1 # nmcli dev dis eno2 # teamdctl team0 state # nmcli con up team0-port2 # teamdctl team0 state
-
生成的网络组配置文件
# /etc/sysconfig/network-scripts/ifcfg-team0 DEVICE=team0 DEVICETYPE=Team TEAM_CONFIG="{\"runner\": {\"name\": \"broadcast\"}}" BOOTPROTO=none IPADDR0=172.25.5.100 PREFIX0=24 NAME=team0 ONBOOT=yes
# /etc/sysconfig/network-scripts/ifcfg-team0-eth1 DEVICE=eth1 DEVICETYPE=TeamPort TEAM_MASTER=team0 NAME=team0-eth1 ONBOOT=yes
原创文章,作者:s,如若转载,请注明出处:http://www.178linux.com/74862