內(nèi)網(wǎng)主機(jī)兩臺(tái),一臺(tái)作為普通PC,一臺(tái)添加雙網(wǎng)卡:內(nèi)網(wǎng):192.168.46.10/24 外網(wǎng):10.10.10.20/24
目的:通過(guò)添加靜態(tài)路由,使雙網(wǎng)卡主機(jī)能夠同時(shí)訪問(wèn)內(nèi)網(wǎng)與外網(wǎng)
根據(jù)拓?fù)?/a>配置對(duì)應(yīng)的IP地址
外網(wǎng)web服務(wù)器
nmcli connection modify ens33 ipv4.method manual ipv4.addresses 100.100.1.2/30 ipv4.gateway ''
GW:
interface GigabitEthernet0/0/0 ip address 100.100.1.1 255.255.255.252 interface GigabitEthernet0/0/1 ip address 20.20.20.1 255.255.255.252 rule 5 permit source 192.168.46.0 0.0.0.255 ip route-static 0.0.0.0 0.0.0.0 100.100.1.2 ip route-static 192.168.46.0 255.255.255.0 20.20.20.2
SW3:
gateway-list 192.168.46.254 network 192.168.46.0 mask 255.255.255.0 gateway-list 10.10.10.254 network 10.10.10.0 mask 255.255.255.0 ip address 10.10.10.254 255.255.255.0 ip address 192.168.46.254 255.255.255.0 ip address 20.20.20.2 255.255.255.252 interface GigabitEthernet0/0/1 interface GigabitEthernet0/0/2 port trunk allow-pass vlan 10 20 ip route-static 0.0.0.0 0.0.0.0 20.20.20.1
sw1:
interface GigabitEthernet0/0/1 port trunk allow-pass vlan 10 20 interface GigabitEthernet0/0/22 interface GigabitEthernet0/0/23 interface GigabitEthernet0/0/24
雙網(wǎng)卡PC配置(內(nèi)網(wǎng)其他PC均為自動(dòng)獲取IP):
測(cè)試到網(wǎng)絡(luò)連通性
外網(wǎng)web服務(wù)器:
內(nèi)網(wǎng)PC:
雙網(wǎng)卡主機(jī):
在雙網(wǎng)卡主機(jī)上配置Windows路由策略,使其能夠同時(shí)訪問(wèn)外網(wǎng)與內(nèi)網(wǎng)
route add 0.0.0.0 mask 0.0.0.0 192.168.46.254 route add 10.10.10.20 mask 255.255.255.0 10.10.10.254
訪問(wèn)外網(wǎng)web服務(wù)器,狀態(tài)正常
測(cè)試與內(nèi)網(wǎng)其他主機(jī)通訊
|