NAT的小實驗
阿新 • • 發佈:2018-08-15
term 臺電 器) interface 無法 lan ice ins ast 實驗目的:測試NAT通信
實驗設備:2臺路由器、1臺核心交換機、1臺2層交換機、3臺電腦。
實驗拓撲:
實驗配置:
具體看圖
路由器2(配置NAT的路由器)配置:
Router#show running-config
Building configuration... !
enable password 123@123
!
username 123 privilege 15 password 0 123@123
!
spanning-tree mode pvst
!
interface FastEthernet0/0
ip address 192.168.3.1 255.255.255.0
ip nat outside
duplex auto
speed auto
!
interface FastEthernet0/1
ip address 192.168.1.2 255.255.255.0
ip nat inside
duplex auto
speed auto
!
interface FastEthernet0/1/0
switchport access vlan 4
switchport mode access
!
interface FastEthernet0/1/1
switchport mode access
!
interface FastEthernet0/1/2
switchport mode access
!
interface FastEthernet0/1/3
switchport mode access
!
interface Vlan1
no ip address
shutdown
!
interface Vlan4
ip address 10.10.10.1 255.255.255.0
!
ip nat inside source static 172.168.1.1 192.168.3.1
ip classless
ip route 192.168.1.0 255.255.255.0 192.168.1.1
ip route 192.168.4.0 255.255.255.0 192.168.3.2
ip route 172.168.1.0 255.255.255.0 192.168.1.1
ip route 192.168.2.0 255.255.255.0 192.168.1.1
!
line con 0
!
line aux 0
!
line vty 0 4
login local
!
end
實驗測試:
PC0 ping 4.2
PC2 PING 4.2
實驗設備:2臺路由器、1臺核心交換機、1臺2層交換機、3臺電腦。
實驗拓撲:
實驗配置:
具體看圖
路由器2(配置NAT的路由器)配置:
Router#show running-config
Building configuration...
Current configuration : 1167 bytes
!
version 12.4
no service timestamps log datetime msec
no service timestamps debug datetime msec
no service password-encryption
!
hostname Router
enable password 123@123
!
username 123 privilege 15 password 0 123@123
!
spanning-tree mode pvst
!
interface FastEthernet0/0
ip address 192.168.3.1 255.255.255.0
ip nat outside
duplex auto
speed auto
!
interface FastEthernet0/1
ip address 192.168.1.2 255.255.255.0
ip nat inside
duplex auto
speed auto
!
interface FastEthernet0/1/0
switchport mode access
!
interface FastEthernet0/1/1
switchport mode access
!
interface FastEthernet0/1/2
switchport mode access
!
interface FastEthernet0/1/3
switchport mode access
!
interface Vlan1
no ip address
shutdown
!
interface Vlan4
ip address 10.10.10.1 255.255.255.0
!
ip nat inside source static 172.168.1.1 192.168.3.1
ip route 192.168.1.0 255.255.255.0 192.168.1.1
ip route 192.168.4.0 255.255.255.0 192.168.3.2
ip route 172.168.1.0 255.255.255.0 192.168.1.1
ip route 192.168.2.0 255.255.255.0 192.168.1.1
!
line con 0
!
line aux 0
!
line vty 0 4
login local
!
end
實驗測試:
PC0 ping 4.2
PC2 PING 4.2
192.168.4.2 ping 192.168.2.1 與172.168.1.1
結果:可以ping通未映射的地址,沒辦法ping通已映射的地址(NAT的安全性,忘記的看下NAT的優缺點)。
綜上所述 NAT成功
另想起再一次證明 NAT成功,在NAT路由器上做了Telnet遠程管理(已做),測試下外部是否可以telnet到路由器。
證明:做了NAT的外部地址是無法telnet到外部接口的,但是可以Telnet到其他接口。
好了實驗完畢。勿噴。
NAT的小實驗