实验拓扑及要求
网段:
192.168.1.0 24
12.1.1.0 24
1.1.1.0 24
IP配置
[r1-GigabitEthernet0/0/0]ip ad 192.168.1.1 24
[r1-GigabitEthernet0/0/1]ip ad 12.1.1.1 24
[r2-GigabitEthernet0/0/0]ip ad 12.1.1.2 24
[r2-GigabitEthernet0/0/1]ip ad 1.1.1.1 24
pc1:192.168.1.2 24
pc2:192.168.1.3 24
HTTP1:192.168.1.4 24
HTTP2;192.168.1.5 24
client:1.1.1.2 24
DNS:1.1.1.3 24
添加静态路由[r1]ip route-static 1.1.1.0 24 12.1.1.2
缺省路由[r1]ip route-static 1.1.1.0 24 12.1.1.2
pc1pc2可以ping通client和DNS 一对多
使用acl,定义可被转化的私有IP地址范围
[r1]acl 2000
[r1-acl-basic-2000]rule permit source 192.168.1.0 0.0.0.255
再在r1(边界路由器)上,公有IP地址所在接口进行nat配置
[r1]interface g0/0/1
[r1-GigabitEthernet0/0/1]nat outbound 2000
[r1-GigabitEthernet0/0/1]nat static global 12.1.1.3 inside 192.168.1.4
但只有一个公有地址
[r1-GigabitEthernet0/0/1]undo nat static global 12.1.1.3 inside 192.168.1.4
端口映射
[r1-GigabitEthernet0/0/1]nat server protocol tcp global current-interface 80 inside 192.168.1.4 80
Warning:The port 80 is well-known port. If you continue it may cause function fa
ilure.
Are you sure to continue?[Y/N]:y
[r1-GigabitEthernet0/0/1]nat server protocol tcp global current-interface 8888 inside 192.168.1.5 80