<?xml:namespace prefix = v ns = "urn:schemas-microsoft-com:vml" /> <?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />
静态NAT

R1>enable

R1#config t

Enter configuration commands, one per line. End with CNTL/Z.

R1(config)#interface s1/0

R1(config-if)#ip address 202.108.0.1 255.255.255.248

R1(config-if)#encapsulation ppp                        \\ 接口封装为ppp

R1(config-if)#ip nat outside                           \\ 配置为nat外部接口

R1(config-if)#no shutdown

R1(config)#interface f0/0

R1(config-if)#ip address 192.168.0.1 255.255.255.0

R1(config-if)#ip nat inside                             \\ 配置为nat内部接口

R1(config-if)#no shutdown

R1(config-if)#exit

R1(config)#ip route <?xml:namespace prefix = st1 ns = "urn:schemas-microsoft-com:office:smarttags" />0.0.0.0 0.0.0.0 s1/0

R1(config)#ip nat inside source static 192.168.0.2 202.108.0.3    \\ 将内部地址转化为公网源地址

R1(config)#ip nat inside source static 192.168.0.3 202.108.0.4

R2>enable

R2#config t

Enter configuration commands, one per line. End with CNTL/Z.

R2(config)#interface s1/0

R2(config-if)#ip address 202.108.0.2 255.255.255.248

R2(config-if)#encapsulation ppp

R2(config-if)#ip nat outside

R2(config-if)#no shutdown

R2(config)#interface f0/0

R2(config-if)#ip address 10.0.0.1 255.255.255.0

R2(config-if)#ip nat inside

R2(config-if)#no shutdown

R2(config-if)#exit

R2(config)#ip route 0.0.0.0 0.0.0.0 s1/0

R2(config)#ip nat inside source static 10.0.0.2 202.108.0.5

R2(config)#ip nat inside source static 10.0.0.3 202.108.0.6

动态NAT

R1(config)#access-list 1 permit 192.168.0.0 0.0.0.255               \\ 配置ACL确定允许转换网段

R1(config)#ip nat pool eric 202.108.0.3 202.108.0.4 prefix-length 29 \\ 建立公网地址池

R1(config)#ip nat inside source list 1 pool eric                     \\ 进行转换

PAT 配置

R1(config)#access-list 1 permit 192.168.0.0 0.0.0.255              

R1(config)#ip nat pool eric 202.108.0.3 202.108.0.3 prefix-length 29

R1(config)#ip nat inside source list 1 pool eric overload           \\ 进行转换并开启端口pat

基于端口的PAT

R1(config)#access-list 1 permit 192.168.0.0 0.0.0.255

R1(config)#ip nat inside source list 1 interface serial 1/0 overload \\ 直接转换到外部端口上并开启pat