四:配置2实例
特点是:loopback0做inside接口。
interface Loopback0
ip address 172.16.1.1 255.255.255.248
ip nat inside
ip policy route-map rm_nat
!
interface FastEthernet0/0
ip address 172.16.0.1 255.255.255.0 secondary
ip address 192.168.0.1 255.255.255.252
ip nat outside
ip policy route-map no_route
!
ip nat pool st_pool 61.233.13.193 61.233.13.198 netmask 255.255.255.248
ip nat inside source list 10 pool st_pool
ip classless
ip route 0.0.0.0 0.0.0.0 Loopback0
access-list 10 permit 172.16.0.0 0.0.0.255
access-list 101 permit ip any any
access-list 102 permit ip 172.16.0.0 0.0.0.255 any
route-map no_route permit 10
match ip address 102
set interface Loopback0
!
route-map rm_nat permit 10
match ip address 101
set ip next-hop 192.168.0.2
该实例的主要区别是采用了2个策略路由,其目的都是实现使包到达inside接口或outside接口,且满足NAT转换的路由条件。
需要注意的是:NAT地址池的地址不必非要与ISP端路由器地址同一网段,可以是公网IP,也可以是私网地址。只要ISP能区分就行。且ISP必须有到达NAT地址池的路由(静态或动态都行)。
对于NAT路由器来说,只需要有“ip route 0.0.0.0 0.0.0.0 ISP端IP地址”这条命令即可。