频道栏目
首页 > 资讯 > 疑难 > 正文

如何实现两条DDN专线相互切换、备份

12-12-08        来源:[db:作者]  
收藏   我要投稿

一位客户原来用2M DDN线路通过电信上互联网,现在新增了一条10M线路通过网通连接到互联网。客户希望在10M线路故障时自动能够切换到2M线路上。客户原有一台防火墙,要求无论使用哪一条线路,流量必须先经过防火墙过滤。  www.2cto.com  
 
客户的局域网中只有数台二层交换机,划分了VLAN,使用3640承担VLAN间路由的任务。内网使用172.16.0.0/16地址,我们假设VLAN1连接3640与普通PC,VLAN2连接3640与防火墙(FW)的内网接口,VLAN10连接3640与防火墙的外网端口。设3640的E0/0端口连接到网通(CNC),S3/1连接到电信(CN)。IP地址如图所示。
 

 
图1
实现原理:相互切换、备份
 
PC1发出的数据包在3640的接口上进行策略路由处理,如果目标地址为本地的其它网段(172.16.0.0/16),则进行的普通路由转发;对于访问Internet的数据包,则将下一跳设为172.16.2.1,将数据包转发给防火墙。
 
防火墙对照规则进行过滤,允许通过的数据包将被转发给3640。这里假设icmp包是被禁止的,其它的数据包都是允许的。
 
3640收到来自于防火墙的数据包之后,进行NAT处理,如果当前CNC线路是通的(路由器选择的下一跳为202.1.1.254),则将源地址转换为202.1.1.2,从e0/0发送出去;否则转换为地址10.1.1.2,则端口s3/1发送到Internet上。
 
配置文件:相互切换、备份
 
***** 3640 配置:  www.2cto.com  
    hostname 3640
    !
    interface Ethernet0/0
     ip address 202.1.1.1 255.255.255.0
     ip nat outside
    !
    interface FastEthernet1/0.1
     encapsulation isl 1
     ip address 172.16.1.254 255.255.255.0
     ip policy route-map to_fw
    !
    interface FastEthernet1/0.2
     encapsulation isl 2
     ip address 172.16.2.254 255.255.255.0
    !
    interface FastEthernet1/0.10
     encapsulation isl 10
     ip address 192.168.1.254 255.255.255.0
     ip nat inside
    !
    interface Serial3/1
     ip address 10.1.1.1 255.255.255.0
     ip nat outside
    !
    ip nat pool cnc 202.1.1.2 202.1.1.2 prefix-length 24
    ip nat pool cn 10.1.1.2 10.1.1.2 prefix-length 24
    ip nat inside source route-map nat_cn pool cn overload
    ip nat inside source route-map nat_cnc pool cnc overload
    ip route 0.0.0.0 0.0.0.0 202.1.1.254
    ip route 0.0.0.0 0.0.0.0 10.1.1.254 100
    !
    access-list 1 permit 172.16.0.0 0.0.255.255
    access-list 2 permit 202.1.1.254
    access-list 3 permit 10.1.1.254
    access-list 100 deny   ip any 172.16.0.0 0.0.255.255
    access-list 100 permit ip any any
    route-map nat_cn permit 10
     match ip address 1
     match ip next-hop 3
    !
    route-map nat_cnc permit 10
     match ip address 1
     match ip next-hop 2
    !
    route-map to_fw permit 10
     match ip address 100
     set ip next-hop 172.16.2.1
    !
 
    ***** FW 配置:
    hostname "FW"
    !
    interface Ethernet0/0
     ip address 172.16.2.1 255.255.255.0
     ip access-group 100 in
    !
    interface Ethernet0/1
     ip address 192.168.1.1 255.255.255.0
    !
    ip route 0.0.0.0 0.0.0.0 192.168.1.254
    ip route 172.16.0.0 255.255.0.0 172.16.2.254
    !
    access-list 100 deny   icmp any any
    access-list 100 permit ip any any
 
    ***** CNC-R6 配置:
    ostname CNC_R6
    !
    interface Loopback0
     ip address 200.200.200.200 255.255.255.0
    !
    interface Ethernet0
     ip address 202.1.1.254 255.255.255.0
    !
    ip route 0.0.0.0 0.0.0.0 202.1.1.1
    line vty 0 4
     password cisco
     login
    !
 
    ***** CN-R4 配置:  www.2cto.com  
    hostname CN_R4
    interface Loopback0
     ip address 200.200.200.200 255.255.255.0
    !
    interface Serial0
     ip address 10.1.1.254 255.255.255.0
    !
    ip classless
    ip route 0.0.0.0 0.0.0.0 10.1.1.1
    !
    line vty 0 4
     password cisco
     login
    !
 
    ***** PC1 配置:
    hostname PC1
    no ip routing
    interface Ethernet0
     ip address 172.16.1.1 255.255.255.0
     no ip route-cache
    !
    ip default-gateway 172.16.1.254
 
    测试:
    1.当所有线路都正常时,从PC1可以telnet到200.200.200.200,使用的线路为CNC的。
    PC1#telnet 200.200.200.200
    Trying 200.200.200.200 ... Open
 
    User Access Verification
 
    Password:
    CNC_R6>show user
        Line       User       Host(s)              Idle       Location
    *  2 vty 0                idle                 00:00:00 202.1.1.2
 
      Interface  User      Mode                     Idle Peer Address
 
    2.在3640上将e0/0 端口shutdown, 从PC1可以telnet到200.200.200.200,使用的线路为CN的。
    PC1#telnet 200.200.200.200
    Trying 200.200.200.200 ... Open
 
    User Access Verification
 
    Password:
    CN_R4>show user
        Line       User       Host(s)              Idle       Location
       0 con 0                idle                 00:19:56
    *  2 vty 0                idle                 00:00:00 10.1.1.2
 
      Interface  User      Mode                     Idle Peer Address
    3.从PC1上Ping 200.200.200.200败,该数据包被FW禁止。
    PC1#ping 200.200.200.200
 
    Type escape sequence to abort.
    Sending 5, 100-byte ICMP Echos to 200.200.200.200, timeout is 2 seconds:
    U.U.U
    Success rate is 0 percent (0/5)
 
相关TAG标签
上一篇:交换网络的建设实例简析
下一篇:iOS虚拟键盘上添加动态按钮
相关文章
图文推荐

关于我们 | 联系我们 | 广告服务 | 投资合作 | 版权申明 | 在线帮助 | 网站地图 | 作品发布 | Vip技术培训 | 举报中心

版权所有: 红黑联盟--致力于做实用的IT技术学习网站