静态NAT要求实现内网IP地址(Inside Local Address)对外网IP地址 (Inside Global Address)之间的一一映射。在实验中以一对地址的映射为例进行配置。 配置清单12-1列出了各路由器配置完成后的结果。
配置清单12-1 配置静态内部源地址转换
第1段:路由器R1的配置 version 12.1 service timestamps debug uptime service timestamps log uptime no service passWord-encryption ! hostname R1 ! ip subnet-zero ! interface Ethemet0 ip address 172.16.1.1255.255.255.0 ip nat inside ! interface Serial0 ip address 200.1.1.1255.255.255.0 ip nat outside ! ip nat inside source static 172.16.1.3 200.1.1.5 ip classless ip route 0.0.0.0 0.0.0.0 200.1.1.2 ip http server ! line con 0 line aux 0 line vty 0 4 ! end 第2段:路由器R2的配置 version 12.1 service timestamps debug uptime service timestamps log uptime no service password-encryption hostname R2 ! ip subnet-zero ! interface Loopback0 ip address 202.1.1.2 255.255.255.0 ! interface Serial0 ip address 200.1.1.2 255.255.255.0 clockrate 64000 ! ip classless ip http server ! line con 0 transport input none line aux 0 Sine vty 0 4 password cisco login ! end 第3段:路由器R3的配置 version 12.1 service timestamps debug uptime service timestamps log uptime no service password-encryption hostname R3 ! ip subnet-zero no ip routing no ip finger ! interface Ethemet0 ip address 172.16.1.3 255.255.255.0 no ip route-cache ip default-gateway 172.16.1.1 ip classless ip http server ! line con 0 transport input none line aux 0 line vty 0 4 password cisco login