CentOS雙網卡雙IP設定

來源:互聯網
上載者:User

標籤:

CentOS雙網卡雙IP設定

系統內容:CentOS Linux

網路環境: 兩個IP地址,192.168.0.10和10.10.30.2,掩碼是255.255.255.0,
這兩個子網的網關地址分別是192.168.0.1和10.10.30.1。

1. 為網卡eth0配置ip地址192.168.0.10,為網卡eth1配置ip地址為10.10.30.2設定檔為:

/etc/sysconfig/network-scripts/ifcfg-eth0

/etc/sysconfig/network-scripts/ifcfg-eth1

2. 配置預設閘道為任意一個。這個預設閘道,決定了系統主動去使用網路時,使用的介面。

設定檔:/etc/sysconfig/network

3. 編輯路由表  www.ahlinux.com  

修改/etc/iproute2/rt_tables,新增內容:

252   net2

251  net3

#/etc/rc.local添加原路返迴路由

ip route flush table net2

ip route add default via 192.168.0.1 dev eth0 src 192.168.0.10 table net2

ip rule add from 192.168.0.10 table net2

ip route flush table net3

ip route add default via 10.10.30.1 dev eth1 src 10.10.30.2 table net3

ip rule add from 10.10.30.2 table net3

本文來自於中國藍客聯盟

    • 本文來自:Linux學習網

CentOS雙網卡雙IP設定

相關文章

聯繫我們

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