Building configuration...
!
version 12.2
no service password-encryption
!
hostname Router
!
!
!
!
!
ip ssh version 1
!
!
interface FastEthernet0/0
ip address 192.168.0.1 255.255.255.0
ip nat inside #nat的内部接口
duplex auto
speed auto
!
interface FastEthernet0/1
no ip address
duplex auto
speed auto
shutdown
!
interface Serial1/0
ip address 172.0.0.1 255.255.0.0
ip nat outside #nat的外部接口
clock rate 64000
!
interface Serial1/1
no ip address
shutdown
!
interface Serial1/2
no ip address
shutdown
!
interface Serial1/3
no ip address
shutdown
!
router ospf 100 # 配置ospf路由协议
log-adjacency-changes
network 192.168.0.0 0.0.0.255 area 0
network 172.0.0.0 0.0.255.255 area 0
!
ip nat pool wan 172.0.0.10 172.0.0.10 netmask 255.255.0.0 #配置nat的地址池
ip nat inside source list 1 pool wan overload #把符合访问控制列表1中的网络转换ip classless 成地址池中的网络
!
!
access-list 1 permit 192.168.0.0 0.0.0.255 #允许访问外网的网络
!
!
!
line con 0
line vty 0 4
login
!
!
end
Building configuration...
!
version 12.4
no service password-encryption
!
hostname Router
!
!
!
!
!
ip ssh version 1
!
!
interface FastEthernet0/0
ip address 10.0.0.1 255.0.0.0
duplex auto
speed auto
!
interface FastEthernet0/1
no ip address
duplex auto
speed auto
shutdown
!
interface Serial1/0
ip address 172.0.0.2 255.255.0.0
!
interface Serial1/1
no ip address
shutdown
!
interface Serial1/2
no ip address
shutdown
!
interface Serial1/3
no ip address
shutdown
!
interface Vlan1
no ip address
shutdown
!
router ospf 200
log-adjacency-changes
network 10.0.0.0 0.255.255.255 area 0
network 172.0.0.0 0.0.255.255 area 0
!
ip classless
!
!
!
!
!
line con 0
line vty 0 4
login
!
!
end
IP NAT debugging is on
Router#
NAT: s=192.168.0.10->172.0.0.10, d=10.0.0.10[1]
NAT: s=192.168.0.10->172.0.0.10, d=10.0.0.10[1]
NAT*: s=10.0.0.10, d=172.0.0.10->192.168.0.10[1]
NAT: s=192.168.0.10->172.0.0.10, d=10.0.0.10[1]
NAT: s=192.168.0.10->172.0.0.10, d=10.0.0.10[1]
NAT*: s=10.0.0.10, d=172.0.0.10->192.168.0.10[1]
NAT*: s=10.0.0.10, d=172.0.0.10->192.168.0.10[1]
NAT: s=192.168.0.10->172.0.0.10, d=10.0.0.10[1]
NAT: s=192.168.0.10->172.0.0.10, d=10.0.0.10[1]
NAT*: s=10.0.0.10, d=172.0.0.10->192.168.0.10[1]
NAT: s=192.168.0.10->172.0.0.10, d=10.0.0.NAT: s=192.168.0.10->172.0.0.10, d=10.0.0.10[1]
NAT: s=192.168.0.10->172.0.0.10, d=10.0.0.10[1]
NAT*: s=10.0.0.10, d=172.0.0.10->192.168.0.10[1]
NAT: s=192.168.0.10->172.0.0.10, d=10.0.0.10[1]
NAT: s=192.168.0.10->172.0.0.10, d=10.0.0.10[1]
NAT*: s=10.0.0.10, d=172.0.0.10->192.168.0.10[1]
NAT*: s=10.0.0.10, d=172.0.0.10->192.168.0.10[1]
NAT: s=192.168.0.10->172.0.0.10, d=10.0.0.10[1]
NAT: s=192.168.0.10->172.0.0.10, d=10.0.0.10[1]
NAT*: s=10.0.0.10, d=172.0.0.10->192.168.0.10[1]
NAT: s=192.168.0.10->172.0.0.10, d=10.0.0.10[1]