centos7雙網卡綁定

來源:互聯網
上載者:User

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.11.1

PREFIX=24

#GATEWAY=192.168.11.254

TEAM_CONFIG='{"runner": {"name": "activebackup"}, "link_watch": {"name": "ethtool"}}'

#做好備份繼續編輯需要綁定的網卡資訊,調整prio優先順序

vi ifcfg-eth0

DEVICE=eth0

DEVICETYPE=TeamPort

ONBOOT=yes

TEAM_MASTER=team0

TEAM_PORT_CONFIG='{"prio": 100}'

vi ifcfg-eth1

DEVICE=eth1

DEVICETYPE=TeamPort

ONBOOT=yes

TEAM_MASTER=team0

TEAM_PORT_CONFIG='{"prio": 99}'

#重啟網路

systemctl restart network

#檢查連接埠狀態

teamnl team0 ports

1: eth0: up 1000Mbit FD

2: eth1: up 1000Mbit FD

#檢查teaming狀態

teamdctl team0 state

setup:

runner: activebackup

ports:

eth0

link watches:

link summary: up

instance[link_watch_0]:

name: ethtool

link: up

eth1

link watches:

link summary: up

instance[link_watch_0]:

name: ethtool

link: up

runner:

active port: eth0

#手動斷開其中一條鏈路驗證主備模式切換是否正常

ip link set eth1 down

teamdctl team0 state

setup:

runner: activebackup

ports:

eth0

link watches:

link summary: up

instance[link_watch_0]:

name: ethtool

link: up

eth1

link watches:

link summary: up

instance[link_watch_0]:

name: ethtool

link: up

runner:

active port: eth1

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.