PBR在城域网上的应用

来源:互联网 发布:淘宝店铺公告范文 编辑:程序博客网 时间:2024/05/31 18:35

简单介绍:这是模拟城域网的一部分。

PC1,PC2模拟分公司。
CENTER 部署在总公司区域
district 1部分在城市一个区域,属于这个区核心层
ISP1和2之间启用RIP通告路由,模仿ISP,方便做PRB测试。而公司内是使用OSPF路由,分公司与区域核心接入是使用电信EPON网,这里可以把它看成一个交换机。

ISP与公司网络之间没有启任何路由协议,都是使用默认路由指向对方。

真实情况center核心是两台相同设备冗余备份,center两个设备分别与district 1使用一对10G光纤连接,center还外接多个像district 1的区域核心。这里模拟PBR,所以就没用那么多设备来做实验。

需求:一部分分公司走区域核心访问互联网,另一部份只能通过总公司访问互联网。

 ISP1的配置文件
interface Loopback0

ip address 6.6.6.6 255.255.255.255           (用于测试的环回口)

!  

interface FastEthernet0/0

ip address 10.0.1.1 255.255.255.252

speed 100

full-duplex

!

interface Serial0/0

ip address 10.0.0.10 255.255.255.252

clock rate 2000000

!

interface FastEthernet0/1

no ip address

shutdown

duplex auto

speed auto

!

router rip

version 2

network 6.0.0.0

network 10.0.0.0

no auto-summary

!

ip forward-protocol nd

ip route 0.0.0.0 0.0.0.0 Serial0/0

ISP2配置:
interface Loopback0

ip address 4.4.4.4 255.255.255.255          (用于测试的环回口)

!

interface FastEthernet0/0

ip address 10.0.1.2 255.255.255.252

speed 100

full-duplex

!

interface Serial0/0

ip address 10.0.0.6 255.255.255.252

clock rate 2000000

!

interface FastEthernet0/1

no ip address

shutdown

duplex auto

speed auto

!

router rip

version 2

network 4.0.0.0

network 10.0.0.0

no auto-summary

!

ip forward-protocol nd

ip route 0.0.0.0 0.0.0.0 Serial0/0

 

center 配置

interface Loopback0

ip address 1.1.1.1 255.255.255.255

!

interface FastEthernet0/0

ip address 10.0.0.2 255.255.255.252

duplex auto

speed auto

!

interface Serial0/0

ip address 10.0.0.9 255.255.255.252

clock rate 2000000

!

interface FastEthernet0/1

no ip address

shutdown

duplex auto

speed auto

!

interface FastEthernet1/0

no ip address

shutdown

duplex auto

speed auto

!

router ospf 1

router-id 1.1.1.1

log-adjacency-changes

network 1.1.1.1 0.0.0.0 area 0

network 10.0.0.0 0.0.0.3 area 0

!

ip forward-protocol nd

ip route 0.0.0.0 0.0.0.0 Serial0/0

主要是在R2上配置PBR
interface FastEthernet0/0
ip address 10.0.0.1 255.255.255.252
duplex auto
speed auto
!         
interface Serial0/0
ip address 10.0.0.5 255.255.255.252                   (接ISP2接口10.0.0.6/30)
clock rate 2000000
!         
interface FastEthernet0/1
no ip address
speed 100
full-duplex
!         
interface FastEthernet0/1.2
encapsulation dot1Q 2
ip address 10.0.2.1 255.255.255.0
!         
interface FastEthernet0/1.3
encapsulation dot1Q 3
ip address 10.0.3.1 255.255.255.0
ip policy route-map toR1                             PBR应用到接口
!         
router ospf 2
router-id 2.2.2.2
log-adjacency-changes
network 10.0.0.0 0.0.0.3 area 0
network 10.0.2.0 0.0.0.255 area 0
network 10.0.3.0 0.0.0.255 area 0
!         
ip forward-protocol nd
ip route 0.0.0.0 0.0.0.0 Serial0/0
!         
!         
no ip http server
no ip http secure-server
!         
access-list 1 permit 10.0.3.0 0.0.0.255    (根据需求,分公司2通过center 访问互
access-list 2 permit 10.0.2.0 0.0.0.255        联网,其余的分公司照样走district 1访问)

!                                                        
route-map toCENTER permit 1
match ip address 1                                            匹配控制列表1的IP地址
set ip next-hop 10.0.0.2                                     匹配上面地址的下一跳到center

OSPF这里就没有使用默认路由通告,center 与district 1都添加静态默认路由,默认情况下,都会走district的S0/0口访问INTERNET,使用PBR改变下一跳到center ,match的源地址就走center访问Internet.

测试结果:
两个分公司的地址:
NAME   IP/CIDR              GATEWAY           MAC                LPORT  RPORT
VPCS1  10.0.2.2/24          10.0.2.1          00:50:79:66:68:00  20000  30000
       fe80::2050:79ff:fe66:6800/64
VPCS2  10.0.3.2/24          10.0.3.1          00:50:79:66:68:01  20001  30001
       fe80::2050:79ff:fe66:6801/64


VPCS[1]> tracert 6.6.6.6                                   分公司1到ISP1
traceroute to 6.6.6.6, 64 hops max, press Ctrl+C to stop
1   10.0.2.1   94.000 ms  31.000 ms  31.000 ms
2   10.0.0.6   125.000 ms  31.000 ms  31.000 ms
3   10.0.1.1   140.000 ms  *  93.000 ms

VPCS[2]> tracert 6.6.6.6                                     分公司2到ISP1
traceroute to 6.6.6.6, 64 hops max, press Ctrl+C to stop
1   10.0.3.1   62.000 ms  62.000 ms  47.000 ms
2   10.0.0.2   125.000 ms  78.000 ms  62.000 ms
3   10.0.0.10   156.000 ms  *  125.000 ms

VPCS[2]> tracert 4.4.4.4                                         分公司2到ISP2
traceroute to 4.4.4.4, 64 hops max, press Ctrl+C to stop
1   10.0.3.1   110.000 ms  47.000 ms  47.000 ms
2   10.0.0.2   110.000 ms  78.000 ms  78.000 ms
3   10.0.0.10   156.000 ms  62.000 ms  78.000 ms
4   10.0.1.2   156.000 ms  *  140.000 ms

VPCS[1]> tracert 4.4.4.4                                          分公司1到ISP2
traceroute to 4.4.4.4, 64 hops max, press Ctrl+C to stop
1   10.0.2.1   78.000 ms  31.000 ms  31.000 ms
2   10.0.0.6   109.000 ms  *  125.000 ms

VPCS[1]> tracert 1.1.1.1        有匹配的路由,还是往center走,属于内部流量)
traceroute to 1.1.1.1, 64 hops max, press Ctrl+C to stop
1   10.0.2.1   94.000 ms  109.000 ms  47.000 ms
2   10.0.0.2   109.000 ms  *  137.000 ms

VPCS1,2 分别代表分公司1和2,也就是图中的PC1,PC2
4.4.4.4 为ISP2的loopback 0地址
6.6.6.6 为ISP1的loopback 0地址
 1.1.1.1为center的loopback 0地址

这个和真实环境还是有差别的,真实环境使用的不是路由器,而是三层交换机,核心与区域之间还有有流控设备的加入.还有这个PBR没有考虑到核心层冗余备份及负载均衡问题,毕竟区域中心的设备是需要两条线路连接到整个城域网的两台核心设备。

后面有时间,我会慢慢学习研究城域网整体部署配置的问题

原创粉丝点击