中文字幕日韩精品一区二区免费_精品一区二区三区国产精品无卡在_国精品无码专区一区二区三区_国产αv三级中文在线

CentOS6系統(tǒng)下如何實(shí)現(xiàn)雙網(wǎng)卡綁定同一IP詳解-創(chuàng)新互聯(lián)

下文給大家?guī)鞢entOS6系統(tǒng)下如何實(shí)現(xiàn)雙網(wǎng)卡綁定同一IP詳解,希望能夠給大家在實(shí)際運(yùn)用中帶來一定的幫助,負(fù)載均衡涉及的東西比較多,理論也不多,網(wǎng)上有很多書籍,今天我們就用創(chuàng)新互聯(lián)在行業(yè)內(nèi)累計(jì)的經(jīng)驗(yàn)來做一個(gè)解答。

創(chuàng)新互聯(lián)建站-專業(yè)網(wǎng)站定制、快速模板網(wǎng)站建設(shè)、高性價(jià)比金牛網(wǎng)站開發(fā)、企業(yè)建站全套包干低至880元,成熟完善的模板庫,直接使用。一站式金牛網(wǎng)站制作公司更省心,省錢,快速模板網(wǎng)站建設(shè)找我們,業(yè)務(wù)覆蓋金牛地區(qū)。費(fèi)用合理售后完善,10年實(shí)體公司更值得信賴。

前幾天剛給大家分享過CentOS6系統(tǒng)下如何實(shí)現(xiàn)雙網(wǎng)卡綁定同一IP以達(dá)到網(wǎng)絡(luò)負(fù)載均衡以及高可用性。很多人肯定也在想,在CentOS7系統(tǒng)下如何實(shí)現(xiàn)了,那么今天就給大家大家分享一下如何使用CentOS7系統(tǒng)的網(wǎng)絡(luò)組來實(shí)現(xiàn)同樣的效果了。網(wǎng)絡(luò)組是將多個(gè)網(wǎng)卡聚合在一起,從而實(shí)現(xiàn)冗錯(cuò)和提高吞吐量的一種技術(shù)手段,但它不同于舊版中bonding技術(shù),提供更好的性能和擴(kuò)展性,網(wǎng)絡(luò)組由內(nèi)核驅(qū)動(dòng)和teamd守護(hù)進(jìn)程實(shí)現(xiàn)。接下來就給大家展示一下如何實(shí)現(xiàn)。

CentOS6系統(tǒng)下如何實(shí)現(xiàn)雙網(wǎng)卡綁定同一IP詳解

交換機(jī)設(shè)備:兩臺支持動(dòng)態(tài)鏈聚合功能的交換機(jī)或者一臺普通交換機(jī)

網(wǎng)卡設(shè)備:兩張網(wǎng)卡

操作操作:Centos7.2

broadcast — Simple runner which directs the team device to transmit packets via all ports.

roundrobin — Simple runner which directs the team device to transmits packets in a round-robin fashion.

activebackup — Watches for link changes and selects active port to be used for data transfers.

loadbalance — To do passive load balancing, runner only sets up BPF hash function which will  determine

       port for packet transmit. To do active load balancing, runner moves hashes among available ports trying

       to reach perfect balance.

lacp — Implements 802.3ad LACP protocol. Can use same Tx port selection  possibilities  as  loadbalance

       runner.

第一步:創(chuàng)建網(wǎng)絡(luò)組文件team0

nmcli con add type team con-name team0 config '{"runner":{"name":"activebackup","hwaddr_policy":"by_active"}}'

[root@centos7 network-scripts]# nmcli dev status

DEVICE    TYPE    STATE    CONNECTION

virbr0    bridge   connected  virbr0

eno16777728  ethernet  connected  eno16777728

eno33554960  ethernet  connected  Wired connection 1

virbr0-nic  tap    connected  virbr0-nic

lo      loopback  unmanaged  --

[root@centos7 network-scripts]# nmcli con add type team con-name team0 config '{"runner":{"name":"activebackup","hwaddr_policy":"by_active"}}'

Connection 'team0' (527769ff-02de-411c-9b26-2725a74cd6e9) successfully added.

[root@centos7 network-scripts]#

