centos7双网卡绑定

#安装必需的包:

  yum install  teamd  -y

#停止NetworkManager

  systemctl   stop  NetworkManager

  systemctl   disable  NetworkManager



#Creating a Network Team Using ifcfg Files

cd /etc/sysconfig/network-scripts/

vi ifcfg-team0


DEVICE=team0
DEVICETYPE=Team
ONBOOT=yes
BOOTPROTO=none
IPADDR=192.168.10.110
PREFIX=24
GATEWAY=192.168.10.254
TEAM_CONFIG='{"runner": {"name": "activebackup"}, "link_watch": {"name": "ethtool"}}'


#做好备份继续编辑需要绑定的网卡信息,调整prio优先级


# cat ifcfg-eno1


DEVICETYPE=TeamPort
TEAM_MASTER=team0
TEAM_PORT_CONFIG='{"prio":100}'
NAME=eno1
DEVICE=eno1
ONBOOT=yes


# cat ifcfg-eno2

DEVICETYPE=TeamPort
TEAM_MASTER=team0
TEAM_PORT_CONFIG='{"prio":99}'
NAME=eno2
DEVICE=eno2
ONBOOT=yes


#重启网络

systemctl restart network


#检查端口状态

teamnl team0 ports


1: eth0: up 1000Mbit FD

2: eth1: up 1000Mbit FD


#检查teaming状态

teamdctl team0 state


setup:

     runner: activebackup

ports:

     eno1

          link watches:

          link summary: up

          instance[link_watch_0]:

               name: ethtool

               link: up

     eno2

          link watches:

          link summary: up

          instance[link_watch_0]:

               name: ethtool

               link: up

runner:

     active port: eno1



#手动断开其中一条链路验证主备模式切换是否正常

ip link set eno1 down


teamdctl team0 state


setup:

     runner: activebackup

ports:

     eno1

          link watches:

          link summary: up

          instance[link_watch_0]:

               name: ethtool

               link: up

     eno2

          link watches:

          link summary: up

          instance[link_watch_0]:

               name: ethtool

               link: up

runner:

     active port: eno2


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章