Juniper BGP选路原则

路由选路原则

1.查看inet.0路由表中是否存在去往该条BGP路由的下一跳,如果不存在去往BGP下一跳的路由,则这条BGP路由则会被隐藏。
2.优选Local Preference值最大的
3.优选as-path最短的,当as-path路径属性中带有{100,200}AS-SET部分,则该AS-PATH长度为1。如果是这样200{300,400}的则长度为2
4.Origin属性,IGP>EGP>Incomplete
5.MED值,来自同一AS的路由比较MED值,越小越优
6.EBGP路由优先IBGP路由
7.优先选择到达BGP对等体的IGP mertic最小的。如果都是IBGP对等体通告的路由,则会比较到通告者的物理下一跳的mertic,越小越优。物理下一跳使用以下三种决定:1.比较inet.0 和inet.3的路由表中到达该BGP对等体的下一跳地址,在Junos中inet.3的软件路由优于inet.0,这就说明会使用inet.3作为下一跳,也就是mpls的lsp作为下一跳。2.如果inet.0和inet.3的优先值一样,则会优先inet.3。
8.比较cluster List,短的优先。
9.比较peer的router-id,越小越优。
10.比较用来建立bgp会话的IP地址,越小越优先。

BGP AS loops 实验

站点A和站点B都是AS100,同时与AS200建立BGP邻居,站点A和站点B通过AS200互相传递自己的路由条目,但是由于都是AS100,在站点A或站点B收到带有自身AS的路由后会拒绝收该条路由。可以通过配置loops,允许收到带有自己AS的路由。
set protocols bgp group ebgp advertise-peer-as //通告从其它EBGP学习到的路由,即使学习到的路由的AS与要通告给邻居的AS一样。
set routing-options autonomous-system loops 3 //允许收到的路由带有自己AS的数量为3。
在这里插入图片描述

