centos7下雙網卡電信、聯通雙通配置

來源:互聯網
上載者:User

標籤:網卡設定

1、實現:通過電訊廠商提供的智能DNS,把電信使用者訪問時,資料進電信的網卡,出來時也從電信的網關出來,訪問聯通時,從聯通網卡時,聯通網卡出。這樣速度就會快,實現雙線主機的功能。

2、網卡資訊(配置兩條網卡資訊時需要注釋掉一條網關,否則網路將會中斷):
電信IP(TEL):1.82.236.21 netmask 255.255.255.240 gateway 1.82.236.17(em4)
聯通IP(CNC):113.200.100.231 netmask 255.255.255.240 gateway 113.200.100.225(em1)

3、vi /etc/iproute2/rt_tables,增加網通和電信兩個路由表
251 tel 電信路由表
252 cnc 網通路由表

4、設定電信的路由表(命令列直接執行)
ip route flush table tel #清空路由表
ip route add default 1.82.236.17 dev em4 src 1.82.236.21 table tel
ip rule add from 1.82.236.21 table tel

5、設定聯通的路由表
ip route flush table cnc
ip route add default via 113.200.100.225 dev em1 src 113.200.100.231 table cnc
ip rule add from 113.200.100.231 table cnc

6、配置network啟動指令檔 在結尾exit 0之前增加如下內容:
# vi /etc/rc.d/init.d/network

ip route flush table telip route add default 1.82.236.17 dev em4 src 1.82.236.21 table tel ip rule add from 1.82.236.21 table telip route flush table cnc ip route add default via 113.200.100.225 dev em1 src 113.200.100.231 table cnc ip rule add from 113.200.100.231 table cncexit 0

7、重啟系統或網路可能失效,請加入啟動指令碼:
如果是ubuntu/debian,系統啟動指令碼是/etc/rc.local
如果是RedHat/centos,系統啟動指令碼是/etc/rc.d/rc.local

如果是ubuntu/debian,網路啟動指令碼是/etc/init.d/networking
如果是RedHat/centos,網路啟動指令碼是/etc/rc.d/init.d/network

centos7下雙網卡電信、聯通雙通配置

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.