用思科路由器如何做NAT

2024-11-12 19:15:54
推荐回答(1个)
回答1:

NAT分静态NAT、动激慧肢态NAT、PAT,我这里说一下动态NAT和PAT
动态NAT:
首先定义明世地址池:
router(config)#ip nat pool netmask
其中pool-name为地址池的名碧派字,ip-first到ip-end是你要定义的地址范围,比如209.165.200.100到209.165.200.200,subnet-mask是子网掩码。
定义好地址池后,可以使用acl定义内网地址和需要访问的地址:
router(config)#access-list 100 permit ip 192.168.1.0 0.0.0.255 any
我这里用的是扩展acl 100,允许192.168.1.0/24网段用户访问所有,即any。
配置动态NAT映射:
router(config)#ip nat inside source list 100 pool pool overload
其中100是acl 100,第二个pool是上边定义的地址池名字。
也可以配置PAT:
router(config)#ip nat inside source list 100 interface f0/0 overload
其中f0/0是外网出口。
在接口上应用nat:
router(config)#interface f0/1
router(config-if)#ip nat inside

router(config)#interface f0/0
router(config-if)#ip nat outside
其中f0/1是路由器内网接口,f0/0是外网接口。