我這里創(chuàng)建的是活動(dòng)-備份策略,但我這里額外指定了一個(gè)"hwaddr_policy":"by_active",我也看過很多博主都寫過這個(gè)活動(dòng)備份策略,但從來沒看到有人指出過這個(gè)選項(xiàng),事實(shí)上要想得到雙網(wǎng)卡其中之一故障熱替換,不添加這個(gè)選項(xiàng)是實(shí)現(xiàn)不了的。所以能看到本人博文的同仁們,你們是幸福的(因?yàn)楸救搜芯窟@個(gè)選項(xiàng)花了一天半的時(shí)間才得出這個(gè)結(jié)論)

第二步:給team0配置靜態(tài)IP以及網(wǎng)關(guān),開機(jī)自啟動(dòng)

[root@centos7 network-scripts]# nmcli con mod team0 connection.autoconnect yes ipv4.method manual ipv4.addresses "10.1.254.254/16" ipv4.gateway "10.1.0.1"

[root@centos7 network-scripts]# cat ifcfg-team0

nmcli的配置會(huì)在/etc/sysconfig/network-scripts下面生產(chǎn)配置文件ifcfg-team*文件,可以直接查看配置結(jié)果

[root@centos7 network-scripts]# cat ifcfg-team0

DEVICE=team0

TEAM_CONFIG="{\"runner\":{\"name\":\"activebackup\",\"hwaddr_policy\":\"by_active\"}}"

DEVICETYPE=Team

BOOTPROTO=none

DEFROUTE=yes

IPV4_FAILURE_FATAL=no

IPV6INIT=yes

IPV6_AUTOCONF=yes

IPV6_DEFROUTE=yes

IPV6_FAILURE_FATAL=no

NAME=team0

UUID=c1726372-479f-4ebe-aa12-7e76d702ddd0

ONBOOT=yes

IPADDR=10.1.254.254

PREFIX=16

GATEWAY=10.1.0.1

IPV6_PEERDNS=yes

IPV6_PEERROUTES=yes

[root@centos7 network-scripts]#

CentOS6系統(tǒng)下如何實(shí)現(xiàn)雙網(wǎng)卡綁定同一IP詳解

第三步:為team0創(chuàng)建兩個(gè)端口文件

nmcli con add type team-slave con-name team0-port# ifname eno######## master team0

創(chuàng)建port1文件

[root@centos7 network-scripts]# nmcli con add type team-slave con-name team0-port1 ifname eno16777728 master team0

Connection 'team0-port1' (a88c6e0c-5f0c-4d24-a285-2089f7a6e68b) successfully added.

創(chuàng)建port2文件

[root@centos7 network-scripts]# nmcli con add type team-slave con-name team0-port2 ifname eno33554960 master team0

Connection 'team0-port2' (a103239b-0980-4e63-a465-bc90a8b0958b) successfully added.

[root@centos7 network-scripts]#

第四步:啟動(dòng)網(wǎng)絡(luò)組 nmcli con up team#

nmcli con up team0——>nmcli con up team0-port1——>nmcli con up team0-port2

[root@centos7 network-scripts]# nmcli con up team0

[root@centos7 network-scripts]# nmcli con up team0

Connection successfully activated (master waiting for slaves) (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/5)

[root@centos7 network-scripts]# nmcli con up team0-port1

Connection successfully activated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/6)

[root@centos7 network-scripts]# nmcli con up team0-port2

Connection successfully activated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/7)

[root@centos7 network-scripts]#

第五步:查看配置后的最終效果

查看網(wǎng)絡(luò)組的當(dāng)前運(yùn)行狀態(tài)

[root@centos7 Desktop]# teamdctl team0 state

setup:

 runner: activebackup

ports:

 eno16777728

  link watches:

   link summary: up

   instance[link_watch_0]:

    name: ethtool

    link: up

    down count: 0

 eno33554960

  link watches:

   link summary: up

   instance[link_watch_0]:

    name: ethtool

    link: up

    down count: 0

runner:

 active port: eno16777728

[root@centos7 Desktop]# ifconfig

查看網(wǎng)卡的配置詳情

[root@centos7 Desktop]# ifconfig

