实验名称 动态内部源地址转换
实验目的 掌握内网中多台主机连接到Internet网时,通过分时复用多个内部全局地址转换技术。
背景描述
你是公司的高级网络管理员,公司申请了50个公网IP地址为整个销售部门提供上网服务,销售部门的网段是192.168.1.0/24。合法地址不够每人分配一个,但是销售部门平时有三分之一的人在外跑业务,在公司内部的也不会一直需要网络服务,根据此情况请你解决公司全局地址不够一一映射的情况。
实现功能 定义特定网段转发数据分时复用全局地址。
实验拓扑
实验设备
R2624(2台)
实验步骤
第一步: 基本配置
Red-Giant>enable
Red-Giant#conf t
Red-Giant(config)#int s0
Red-Giant(config-if)#ip add 200.168.12.1 255.255.255.0
Red-Giant(config-if)#cl ra 64000
Red-Giant(config-if)#no sh
Red-Giant(config)#hos R1
R1(config)#int f0
R1(config-if)# ip add 192.168.12.1 255.255.255.0
R1(config-if)#no sh
R1(config-if)#end
R2(config)#int serial 0
R2(config-if)#ip add 200.168.12.100 255.255.255.0
R2(config-if)#no sh
R2(config-if)#end
验证测试:R2#ping 200.168.12.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echoes to 200.168.12.1, timeout is 2 seconds:
!!!!!
第二步:配置动态内部源地址转换
R1(config)#ip nat pool net200 200.168.12.2 200.168.12.50 netmask 255.255.255. !定义转换地址池
R1(config)#access-list 1 permit 192.168.12.0 0.0.0.255 ! 定义可以转换地址的网段
R1(config)#ip nat inside source list 1 pool net200 ! 定义内部本地地址池调用转换地址池地址
R1(config)#interface s0
R1(config-if)#ip nat outside ! 定义外部接口
R1(config-if)#exi
R1(config)#int f0
R1(config-if)#ip nat inside !定义内部接口
R1(config-if)#end
验证测试:R1#sh ip nat translations
Pro Inside global Inside local Outside local Outside global
--- 200.168.12.2 192.168.12.2 --- ---
注意事项
l 不要把inside和outside应用的接口弄错
l 要加上能使数据包向外转发的路由,比如默认路由
l 尽量不要用广域网接口地址作为映射的全局地址
参考配置
sh run
Current configuration:
!
version 6.14(2)
!
hostname "R1"
!
ip subnet-zero
!
interface FastEthernet0
ip address 192.168.12.1 255.255.255.0
ip nat inside
!
interface FastEthernet1
no ip address
shutdown
!
interface FastEthernet2
no ip address
shutdown
!
interface FastEthernet3
no ip address
shutdown
!
interface Serial0
ip address 200.168.12.1 255.255.255.0
ip nat outside
clock rate 64000
!
interface Serial1
no ip address
shutdown
!
ip nat pool net200 200.168.12.2 200.168.12.50 netmask 255.255.255.0
ip nat inside source list 1 pool net200
ip classless
ip route 0.0.0.0 0.0.0.0 Serial0
access-list 1 permit 192.168.12.0 0.0.0.255
!
line con 0
line aux 0
line vty 0 4
login
!
end