使用软件:
dynamips路由器模拟器
按照上面拓扑连接设备
R1配置 |
R7配置 |
host R1 int f0/0 ip add 192.168.0.2 255.255.255.0 no shut ip route 0.0.0.0 0.0.0.0 192.168.0.1 //用路由器来模拟PC所以要加默认路由 |
host R7 int f0/0 ip add 192.168.0.3 255.255.255.0 no shut ip route 0.0.0.0 0.0.0.0 192.168.0.1 //用路由器来模拟PC所以要加默认路由 |
R2配置 |
ISP配置 |
host R2 int f0/0 ip add 192.168.0.1 255.255.255.0 ip route 0.0.0.0 0.0.0.0 202.99.224.10 int s1/1 ip add 202.99.224.9 255.255.255.252 clock rate 56000 no shut
|
host ISP int l0 //用loopback地址来模拟外网 ip add 202.99.223.1 255.255.255.0 int s1/0 ip add 202.99.224.10 255.255.255.252 no shut
|
R2:
access-list 1 permit 192.168.0.0 0.0.0.255
ip nat inside source static 192.168.0.2 202.99.224.13
ip nat inside source static 192.168.0.3 202.99.224.14
int f0/0
ip nat inside
int s1/1
ip nat outside
验证:可以在R2和R7上ping 202.99.223.1然后在R2上用show ip nat trans查看转换情况
R2:
access-list 1 permit 192.168.0.0 0.0.0.255
ip nat pool pool1 202.99.224.13 202.99.224.14 netmask 255.255.255.252
ip nat inside source list 1 pool pool1
int f0/0
ip nat inside
int s1/1
ip nat outside
验证:可以在R2和R7上ping 202.99.223.1然后在R2上用show ip nat trans查看转换情况
R2:
access-list 1 permit 192.168.0.0 0.0.0.255
ip nat inside source list 1 interface s1/1 overload
int f0/0
ip nat inside
int s1/1
ip nat outside
验证:可以在R2和R7上ping 202.99.223.1然后在R2上用show ip nat trans查看转换情况
1.6、补充说明
show ip nat translations 显示被转换的情况
show ip nat statistics
显示nat统计信息
show ip nat transitions verbose显示被转换的详细情况
1.6、针对端口映射
R2:
access-list 1 permit 192.168.0.0 0.0.0.255
ip nat inside source static tcp 192.168.0.2
1111 202.99.224.13 1111 针对端口映射
int f0/0
ip nat inside
int s1/1
ip nat outside
ip nat inside
int s1/1
ip nat outside
本文转自zcm8483 51CTO博客,原文链接:http://blog.51cto.com/haolun/993006