eno16777728: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500

    ether 00:0c:29:06:f9:87  txqueuelen 1000  (Ethernet)

    RX packets 1463  bytes 105137 (102.6 KiB)

    RX errors 0  dropped 121  overruns 0  frame 0

    TX packets 79  bytes 5744 (5.6 KiB)

    TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

eno33554960: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500

    ether 00:0c:29:06:f9:91  txqueuelen 1000  (Ethernet)

    RX packets 1510  bytes 108863 (106.3 KiB)

    RX errors 0  dropped 126  overruns 0  frame 0

    TX packets 214  bytes 17571 (17.1 KiB)

    TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536

    inet 127.0.0.1  netmask 255.0.0.0

    inet6 ::1  prefixlen 128  scopeid 0x10<host>

    loop  txqueuelen 0  (Local Loopback)

    RX packets 16  bytes 1072 (1.0 KiB)

    RX errors 0  dropped 0  overruns 0  frame 0

    TX packets 16  bytes 1072 (1.0 KiB)

    TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

team0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500

    inet 10.1.254.254  netmask 255.255.0.0  broadcast 10.1.255.255

    inet6 fe80::20c:29ff:fe06:f991  prefixlen 64  scopeid 0x20<link>

    ether 00:0c:29:06:f9:87  txqueuelen 0  (Ethernet)

    RX packets 2000  bytes 117274 (114.5 KiB)

    RX errors 0  dropped 247  overruns 0  frame 0

    TX packets 293  bytes 22841 (22.3 KiB)

    TX errors 0  dropped 3 overruns 0  carrier 0  collisions 0

virbr0: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500

    inet 192.168.122.1  netmask 255.255.255.0  broadcast 192.168.122.255

    ether 52:54:00:3a:39:12  txqueuelen 0  (Ethernet)

    RX packets 0  bytes 0 (0.0 B)

    RX errors 0  dropped 0  overruns 0  frame 0

    TX packets 0  bytes 0 (0.0 B)

    TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

[root@centos7 Desktop]#

第六步:隨意禁用其中一塊網(wǎng)卡,測試網(wǎng)絡(luò)是否具有高可用性

禁用port1(網(wǎng)卡一),查看ping的過程中是否丟包(正常情況下會(huì)丟3-4包)

[root@centos7 network-scripts]# nmcli dev dis eno16777728

Device 'eno16777728' successfully disconnected.

[root@centos7 network-scripts]# teamdctl team0 state

setup:

 runner: activebackup

ports:

 eno33554960

  link watches:

   link summary: up

   instance[link_watch_0]:

    name: ethtool

    link: up

    down count: 0

runner:

 active port: eno33554960

[root@centos7 network-scripts]#

啟用port1,禁用port2(網(wǎng)卡二),繼續(xù)觀察ping的過程(正常情況下會(huì)丟3-4包)

[root@centos7 network-scripts]# nmcli con up team0-port1

Connection successfully activated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/11)

[root@centos7 network-scripts]# nmcli dev dis eno33554960

Device 'eno33554960' successfully disconnected.

[root@centos7 network-scripts]# teamdctl team0 state

setup:

 runner: activebackup

ports:

 eno16777728

  link watches:

   link summary: up

   instance[link_watch_0]:

    name: ethtool

    link: up

    down count: 0

runner:

 active port: eno16777728

[root@centos7 network-scripts]#

第七步:如果要想更改用其它策略,直接去修改一下ifcfg-team0文件最為簡單(注意TEAM_CONFIG=...一行的改變)

[root@centos7 network-scripts]# cat ifcfg-team0

DEVICE=team0

TEAM_CONFIG="{\"runner\":{\"name\":\"roundrobin\"}}"

DEVICETYPE=Team

BOOTPROTO=none

DEFROUTE=yes

IPV4_FAILURE_FATAL=no

IPV6INIT=yes

IPV6_AUTOCONF=yes

IPV6_DEFROUTE=yes

IPV6_FAILURE_FATAL=no

NAME=team0

UUID=c1726372-479f-4ebe-aa12-7e76d702ddd0

ONBOOT=yes

IPADDR=10.1.254.254

PREFIX=16

GATEWAY=10.1.0.1

IPV6_PEERDNS=yes

IPV6_PEERROUTES=yes

