配置如下:
R1#sh run
interface FastEthernet0/0 ---------------设置连接的内网
ip address 10.10.24.1 255.255.255.0 secondary
ip address 10.10.23.2 255.255.255.0 secondary
ip address 10.10.23.3 255.255.255.0 secondary
ip address 10.10.24.2 255.255.255.0 secondary
ip address 10.10.24.3 255.255.255.0 secondary
ip address 10.10.23.1 255.255.255.0
ip nat inside
ip policy route-map 10 --------在该端口上将使用route-map 10进行策略控制
interface Serial1/0 ---------配置ISP 1接入端口
ip address 172.168.1.2 255.255.255.0
ip nat outside
interface Serial1/2 ---------配置ISP 2接入端口
ip address 172.168.2.2 255.255.255.0
ip nat outside
router rip
version 2
network 10.0.0.0
network 172.168.1.0
network 172.168.2.0
!
access-list 1 permit 10.10.23.0 0.0.0.255
access-list 2 permit 10.10.24.0 0.0.0.255
ip nat inside source list 1 interface Serial1/0 overload -----Nat转换,指定原地址为10.10.23.0的主机使用S1/0的地址进行转换
ip nat inside source list 2 interface Serial1/2 overload -----Nat转换,指定原地址为10.10.24.0的主机使用S1/2的地址进行转换
route-map isp permit 10
match ip add 1
set int s1/0
route-map isp permit 20
match ip add 2
set int s 1/2
int f 0/0
ip policy route-map isp
ISP1#sh run
interface Serial1/0
ip address 172.168.1.1 255.255.255.0
serial restart-delay 0
!
interface Serial1/1 -----互联网上的服务网段
ip address 133.0.0.1 255.255.255.0
serial restart-delay 0
router rip
version 2
network 133.0.0.0
network 172.168.1.0
ISP2#sh run
interface Serial1/1
ip address 133.0.0.254 255.255.255.0
serial restart-delay 0
!
interface Serial1/2
ip address 172.168.2.1 255.255.255.0
serial restart-delay 0
router rip
version 2
network 133.0.0.0
network 172.168.2.0
验证:
R1#sh ip nat translations
Pro Inside global Inside local Outside local Outside global
icmp 172.168.1.2:10 10.10.23.1:10 133.0.0.1:10 133.0.0.1:10
icmp 172.168.2.2:9 10.10.24.3:9 133.0.0.1:9 133.0.0.1:9