a我考网

 找回密码
 立即注册

QQ登录

只需一步,快速开始

扫一扫,访问微社区

查看: 84|回复: 0

[综合] 思科辅导:Cisco策略路由双地址双出口+NAT介绍

[复制链接]
发表于 2012-8-3 20:03:30 | 显示全部楼层 |阅读模式
环境描述:使用设备为Cisco2621XM + NE-1E模块,该配置拥有两个FastEthernet以及一个Ethernet端口。  现使用Ethernet 1/0 端口连接内部局域网,模拟内部拥有100.100.23.0 255.255.0.0 与100.100.24.0 255.255.0.0 两组客户机情况下基于原地址的策略路由。   Fastethernet 0/0 模拟第一个ISP接入端口,Fastethernet 0/1模拟第二个ISP接入端口,地址分别为 Fastethernet 0/0 的ip地址192.168.1.2 255.255.255.0 对端ISP地址192.168.1.1 255.255.255.0
0 i; }9 S* A" n+ P; A+ p5 `  Fastethernet 0/1 的ip地址192.168.2.2 255.255.255.0 对端ISP地址192.168.2.1 255.255.255.0* V6 R) J) m/ C% M+ V# t
  通过策略路由后对不同原地址数据流量进行分流,使得不同原地址主机通过不同ISP接口访问Internet,并为不同原地址主机同不同NAT地址进行转换。' w3 i0 P5 P; U0 {! z
  具体配置:
% u' [( ^5 j) l/ q2 M  version 12.2  service timestamps debug uptime  service timestamps log uptime  no service password-encryption  !  hostname Router  !!  ip subnet-zero  !!  call rsvp-sync   !  interface FastEthernet0/0 --------------------假设该端口为ISP 1接入端口  ip address 192.168.1.2 255.255.255.0 --------分配地址  ip nat outside --------指定为NAT Outside端口  duplex auto  speed auto  !  interface FastEthernet0/1 --------------------假设该端口为ISP 2接入端口  ip address 192.168.2.2 255.255.255.0 --------分配地址  ip nat outside --------指定为NAT Outside端口  duplex auto  speed auto  !  interface Ethernet1/0 --------------------假设该端口为内部网络端口  ip address 100.100.255.254 255.255.0.0 --------分配地址  ip nat inside --------指定为NAT Inside端口  ip policy route-map t0 --------在该端口上使用route-map t0进行策略控制  half-duplex  !  ip nat inside source list 1 interface FastEthernet0/0 overload ------Nat转换,指定原地址为100.100.23.0的主机使用Fastethernet 0/0的地址进行转换  ip nat inside source list 2 interface FastEthernet0/1 overload ------Nat转换,指定原地址为100.100.24.0的主机使用Fastethernet 0/1的地址进行转换  ip classless  ip route 0.0.0.0 0.0.0.0 192.168.2.1 ------静态路由,对Internet的访问通过192.168.2.1(ISP2)链路  ip route 0.0.0.0 0.0.0.0 192.168.1.1 ------静态路由,对Internet的访问通过192.168.1.1(ISP1)链路  ip http server  静太路由不起很大的作用,因为存在策略路由,主要是set int 要求有显示的去往目的的路由  !  access-list 1 permit 100.100.23.0 0.0.0.255 ----访问控制列表1,用于过滤原地址,允许100.100.23.0网段主机流量通过  access-list 2 permit 100.100.24.0 0.0.0.255 ----访问控制列表2,用于过滤原地址,允许100.100.23.0网段主机流量通过  如果做set int 备份,则acl1,acl2应该允许所有的,进行nat  route-map t0 permit 10 ----定义route-map t0,permit序列为10  match ip address 1 ----检查原地址,允许100.100.23.0 网段地址  set interface FastEthernet0/0 ----指定出口为Fastethetnet 0/0  (set interface FastEthernet0/1) 我认为可以做备份  !  route-map t0 permit 20 ----定义route-map t0,permit序列为20  match ip address 2 ----检查原地址,允许100.100.24.0 网段地址  set interface FastEthernet0/1 ----指定出口为Fastethetnet 0/1  !  (set interface FastEthernet0/1) 我认为可做备份 !  dial-peer cor custom   !  line con 0  line aux 0  line vty 0 4  !  end
( W2 i1 u+ g) b  效果检验: 察看路由表
2 d& ~$ l0 Z) J2 b, P  Router#show ip route  Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP  D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area  N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2  E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP  i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2  ia - IS-IS inter area, * - candidate default, U - per-user static route  o - ODR, P - periodic downloaded static route  100.0.0.0/16 is subnetted, 1 subnets  C 100.100.0.0 is directly connected, Ethernet1/0  C 192.168.1.0/24 is directly connected, FastEthernet0/0  C 192.168.2.0/24 is directly connected, FastEthernet0/1  S* 0.0.0.0/0 [1/0] via 192.168.1.1  [1/0] via 192.168.2.1% ~. P9 ^) ^3 a
  发现静态路由存在两条路径!% q3 p# w+ Q0 z0 Q
  察看ip Nat translations
9 r9 M9 y& P3 Z9 j4 J2 T  Router#sho ip nat translations  Pro Inside global Inside local Outside local Outside global  icmp 192.168.1.2:1024 100.100.23.23:1024 1.1.1.1:1024 1.1.1.1:1024  icmp 192.168.2.2:1280 100.100.24.23:1280 1.1.1.1:1280 1.1.1.1:1280! |: O. `  y& _
  由于路由器外部存在1.1.1.1的地址,用于模拟Internet公网地址,发现不同网段内部主机流量确实已经从不同出口访问外部资源,并且使用了不同Nat进行地址转换!/ T. d6 F' x. h, U; E
  注:大部分多ISP情况下都要使用NAT地址转换功能,但有些特殊情况下不需使用NAT功能,如果不是用NAT,就将配置中的有关NAT的配置去掉,- L1 a- m0 h4 s' n) T
  如此配置中去掉 ip nat inside source list 1 interface FastEthernet0/0 overload 和ip nat inside source list 2 interface FastEthernet0/1 overload
0 d! A! @* f1 A; K0 I3 u- n  以及在端口上去掉ip Nat outside和ip nat inside的配置,就可以实现不用NAT的策略路由。: z2 d2 Y) Y) v# w$ r1 c
  以上试验可以实现基于原地址的策略路由功能,可以根据内网原地址进行不同流量通过不同ISP接口访问Internet的功能,但仍没有实现双链路相互备份的功能,即当任意一条链路出现故障的时候无法自动使用另一条链路进行备份,造成一部分相应的内网主机无法访问外网的情况。
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Archiver|手机版|小黑屋|Woexam.Com ( 湘ICP备18023104号 )

GMT+8, 2024-5-15 04:43 , Processed in 0.550000 second(s), 21 queries .

Powered by Discuz! X3.4 Licensed

© 2001-2017 Comsenz Inc.

快速回复 返回顶部 返回列表