[root@centos7 network-scripts]#

禁用網(wǎng)卡一——>禁用網(wǎng)卡二——>關(guān)閉team0連接——>重新啟用team0——>啟用port1——>啟用port2

查看更改后的效果(這里修改成了roundrobin輪轉(zhuǎn)策略,需要兩張網(wǎng)卡分別接在兩臺支持動(dòng)態(tài)鏈聚合的交換機(jī)上才能體驗(yàn)得出來輪轉(zhuǎn)的效果,虛擬機(jī)是無法驗(yàn)證的)

[root@centos7 network-scripts]# teamdctl team0 state

setup:

 runner: roundrobin

ports:

 eno16777728

  link watches:

   link summary: up

   instance[link_watch_0]:

    name: ethtool

    link: up

    down count: 0

 eno33554960

  link watches:

   link summary: up

   instance[link_watch_0]:

    name: ethtool

    link: up

    down count: 0

[root@centos7 network-scripts]#

  啟動(dòng)網(wǎng)絡(luò)組接口不會(huì)自動(dòng)啟動(dòng)網(wǎng)絡(luò)組中的port接口

  啟動(dòng)網(wǎng)絡(luò)組接口中的port接口不會(huì)自動(dòng)啟動(dòng)網(wǎng)絡(luò)組接口

  禁用網(wǎng)絡(luò)組接口會(huì)自動(dòng)禁用網(wǎng)絡(luò)組中的port接口

  沒有port接口的網(wǎng)絡(luò)組接口可以啟動(dòng)靜態(tài)IP連接

  啟用DHCP連接時(shí),沒有port接口的網(wǎng)絡(luò)組會(huì)等待port接口的加入

看了以上關(guān)于CentOS6系統(tǒng)下如何實(shí)現(xiàn)雙網(wǎng)卡綁定同一IP詳解,如果大家還有什么地方需要了解的可以在創(chuàng)新互聯(lián)行業(yè)資訊里查找自己感興趣的或者找我們的專業(yè)技術(shù)工程師解答的,創(chuàng)新互聯(lián)技術(shù)工程師在行業(yè)內(nèi)擁有十幾年的經(jīng)驗(yàn)了。

另外有需要云服務(wù)器可以了解下創(chuàng)新互聯(lián)scvps.cn,海內(nèi)外云服務(wù)器15元起步,三天無理由+7*72小時(shí)售后在線,公司持有idc許可證,提供“云服務(wù)器、裸金屬服務(wù)器、高防服務(wù)器、香港服務(wù)器、美國服務(wù)器、虛擬主機(jī)、免備案服務(wù)器”等云主機(jī)租用服務(wù)以及企業(yè)上云的綜合解決方案,具有“安全穩(wěn)定、簡單易用、服務(wù)可用性高、性價(jià)比高”等特點(diǎn)與優(yōu)勢,專為企業(yè)上云打造定制,能夠滿足用戶豐富、多元化的應(yīng)用場景需求。

當(dāng)前文章:CentOS6系統(tǒng)下如何實(shí)現(xiàn)雙網(wǎng)卡綁定同一IP詳解-創(chuàng)新互聯(lián)
本文地址:http://www.rwnh.cn/article16/psogg.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供網(wǎng)站維護(hù)、ChatGPT虛擬主機(jī)、網(wǎng)站策劃、移動(dòng)網(wǎng)站建設(shè)、網(wǎng)站設(shè)計(jì)公司

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來源: 創(chuàng)新互聯(lián)

網(wǎng)站建設(shè)網(wǎng)站維護(hù)公司
利津县| 涞源县| 固始县| 托克逊县| 怀化市| 忻城县| 公主岭市| 乐平市| 盐池县| 剑河县| 博爱县| 鄂托克旗| 潍坊市| 丰宁| 博客| 临清市| 灵台县| 浦东新区| 贞丰县| 治多县| 融水| 新巴尔虎左旗| 德兴市| 郎溪县| 张家口市| 洪洞县| 台南县| 通化市| 平陆县| 洪江市| 桂林市| 资兴市| 富裕县| 涟水县| 高青县| 申扎县| 新沂市| 宁安市| 彰化市| 万载县| 桐梓县|