VMX1:
root@VMX1> show configuration | display set 
set version 20.4R1.12
set system host-name VMX1
set system root-authentication encrypted-password "$6$CpXAYOtO$9yO77w5/vSXrOcOXQYofkubcIlKaHeeLcgY7AEMMh07pINi7ox4kNgpAMkJxIGale6igppaDcNFE7MTwRpigq1"
set system syslog file messages any notice
set system syslog file messages authorization info
set system syslog file interactive-commands interactive-commands any
set system processes dhcp-service traceoptions file dhcp_logfile
set system processes dhcp-service traceoptions file size 10m
set system processes dhcp-service traceoptions level all
set system processes dhcp-service traceoptions flag packet
set interfaces ge-0/0/0 unit 0 family inet address 12.1.1.1/24
set interfaces ge-0/0/0 unit 0 family iso
set interfaces fxp0 unit 0 family inet dhcp vendor-id Juniper:vmx:VM610691D706
set interfaces fxp0 unit 0 family inet6 dhcpv6-client client-type stateful
set interfaces fxp0 unit 0 family inet6 dhcpv6-client client-ia-type ia-na
set interfaces fxp0 unit 0 family inet6 dhcpv6-client client-identifier duid-type duid-ll
set interfaces fxp0 unit 0 family inet6 dhcpv6-client vendor-id Juniper:vmx:VM610691D706
set interfaces lo0 unit 0 family inet address 1.1.1.1/32
set interfaces lo0 unit 0 family iso address 49.0001.1111.1111.1111.00
set policy-options policy-statement export-to-bgp term 1 from protocol static
set policy-options policy-statement export-to-bgp term 1 then accept
set policy-options policy-statement export-to-bgp term 2 then reject
set routing-options static route 100.1.1.0/24 reject
set routing-options autonomous-system 100
set routing-options autonomous-system loops 2
set protocols router-advertisement interface fxp0.0
set protocols bgp group ebgp type external
set protocols bgp group ebgp family inet unicast
set protocols bgp group ebgp export export-to-bgp
set protocols bgp group ebgp peer-as 200
set protocols bgp group ebgp neighbor 12.1.1.2
set protocols isis interface ge-0/0/0.0
set protocols isis interface all
set protocols isis level 1 disable
VMX2:
root> show configuration | display set 
set version 20.4R1.12
set system root-authentication encrypted-password "$6$gMiz.dPJ$jWPdMHsEhvxhhA.P9HbZavpIJLMWXuWDgOPGR80Ao4xN0tKAeEOU7NqL4iQ6LTWUiRcNefiUMJwWWBFKzUxD7."
set system syslog file messages any notice
set system syslog file messages authorization info
set system syslog file interactive-commands interactive-commands any
set system processes dhcp-service traceoptions file dhcp_logfile
set system processes dhcp-service traceoptions file size 10m
set system processes dhcp-service traceoptions level all
set system processes dhcp-service traceoptions flag packet
set interfaces ge-0/0/0 unit 0 family inet address 12.1.1.2/24
set interfaces ge-0/0/0 unit 0 family iso
set interfaces ge-0/0/1 unit 0 family inet address 23.1.1.2/24
set interfaces ge-0/0/1 unit 0 family iso
set interfaces fxp0 unit 0 family inet dhcp vendor-id Juniper:vmx:VM61069191F0
set interfaces fxp0 unit 0 family inet6 dhcpv6-client client-type stateful
set interfaces fxp0 unit 0 family inet6 dhcpv6-client client-ia-type ia-na
set interfaces fxp0 unit 0 family inet6 dhcpv6-client client-identifier duid-type duid-ll
set interfaces fxp0 unit 0 family inet6 dhcpv6-client vendor-id Juniper:vmx:VM61069191F0
set interfaces lo0 unit 0 family inet address 2.2.2.2/32
set interfaces lo0 unit 0 family iso address 49.0001.2222.2222.2222.00
set policy-options policy-statement nhs term 1 then next-hop self
set routing-options autonomous-system 200
set protocols router-advertisement interface fxp0.0
set protocols bgp group ebgp type external
set protocols bgp group ebgp advertise-peer-as
set protocols bgp group ebgp peer-as 100
set protocols bgp group ebgp neighbor 12.1.1.1
set protocols bgp group ibgp type internal
set protocols bgp group ibgp export nhs
set protocols bgp group ibgp peer-as 200
set protocols bgp group ibgp neighbor 23.1.1.3
set protocols isis interface all
set protocols isis level 1 disable
VMX3:
root> show configuration | display set                
set version 20.4R1.12
set system root-authentication encrypted-password "$6$gMiz.dPJ$jWPdMHsEhvxhhA.P9HbZavpIJLMWXuWDgOPGR80Ao4xN0tKAeEOU7NqL4iQ6LTWUiRcNefiUMJwWWBFKzUxD7."
set system syslog file messages any notice
set system syslog file messages authorization info
set system syslog file interactive-commands interactive-commands any
set system processes dhcp-service traceoptions file dhcp_logfile
set system processes dhcp-service traceoptions file size 10m
set system processes dhcp-service traceoptions level all
set system processes dhcp-service traceoptions flag packet
set interfaces ge-0/0/0 unit 0 family inet address 23.1.1.3/24
set interfaces ge-0/0/0 unit 0 family iso
set interfaces ge-0/0/1 unit 0 family inet address 34.1.1.3/24
set interfaces ge-0/0/1 unit 0 family iso
set interfaces fxp0 unit 0 family inet dhcp vendor-id Juniper:vmx:VM61069191A6
set interfaces fxp0 unit 0 family inet6 dhcpv6-client client-type stateful
set interfaces fxp0 unit 0 family inet6 dhcpv6-client client-ia-type ia-na
set interfaces fxp0 unit 0 family inet6 dhcpv6-client client-identifier duid-type duid-ll
set interfaces fxp0 unit 0 family inet6 dhcpv6-client vendor-id Juniper:vmx:VM61069191A6
set interfaces lo0 unit 0 family inet address 3.3.3.3/32
set interfaces lo0 unit 0 family iso address 49.0001.3333.3333.3333.00
set policy-options policy-statement nhs term 1 then next-hop self
set routing-options autonomous-system 200
set protocols router-advertisement interface fxp0.0
set protocols bgp group ebgp type external
set protocols bgp group ebgp advertise-peer-as
set protocols bgp group ebgp peer-as 100
set protocols bgp group ebgp neighbor 34.1.1.4
set protocols bgp group ibgp type internal
set protocols bgp group ibgp export nhs
set protocols bgp group ibgp peer-as 200
set protocols bgp group ibgp neighbor 23.1.1.2
set protocols isis interface all
set protocols isis level 1 disable
VMX4:
root> show configuration | display set 
set version 20.4R1.12
set system root-authentication encrypted-password "$6$CpXAYOtO$9yO77w5/vSXrOcOXQYofkubcIlKaHeeLcgY7AEMMh07pINi7ox4kNgpAMkJxIGale6igppaDcNFE7MTwRpigq1"
set system syslog file messages any notice
set system syslog file messages authorization info
set system syslog file interactive-commands interactive-commands any
set system processes dhcp-service traceoptions file dhcp_logfile
set system processes dhcp-service traceoptions file size 10m
set system processes dhcp-service traceoptions level all
set system processes dhcp-service traceoptions flag packet
set interfaces ge-0/0/0 unit 0 family inet address 34.1.1.4/24
set interfaces ge-0/0/0 unit 0 family iso
set interfaces fxp0 unit 0 family inet dhcp vendor-id Juniper:vmx:VM610691A187
set interfaces fxp0 unit 0 family inet6 dhcpv6-client client-type stateful
set interfaces fxp0 unit 0 family inet6 dhcpv6-client client-ia-type ia-na
set interfaces fxp0 unit 0 family inet6 dhcpv6-client client-identifier duid-type duid-ll
set interfaces fxp0 unit 0 family inet6 dhcpv6-client vendor-id Juniper:vmx:VM610691A187
set interfaces lo0 unit 0 family inet address 4.4.4.4/32
set interfaces lo0 unit 0 family iso address 49.0001.4444.4444.4444.00
set policy-options policy-statement export-to-bgp term 1 from protocol static
set policy-options policy-statement export-to-bgp term 1 then accept
set policy-options policy-statement export-to-bgp term 2 then reject
set routing-options static route 200.1.1.0/24 reject
set routing-options autonomous-system 100
set routing-options autonomous-system loops 3
set protocols router-advertisement interface fxp0.0
set protocols bgp family inet unicast loops 3
set protocols bgp group ebgp type external
set protocols bgp group ebgp export export-to-bgp
set protocols bgp group ebgp peer-as 200
set protocols bgp group ebgp neighbor 34.1.1.3
set protocols isis interface all
set protocols isis level 1 disable

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值