1.配置IP地址
[r1]int g0/0/0 [r1-GigabitEthernet0/0/0]ip add 12.1.1.1 24 [r1]int g0/0/1 [r1-GigabitEthernet0/0/1]ip add 192.168.1.1 24 [r2]int g0/0/0 [r2-GigabitEthernet0/0/0]ip add 12.1.1.2 24 [r2]int g0/0/1 [r2-GigabitEthernet0/0/1]ip add 1.1.1.1 24
2.为R1配置缺省指向12.1.1.2
[r1]ip route-static 0.0.0.0 0 12.1.1.2?
(验证)
(可得出,R1的G0/0/0接口为公有IP)
3.“一对多”
[r1]acl 2000 [r1-acl-basic-2000]rule permit source 192.168.1.0 0.0.0.255 [r1]int g0/0/0 [r1-GigabitEthernet0/0/0]nat outbound 2000
(验证)
4.端口映射
(1)配置服务器
(2)配置端口映射
[r1]int g0/0/0 [r1-GigabitEthernet0/0/0]nat server protocol tcp global current-interface 80 inside 192.168.1.10 80 Warning:The port 80 is well-known port. If you continue it may cause function failure. Are you sure to continue?[Y/N]:y [r1-GigabitEthernet0/0/0]nat server protocol tcp global current-interface 8888 inside 192.168.1.20 80
(3)测试
4.通过域名访问一台server
|