需求:
某部门同时拥有政务网络、互联网业务以及专网业务。三种流量需要再一张网络中进行传输,并且彼此之间互不联通。实现路由隔离,保障数据的安全性。
解决思路:
路由之间通过实例隔离,骨干设备运行mpls,建立MP-IBGP邻居,传递专网和政务网络的实例路由。
实验拓扑:

四台核心设备作为PE进行全互联,连接CE的设备接口绑定实例。CE设备物理接口用于跑互联网流量,在三层接口下开三层子接口绑定实例,进行路由隔离。
CE设备通过静态路由打通三种网络,并且做浮动路由。关联bfd检测。
具体配置:
核心PE设备配置
AR2
配置接口,开启mpls,采用动态ldp分配标签。创建专网和政务网的实例,并将实例与对应三层子接口做绑定。
mpls lsr-id 2.2.2.2
mpls
#
mpls ldp
# //配置专网和政务网的实例
ip vpn-instance ZHENGWU
ipv4-family
route-distinguisher 200:1
vpn-target 2:2 export-extcommunity
vpn-target 2:2 import-extcommunity
#
ip vpn-instance ZHUANWANG
ipv4-family
route-distinguisher 100:1
vpn-target 1:1 export-extcommunity
vpn-target 1:1 import-extcommunity
#
interface GigabitEthernet0/0/0
ip address 12.0.0.2 255.255.255.252
mpls
mpls ldp
#
interface GigabitEthernet0/0/1 //互联网接口
ip address 100.79.31.2 255.255.255.252
#
interface GigabitEthernet0/0/1.10 //专网接口
dot1q termination vid 10
ip binding vpn-instance ZHUANWANG
ip address 100.79.31.6 255.255.255.252
arp broadcast enable
#
interface GigabitEthernet0/0/1.20 //政务网接口
dot1q termination vid 20
ip binding vpn-instance ZHENGWU
ip address 100.79.31.10 255.255.255.252
arp broadcast enable
#
interface GigabitEthernet0/0/2
ip address 2.10.0.2 255.255.255.0
mpls
mpls ldp
配置ospf,用于转发互联网流量以及作为bgp的底层协议
ospf 1 router-id 2.2.2.2
import-route static route-policy net //引入互联网路由
area 0.0.0.0
network 2.2.2.2 0.0.0.0
network 2.10.0.2 0.0.0.0
network 12.0.0.2 0.0.0.0
network 28.0.0.2 0.0.0.0
配置BGP,四台核心之间彼此建立MP-IBGP邻居
bgp 100
peer 1.1.1.1 as-number 100
peer 1.1.1.1 connect-interface LoopBack2
peer 9.9.9.9 as-number 100
peer 9.9.9.9 connect-interface LoopBack2
peer 10.10.10.10 as-number 100
peer 10.10.10.10 connect-interface LoopBack2
#
ipv4-family unicast
undo synchronization
peer 1.1.1.1 enable
peer 9.9.9.9 enable
peer 10.10.10.10 enable
#
ipv4-family vpnv4 //建立MP-IBGP邻居
policy vpn-target
peer 1.1.1.1 enable
peer 9.9.9.9 enable
peer 10.10.10.10 enable
#
ipv4-family vpn-instance ZHENGWU //引入政务网路由。
import-route static route-policy ZHENGWU
#
ipv4-family vpn-instance ZHUANWANG //引入专网路由
import-route static route-policy ZHUANWANG
配置静态路由,并且关联bfd实现路由的浮动
ip route-static 42.228.55.0 255.255.255.0 100.79.31.1 track bfd-session net
ip route-static vpn-instance ZHENGWU 59.207.34.0 255.255.255.0 100.79.31.9 track bfd-session zhengwu
ip route-static vpn-instance ZHUANWANG 16.16.1.0 255.255.255.0 100.79.31.5 track bfd-session zhuanwang
//静态bfd配置
bfd net bind peer-ip 100.79.31.1 source-ip 100.79.31.2
discriminator local 312
discriminator remote 311
commit
#
bfd zhengwu bind peer-ip 100.79.31.9 vpn-instance ZHENGWU source-ip 100.79.31.10
discriminator local 3110
discriminator remote 319
commit
#
bfd zhuanwang bind peer-ip 100.79.31.5 vpn-instance ZHUANWANG source-ip 100.79.31.6
discriminator local 316
discriminator remote 315
commit
通过路由策略进行路由的过滤。在不通协议之间进行路由互注的时候,会将其他不需要的路由注入进路由表中。所以需要配置路由策略进行路由的过滤
acl number 2001
rule 1 permit source 59.0.0.0 0.255.255.255
acl number 2002
rule 1 permit source 16.16.0.0 0.0.255.255
acl number 2003
rule 1 permit source 42.228.55.0 0.0.0.255
#
route-policy ZHENGWU permit node 10 //路由策略会在ospf与bgp中引用
if-match acl 2001
#
route-policy ZHUANWANG permit node 10
if-match acl 2002
#
route-policy net permit node 10
if-match acl 2003
其他三台PE配置类似
AR2
ip vpn-instance ZHENGWU
ipv4-family
route-distinguisher 200:1
vpn-target 2:2 export-extcommunity
vpn-target 2:2 import-extcommunity
#
ip vpn-instance ZHUANWANG
ipv4-family
route-distinguisher 100:1
vpn-target 1:1 export-extcommunity
vpn-target 1:1 import-extcommunity
#
bfd
#
mpls lsr-id 1.1.1.1
mpls
#
mpls ldp
#
#
acl number 2001
rule 1 permit source 59.0.0.0 0.255.255.255
acl number 2002
rule 1 permit source 16.16.0.0 0.0.255.255
acl number 2003
rule 1 permit source 42.228.56.0 0.0.0.255
interface GigabitEthernet0/0/0
ip address 12.0.0.1 255.255.255.252
mpls
mpls ldp
#
interface GigabitEthernet0/0/1
ip address 100.79.32.2 255.255.255.252
#
interface GigabitEthernet0/0/1.10
dot1q termination vid 10
ip binding vpn-instance ZHUANWANG
ip address 100.79.32.6 255.255.255.252
arp broadcast enable
#
interface GigabitEthernet0/0/1.20
dot1q termination vid 20
ip binding vpn-instance ZHENGWU
ip address 100.79.32.10 255.255.255.252
arp broadcast enable
#
interface GigabitEthernet0/0/2
ip address 19.0.0.1 255.255.255.0
mpls
mpls ldp
#
interface LoopBack1
ip address 1.1.1.1 255.255.255.255
bfd net bind peer-ip 100.79.32.1 source-ip 100.79.32.2
discriminator local 322
discriminator remote 321
commit
#
bfd zhengwu bind peer-ip 100.79.32.9 vpn-instance ZHENGWU source-ip 100.79.32.10
discriminator local 3210
discriminator remote 329
commit
#
bfd zhuanwang bind peer-ip 100.79.32.5 vpn-instance ZHUANWANG source-ip 100.79.32.6
discriminator local 326
discriminator remote 325
commit
#
bgp 100
peer 2.2.2.2 as-number 100
peer 2.2.2.2 connect-interface LoopBack1
peer 9.9.9.9 as-number 100
peer 9.9.9.9 connect-interface LoopBack1
peer 10.10.10.10 as-number 100
peer 10.10.10.10 connect-interface LoopBack1
#
ipv4-family unicast
undo synchronization
peer 2.2.2.2 enable
peer 9.9.9.9 enable
peer 10.10.10.10 enable
#
ipv4-family vpnv4
policy vpn-target
peer 2.2.2.2 enable
#
ipv4-family vpn-instance ZHENGWU
import-route static route-policy ZHENGWU
#
ipv4-family vpn-instance ZHUANWANG
import-route static route-policy ZHUANWANG
#
ospf 1 router-id 1.1.1.1
import-route static route-policy net
area 0.0.0.0
network 1.1.1.1 0.0.0.0
network 12.0.0.1 0.0.0.0
network 18.0.0.1 0.0.0.0
network 19.0.0.1 0.0.0.0
#
route-policy ZHENGWU permit node 10
if-match acl 2001
#
route-policy ZHUANWANG permit node 10
if-match acl 2002
#
route-policy net permit node 10
if-match acl 2003
#
ip route-static 42.228.56.0 255.255.255.0 100.79.32.1 track bfd-session net
ip route-static vpn-instance ZHENGWU 59.207.62.0 255.255.255.0 100.79.32.9 track bfd-session zhengwu
ip route-static vpn-instance ZHUANWANG 16.16.2.0 255.255.255.0 100.79.32.5 track bfd-session zhuanwang
R9配置
ip vpn-instance ZHENGWU
ipv4-family
route-distinguisher 200:1
vpn-target 2:2 export-extcommunity
vpn-target 2:2 import-extcommunity
#
ip vpn-instance ZHUANWANG
ipv4-family
route-distinguisher 100:1
vpn-target 1:1 export-extcommunity
vpn-target 1:1 import-extcommunity
#
mpls lsr-id 9.9.9.9
mpls
#
mpls ldp
#
#
acl number 2001
rule 1 permit source 59.0.0.0 0.255.255.255
acl number 2002
rule 1 permit source 16.16.0.0 0.0.255.255
acl number 2003
rule 1 permit source 42.228.56.0 0.0.0.255
interface GigabitEthernet0/0/0
ip address 19.0.0.9 255.255.255.0
mpls
mpls ldp
#
interface GigabitEthernet0/0/1
ip address 9.10.0.9 255.255.255.0
mpls
mpls ldp
#
interface GigabitEthernet0/0/2
ip address 100.79.33.2 255.255.255.252
#
interface GigabitEthernet0/0/2.30
dot1q termination vid 30
ip binding vpn-instance ZHUANWANG
ip address 100.79.33.6 255.255.255.252
arp broadcast enable
#
interface GigabitEthernet0/0/2.40
dot1q termination vid 40
ip binding vpn-instance ZHENGWU
ip address 100.79.33.10 255.255.255.252
arp broadcast enable
#
interface LoopBack9
ip address 9.9.9.9 255.255.255.255
#
bgp 100
peer 1.1.1.1 as-number 100
peer 1.1.1.1 connect-interface LoopBack9
peer 2.2.2.2 as-number 100
peer 2.2.2.2 connect-interface LoopBack9
peer 10.10.10.10 as-number 100
peer 10.10.10.10 connect-interface LoopBack9
#
ipv4-family unicast
undo synchronization
peer 1.1.1.1 enable
peer 2.2.2.2 enable
peer 10.10.10.10 enable
#
ipv4-family vpnv4
default med 100
policy vpn-target
peer 1.1.1.1 enable
peer 2.2.2.2 enable
peer 10.10.10.10 enable
#
ipv4-family vpn-instance ZHENGWU
import-route static route-policy ZHENGWU
#
ipv4-family vpn-instance ZHUANWANG
import-route static route-policy ZHUANWANG
#
ospf 1
import-route static route-policy net
area 0.0.0.0
network 9.9.9.9 0.0.0.0
network 9.10.0.9 0.0.0.0
network 19.0.0.9 0.0.0.0
#
route-policy net permit node 10
if-match acl 2003
#
ip route-static 42.228.56.0 255.255.255.0 100.79.33.1 preference 70
ip route-static vpn-instance ZHENGWU 59.207.62.0 255.255.255.0 100.79.33.9 preference 70
ip route-static vpn-instance ZHUANWANG 16.16.2.0 255.255.255.0 100.79.33.5 preference 70
#
R10
ip vpn-instance ZHENGWU
ipv4-family
route-distinguisher 200:1
vpn-target 2:2 export-extcommunity
vpn-target 2:2 import-extcommunity
#
ip vpn-instance ZHUANWANG
ipv4-family
route-distinguisher 100:1
vpn-target 1:1 export-extcommunity
vpn-target 1:1 import-extcommunity
#
mpls lsr-id 10.10.10.10
mpls
#
mpls ldp
#
#
acl number 2001
rule 1 permit source 59.207.34.0 0.0.0.255
acl number 2002
rule 1 permit source 16.16.1.0 0.0.0.255
acl number 2003
rule 1 permit source 42.228.55.0 0.0.0.255
#
#
interface GigabitEthernet0/0/0
ip address 2.10.0.10 255.255.255.0
mpls
mpls ldp
#
interface GigabitEthernet0/0/1
ip address 9.10.0.10 255.255.255.0
mpls
mpls ldp
#
interface GigabitEthernet0/0/2
ip address 100.79.34.2 255.255.255.252
#
interface GigabitEthernet0/0/2.30
dot1q termination vid 30
ip binding vpn-instance ZHUANWANG
ip address 100.79.34.6 255.255.255.252
arp broadcast enable
#
interface GigabitEthernet0/0/2.40
dot1q termination vid 40
ip binding vpn-instance ZHENGWU
ip address 100.79.34.10 255.255.255.252
arp broadcast enable
#
interface LoopBack10
ip address 10.10.10.10 255.255.255.255
#
bgp 100
peer 1.1.1.1 as-number 100
peer 1.1.1.1 connect-interface LoopBack10
peer 2.2.2.2 as-number 100
peer 2.2.2.2 connect-interface LoopBack10
peer 9.9.9.9 as-number 100
peer 9.9.9.9 connect-interface LoopBack10
#
ipv4-family unicast
undo synchronization
peer 1.1.1.1 enable
peer 2.2.2.2 enable
peer 9.9.9.9 enable
#
ipv4-family vpnv4
default med 10
policy vpn-target
peer 1.1.1.1 enable
peer 2.2.2.2 enable
peer 9.9.9.9 enable
#
ipv4-family vpn-instance ZHENGWU
import-route static route-policy zw
#
ipv4-family vpn-instance ZHUANWANG
import-route static route-policy zhanwang
#
ospf 1
import-route static route-policy net
area 0.0.0.0
network 2.10.0.10 0.0.0.0
network 9.10.0.10 0.0.0.0
network 10.10.10.10 0.0.0.0
#
route-policy zw permit node 10
if-match acl 2001
#
route-policy zhuanwang permit node 10
if-match acl 2002
#
route-policy net permit node 10
if-match acl 2003
#
ip route-static 42.228.55.0 255.255.255.0 100.79.34.1 preference 70
ip route-static vpn-instance ZHENGWU 59.207.34.0 255.255.255.0 100.79.34.9 preference 70
ip route-static vpn-instance ZHUANWANG 16.16.1.0 255.255.255.0 100.79.34.5 preference 70
#
CE1
interface GigabitEthernet0/0/0
ip address 100.79.32.1 255.255.255.252
#
interface GigabitEthernet0/0/0.10
dot1q termination vid 10
ip address 100.79.32.5 255.255.255.252
arp broadcast enable
#
interface GigabitEthernet0/0/0.20
dot1q termination vid 20
ip address 100.79.32.9 255.255.255.252
arp broadcast enable
#
interface GigabitEthernet0/0/1
ip address 100.79.33.1 255.255.255.252
#
interface GigabitEthernet0/0/1.30
dot1q termination vid 30
ip address 100.79.33.5 255.255.255.252
arp broadcast enable
#
interface GigabitEthernet0/0/1.40
dot1q termination vid 40
ip address 100.79.33.9 255.255.255.252
arp broadcast enable
#
interface GigabitEthernet0/0/2
#
interface NULL0
#
interface LoopBack7
ip address 7.7.7.7 255.255.255.255
#
interface LoopBack16
ip address 16.16.2.254 255.255.255.0
#
interface LoopBack42
ip address 42.228.56.254 255.255.255.0
#
interface LoopBack59
ip address 59.207.62.254 255.255.255.0
#
bfd net bind peer-ip 100.79.32.2 source-ip 100.79.32.1
discriminator local 321
discriminator remote 322
commit
#
bfd zhengwu bind peer-ip 100.79.32.10 source-ip 100.79.32.9
discriminator local 329
discriminator remote 3210
commit
#
bfd zhuangwang bind peer-ip 100.79.32.6 source-ip 100.79.32.5
discriminator local 325
discriminator remote 326
commit
#
ip route-static 0.0.0.0 0.0.0.0 100.79.32.2 track bfd-session net
ip route-static 0.0.0.0 0.0.0.0 100.79.33.2 preference 70
ip route-static 16.16.0.0 255.255.0.0 100.79.32.6 track bfd-session zhuangwang
ip route-static 16.16.1.0 255.255.255.0 100.79.33.6 preference 70
ip route-static 59.0.0.0 255.0.0.0 100.79.32.10 track bfd-session zhengwu
ip route-static 59.207.34.0 255.255.255.0 100.79.33.10 preference 70
CE2
interface GigabitEthernet0/0/0
ip address 100.79.31.1 255.255.255.252
#
interface GigabitEthernet0/0/0.10
dot1q termination vid 10
ip address 100.79.31.5 255.255.255.252
arp broadcast enable
#
interface GigabitEthernet0/0/0.20
dot1q termination vid 20
ip address 100.79.31.9 255.255.255.252
arp broadcast enable
#
interface GigabitEthernet0/0/1
ip address 100.79.34.1 255.255.255.252
#
interface GigabitEthernet0/0/1.30
dot1q termination vid 30
ip address 100.79.34.5 255.255.255.252
arp broadcast enable
#
interface GigabitEthernet0/0/1.40
dot1q termination vid 40
ip address 100.79.34.9 255.255.255.252
arp broadcast enable
#
interface GigabitEthernet0/0/2
#
interface NULL0
#
interface LoopBack16
ip address 16.16.1.254 255.255.255.0
#
interface LoopBack42
ip address 42.228.55.254 255.255.255.0
#
interface LoopBack59
ip address 59.207.34.254 255.255.255.0
#
bfd net bind peer-ip 100.79.31.2 source-ip 100.79.31.1
discriminator local 311
discriminator remote 312
commit
#
bfd zhengwu bind peer-ip 100.79.31.10 source-ip 100.79.31.9
discriminator local 319
discriminator remote 3110
commit
#
bfd zhuanwang bind peer-ip 100.79.31.6 source-ip 100.79.31.5
discriminator local 315
discriminator remote 316
commit
#
ip route-static 0.0.0.0 0.0.0.0 100.79.34.2 preference 70
ip route-static 0.0.0.0 0.0.0.0 100.79.31.2 track bfd-session net
ip route-static 16.16.0.0 255.255.0.0 100.79.34.6 preference 70
ip route-static 16.16.0.0 255.255.0.0 100.79.31.6 track bfd-session zhuanwang
ip route-static 59.0.0.0 255.0.0.0 100.79.34.10 preference 70
ip route-static 59.0.0.0 255.0.0.0 100.79.31.10 track bfd-session zhengwu
测试
专网:

政务网络:

互联网:

路由表

追踪路由流量通过R2转发

此时模拟链路故障,将R5的g0/0/0端口down掉

此时R2不在转发流量,通过路由追踪

流量通过R10转发。
2064

被折叠的 条评论
为什么被折叠?



