- 將實際網路位置、MAC與CentOS 作業系統的NICs 名稱完成對應(以下是在ESXi上實現,故多了一層對應) vmnicMACFunc
NameNetwork
AdapterMAC
(vmOS)ethnameIP-Address說明0xx:40M1178eth010.20.13.101/24GW:10.20.13.1接WAN1的Router LAN1xx:41M2282eth110.21.13.101/24GW:10.21.13.1接WAN2的Router LAN2xx:67MC38ceth210.30.13.100/243xx:98ST496eth310.40.13.101/244xx:99xxxxx
- 永久停用 NetworkManager
chkconfig NetworkManager offservice NetworkManager stop
# 重啟網路 #
service network restart
- 永久關閉防火牆
chkconfig –level 35 iptables off/etc/init.d/iptables stopiptables –P INPUT DROP
- ##Create 2 route table, only fist time need execute bellow command: echo “wan1” >> /etc/iproute2/rt_tables
echo “wan2” >> /etc/iproute2/rt_tables
PS: 檔案 /etc/iproute2/rt_tables 將增加兩行如下圖
- 修改 檔案 /etc/rc.d/rc.local 讓開機時自動建立雙WAN
修改前:
加入指令:1: ##Add routing ip address write to routing table.
2: ##Add route table of wan2
3: ip route add 10.21.13.0/24 dev eth1 src 10.21.13.101 table wan2
4: ip route add 127.0.0.1/8 dev lo scope link table wan2
5: ip route add default via 10.21.13.1 dev eth1 table wan2
6:
7: ##Add route table of wan1
8: ip route add 10.20.13.0/24 dev eth0 src 10.20.13.101 table wan1
9: ip route add 127.0.0.1/8 dev lo scope link table wan1
10: ip route add default via 10.20.13.1 dev eth0 table wan1
11:
12: ##Add rule to route table wan1 and wan2:
13: ip rule add from 10.21.13.101 table wan2
14: ip rule add from 10.20.13.101 table wan1
15:
16: ##Replace default route ip address.
17: ip route add default scope global nexthop via 10.20.13.1 dev eth0 weight 1 nexthop via 10.21.13.1 dev eth1 weight 1
18:
- 設定DNS
ping google.com.tw
無回應時,代表沒設定DNS
互動試設定指令 : system-config-network
參考文章 : CentOS 基礎設定(上)
沒有留言:
張貼留言