114019468.jpg


其他的配置就不上了,主要显示内部网关route-map及NAT配置情况。

配置思路:


一、首先建立ACL过滤感兴趣流量(供route-map调用)

access-list 10 permit 172.16.1.0 0.0.0.255
access-list 20 permit 172.16.2.0 0.0.0.255


二、建立route-map匹配列表及匹配动作(供NAT调用)
route-map 1 permit 10(1自定义只在本地有效,permit表示匹配,10表示列表第一项自定义)

match ip address 10(匹配ACL列表10的流量)
match interface FastEthernet 0/0(匹配端口F0/0,即向F0/0转发)

route-map 2 permit 10
match ip address 20
match interface FastEthernet 0/1

route-map 3 permit 10
match ip address 10

route-map 4 permit 10
match ip address 20

--------------------------------------------------------------

以下route-map应用在网关设备入端口,优先于NAT中的route-map执行。


route-map test permit 10
match ip address 10
match interface FastEthernet 0/0
set interface FastEthernet 0/0(如上述match项匹配,即进行动作向F0/0端口转发)


route-map test permit 20
match ip address 20
match interface FastEthernet 0/1
set interface FastEthernet 0/1


三、接口LAN应用route-maptest

interface FastEthernet 1/0
ip policy route-map test


四、配置NAT:

ip nat source route-map 1 interface FastEthernet 0/0 overload
ip nat source route-map 2 interface FastEthernet 0/1 overload
ip nat source route-map 3 interface FastEthernet 0/1 overload
ip nat source route-map 4 interface FastEthernet 0/0 overload


网关设备接口F0/0、F0/1接口模式分别使用:ip nat outside(注意:ip nat enable)

网关设备接口F1/0接口模式使用:ip nat inside即可。


五、默认路由和指向内网172.16.1.0网段的路由:

ip route 0.0.0.0 0.0.0.0 12.1.1.2
ip route 0.0.0.0 0.0.0.0 13.1.1.3
ip route 172.16.2.0 255.255.255.0 172.16.1.3此处路由主要是因为Lookback0模拟内网网段。


到此,基本配置结束!


测试结果:


172.16.1.3ping4.4.4.4

*Oct3012:43:21.283:NAT*:s=172.16.1.3->12.1.1.1,d=4.4.4.4[45]
*Oct3012:43:21.367:NAT:s=4.4.4.4,d=12.1.1.1->172.16.1.3[45]
*Oct3012:43:21.443:NAT*:s=172.16.1.3->12.1.1.1,d=4.4.4.4[46]
*Oct3012:43:21.507:NAT:s=4.4.4.4,d=12.1.1.1->172.16.1.3[46]
*Oct3012:43:21.599:NAT*:s=172.16.1.3->12.1.1.1,d=4.4.4.4[47]
*Oct3012:43:21.663:NAT:s=4.4.4.4,d=12.1.1.1->172.16.1.3[47]


172.16.2.3ping4.4.4.4

*Oct3012:53:00.359:NAT*:s=172.16.2.3->13.1.1.1,d=4.4.4.4[50]
*Oct3012:53:00.415:NAT:s=4.4.4.4,d=13.1.1.1->172.16.2.3[50]
*Oct3012:53:00.487:NAT*:s=172.16.2.3->13.1.1.1,d=4.4.4.4[51]
*Oct3012:53:00.559:NAT:s=4.4.4.4,d=13.1.1.1->172.16.2.3[51]
*Oct3012:53:00.647:NAT*:s=172.16.2.3->13.1.1.1,d=4.4.4.4[52]
*Oct3012:53:00.743:NAT:s=4.4.4.4,d=13.1.1.1->172.16.2.3[52]

以上信息显示实现数据分流的作用。


当网关设备F0/0接口出现故障后:172.16.1.3ping4.4.4.4的结果:


F0/0shutdown,172.16.1.3ping4.4.4.4

*Oct3013:05:58.815:NAT*:s=172.16.1.3->13.1.1.1,d=4.4.4.4[55]
*Oct3013:05:58.867:NAT:s=4.4.4.4,d=13.1.1.1->172.16.1.3[55]
*Oct3013:05:58.943:NAT*:s=172.16.1.3->13.1.1.1,d=4.4.4.4[56]
*Oct3013:05:59.051:NAT:s=4.4.4.4,d=13.1.1.1->172.16.1.3[56]
*Oct3013:05:59.111:NAT*:s=172.16.1.3->13.1.1.1,d=4.4.4.4[57]
*Oct3013:05:59.147:NAT:s=4.4.4.4,d=13.1.1.1->172.16.1.3[57]


从信息可以看出,172.16.1.3经过13.1.1.1访问4.4.4.4,即备份线路生效。


如果将内部网关设备对端接口shutdown后,172.16.1.3ping4.4.4.4并不会选择走13.1.1.1线路,可以看出此配置方法的不足之处。