Linux 系統(tǒng)雙網(wǎng)卡綁定配置實(shí)現(xiàn)
系統(tǒng)版本
[root@ ~]# cat /etc/redhat-release CentOS release 6.8 (Final) [root@ ~]# uname -r 2.6.32-642.6.1.el6.x86_64
網(wǎng)卡說(shuō)明
eth0 192.168.1.8(服務(wù)器外網(wǎng)卡)
eth1
eth2
兩塊服務(wù)器網(wǎng)卡(內(nèi)網(wǎng))
關(guān)閉防火墻
[root@ ~]# /etc/init.d/iptables stop [root@ ~]# chkconfig iptables off
關(guān)閉selinux
[root@ ~]#setenforce 0 [root@ ~]#sed -i ‘s/SELINUX=enforcing/SELINUX=disabled/‘ /etc/selinux/config
禁用NetworkManager
[root@ ~]# /etc/init.d/NetworkManager stop Stopping NetworkManager daemon: [ OK ] [root@ ~]# chkconfig NetworkManager off [root@ ~]# /etc/init.d/network restart
編輯eth1網(wǎng)卡
[root@ ~]# cd /etc/sysconfig/network-scripts/ [root@ network-scripts\]# cat >ifcfg-eth1 <<EOF DEVICE=eth1 ONBOOT=yes BOOTPROTO=none USERCTL=no MASTER=bind0 EOF
編輯eth2網(wǎng)卡
[root@ network-scripts]# cat >ifcfg-eth2 <<EOF DEVICE=eth2 ONBOOT=yes BOOTPROTO=none USERCTL=no MASTER=bind0 EOF
編輯bind0網(wǎng)卡
[root@ network-scripts]# cat >ifcfg-bind0 <<EOF DEVICE=bind0 TYPE=Ethernet ONBOOT=yes BOOTPROTO=none IPADDR=10.0.0.8 NETMASK=255.255.255.0 GATEWAY=10.0.0.254 IPV6INIT=no USERCTL=no EOF
配置bond參數(shù)
[root@ network-scripts]# cat >/etc/modprobe.conf <<EOF alias bind0 bonding options bind0 miimon=100 mode=6 EOF
加入開(kāi)機(jī)自啟動(dòng)(/etc/rc.local)
[root@ network-scripts]# cat >>/etc/rc.local <<EOF ifenslave bind0 eth1 eth2 EOF
重啟網(wǎng)絡(luò)服務(wù)
[root@LVS-2 network-scripts]# service network restart Shutting down interface eth0: [ OK ] Shutting down interface eth1: [ OK ] Shutting down interface eth2: [ OK ] Shutting down loopback interface: [ OK ] Bringing up loopback interface: [ OK ] Bringing up interface bind0: WARNING: Deprecated config file /etc/modprobe.conf, all config files belong into /etc/modprobe.d/. WARNING: Deprecated config file /etc/modprobe.conf, all config files belong into /etc/modprobe.d/. Determining if ip address 10.0.0.8 is already in use for device bind0..[ OK ] Bringing up interface eth0: Determining if ip address 192.168.1.8 is already in use for device eth0... [ OK ] Bringing up interface eth1: RTNETLINK answers: File exists [ OK ] Bringing up interface eth2: RTNETLINK answers: File exists [ OK ]
配置使綁定立即生效
[root@LVS-2 network-scripts]# ifenslave bind0 eth1 eth2
測(cè)試聯(lián)通
[root@LVS-2 network-scripts]# ping 10.0.0.8 PING 10.0.0.8 (10.0.0.8) 56(84) bytes of data. 64 bytes from 10.0.0.8: icmp_seq=1 ttl=64 time=0.089 ms 64 bytes from 10.0.0.8: icmp_seq=2 ttl=64 time=0.046 ms ^C --- 10.0.0.8 ping statistics --- 2 packets transmitted, 2 received, 0% packet loss, time 1921ms rtt min/avg/max/mdev = 0.046/0.067/0.089/0.023 ms
此時(shí)會(huì)發(fā)現(xiàn)系統(tǒng)多一個(gè)網(wǎng)卡
[root@LVS-2 network-scripts]# ifconfig bind0 bind0 Link encap:Ethernet HWaddr 00:0C:29:CC:9B:5 inet addr:10.0.0.8 Bcast:10.0.0.255 Mask:255.255.255.0 inet6 addr: fe80::20c:29ff:fecc:9b55/64 Scope:LinkUP BROADCAST RUNNING MASTER MULTICAST MTU:1500 Metric:1 RX packets:151 errors:0 dropped:0 overruns:0 frame:0 TX packets:3 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:11826 (11.5 KiB) TX bytes:258 (258.0 b)
到此這篇關(guān)于Linux 系統(tǒng)雙網(wǎng)卡綁定配置實(shí)現(xiàn)的文章就介紹到這了,更多相關(guān)Linux 雙網(wǎng)卡綁定配置內(nèi)容請(qǐng)搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!
相關(guān)文章
利用VSCode進(jìn)行遠(yuǎn)程Linux服務(wù)器、容器開(kāi)發(fā),達(dá)到ide開(kāi)發(fā)項(xiàng)目的效果(最新推薦)
最方便、最開(kāi)始的開(kāi)發(fā)方式當(dāng)然是在本地ide中,比如初學(xué)者在Windows電腦上使用pycharm來(lái)學(xué)習(xí)python、深度學(xué)習(xí),或者使用devc++、visual?studio等來(lái)編寫(xiě)c++項(xiàng)目,在本地ide中,可以瀏覽文件夾、查看文本和圖片等,進(jìn)一步還可以運(yùn)行調(diào)試python、C++等項(xiàng)目2022-12-12Linux 每天自動(dòng)備份mysql數(shù)據(jù)庫(kù)的方法
linux下為了安全有時(shí)候需要自動(dòng)備份mysql數(shù)據(jù)庫(kù),下面是具體的實(shí)現(xiàn)步驟。感興趣的朋友跟隨小編一起看看吧2009-09-09淺談Linux配置定時(shí),使用crontab -e與直接編輯/etc/crontab的區(qū)別
下面小編就為大家?guī)?lái)一篇淺談Linux配置定時(shí),使用crontab -e與直接編輯/etc/crontab的區(qū)別。小編覺(jué)得挺不錯(cuò)的,現(xiàn)在就分享給大家,也給大家做個(gè)參考。一起跟隨小編過(guò)來(lái)看看吧2016-11-11Linux下connect超時(shí)處理(總結(jié))
這篇文章主要介紹了Linux下connect超時(shí)處理(總結(jié)),小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,也給大家做個(gè)參考。一起跟隨小編過(guò)來(lái)看看吧2017-04-04