实验网络拓朴:
实验目的:演示内部源地址到内部全局地址之间的动态转换。路由器R2把10.1.1.1到10.1.1.3之间的任一源地址动态转换为地址池中的三个内部全局地址之一(Internet注册过的唯一全局地址)。
监测配置:在路由器R2上,用扩展ping命令测试配置,在特权模式下键入ping即可。
R2#pingProtocol [ip]:
Target IP address: 152.1.1.1Repeat count [5]: 10
Datagram size [100]:
Timeout in seconds [2]:
Extended commands [n]: ySource address or interface: 10.1.1.1
Type of service [0]:
Set DF bit in IP header? [no]:
Validate reply data? [no]:
Data pattern [0xABCD]:
Loose, Strict, Record, Timestamp, Verbose[none]:
Sweep range of sizes [n]:
1) 从路由器R2,用源地址10.1.1.2 ping 152.1.1.1
2) 从路由器R2,用源地址10.1.1.1 ping 152.1.1.1
3) 从路由器R2,用源地址10.1.1.3 ping 152.1.1.1
在路由器R2上执行debug ip nat命令,可得知IP地址转换情况,如下所示:
12:00:29: NAT: s=10.1.1.1->195.1.1.1, d=152.1.1.1 [1]
12:00:29: NAT*: s=152.1.1.1, d=195.1.1.1->10.1.1.1 [1]
12:01:26: NAT: s=10.1.1.2->195.1.1.2, d=152.1.1.1 [11]
12:01:26: NAT*: s=152.1.1.1, d=195.1.1.2->10.1.1.2 [11]
12:01:55: NAT: s=10.1.1.3->195.1.1.3, d=152.1.1.1 [16]
12:01:55: NAT*: s=152.1.1.1, d=195.1.1.3->10.1.1.3 [16]
当第4台终端站点想访问外面的网络时,所发生的情况,但是IP地址池中的的所有地址都用完了,如下所示:
12:02:33: NAT: translation failed (E), dropping packet s=10.1.1.4 d=152.1.1.1.
12:02:35: NAT: translation failed (E), dropping packet s=10.1.1.4 d=152.1.1.1.
R2#sh ip nat translations
Pro Inside global Inside local Outside local Outside global
--- 195.1.1.1 10.1.1.1 --- ---
--- 195.1.1.2 10.1.1.2 --- ---
--- 195.1.1.3 10.1.1.3 --- ---
从上面的例子可知,虽然动态地址转换比静态转换效率更高,但每一转换仍需要自己
的地址。因此,网络管理者必须正确地掌握离线访问的通信量并相应地定义地址池的大小。
路由器配置:
R2路由器:
version 12.1
service timestamps debug uptime
service timestamps log uptime
no service password-encryption
!
hostname R2
!
memory-size iomem 15
ip subnet-zero
!
interface Ethernet1/0
ip address 10.1.1.1 255.255.255.0 secondary
ip address 10.1.1.2 255.255.255.0 secondary
ip address 10.1.1.3 255.255.255.0 secondary
ip address 10.1.1.4 255.255.255.0 secondary
ip address 10.1.1.5 255.255.255.0
ip nat inside
!
interface Ethernet1/1
ip address 195.1.1.4 255.255.255.0
ip nat outside
!
ip nat pool globalpool 195.1.1.1 195.1.1.3 netmask 255.255.255.0ip nat inside source list 1 pool globalpool
ip classless
ip route 152.1.1.1 255.255.255.255 Ethernet1/1no ip http server
!
access-list 1 permit 10.1.1.2
access-list 1 permit 10.1.1.3
access-list 1 permit 10.1.1.1
access-list 1 permit 10.1.1.4!
line con 0
transport input none
line aux 0
line vty 0 4
login
!
end
R3路由器:
version 12.1
service timestamps debug uptime
service timestamps log uptime
no service password-encryption
!
hostname R3
!
memory-size iomem 15
ip subnet-zero
!
interface Ethernet1/0
ip address 195.1.1.10 255.255.255.0
!
interface Ethernet1/1
ip address 152.1.1.1 255.255.255.0
!
interface Ethernet1/2
no ip address
shutdown
!
interface Ethernet1/3
no ip address
shutdown
!
ip classless
no ip http server
!
line con 0
transport input none
line aux 0
line vty 0 4
login
!
end
没有评论:
发表评论