BGP路径选择之MED

BGP路径选择之MED_第1张图片

AS100 AR1配置如下

#
interface GigabitEthernet0/0/0
 ip address 10.0.12.1 255.255.255.0
#
interface GigabitEthernet0/0/1
 ip address 10.0.13.1 255.255.255.0
#
interface GigabitEthernet0/0/2
 ip address 10.0.14.1 255.255.255.0
#
interface LoopBack0
 ip address 10.0.1.1 255.255.255.255
#
interface LoopBack1
 ip address 172.16.1.1 255.255.255.0              #模拟一个网段
#
interface LoopBack2                                            #模拟一个网段
 ip address 172.16.2.1 255.255.255.0
#
interface LoopBack3                                           #模拟一个网段
 ip address 192.168.1.1 255.255.255.0
#
bgp 100
 router-id 10.0.1.1
 peer 10.0.12.2 as-number 200                         #建立邻居
 peer 10.0.13.3 as-number 200
 peer 10.0.14.4 as-number 300
 #
 ipv4-family unicast
  undo synchronization
  network 172.16.1.0 255.255.255.0
  network 172.16.2.0 255.255.255.0                #通告网段
  network 192.168.1.0                                        #自然网段不显示掩码
  peer 10.0.12.2 enable
  peer 10.0.13.3 enable
  peer 10.0.14.4 enable
#


 

AS200的AR2的配置如下

[V200R003C00]
#
 sysname R2
#
 snmp-agent local-engineid 800007DB03000000000000
 snmp-agent
#
 clock timezone China-Standard-Time minus 08:00:00
#
portal local-server load portalpage.zip
#
 drop illegal-mac alarm
#
 set cpu-usage threshold 80 restore 75
#
aaa
 authentication-scheme default
 authorization-scheme default
 accounting-scheme default
 domain default
 domain default_admin
 local-user admin password cipher %$%$K8m.Nt84DZ}e#<0`8bmE3Uw}%$%$
 local-user admin service-type http
#
firewall zone Local
 priority 15
#
interface GigabitEthernet0/0/0
 ip address 10.0.12.2 255.255.255.0
#
interface GigabitEthernet0/0/1
 ip address 10.0.23.2 255.255.255.0
#
interface GigabitEthernet0/0/2
 ip address 10.0.25.2 255.255.255.0
#
interface NULL0
#
interface LoopBack0
 ip address 10.0.2.2 255.255.255.255
#
bgp 200
 router-id 10.0.2.2
 peer 10.0.12.1 as-number 100
 peer 10.0.23.3 as-number 200
 peer 10.0.25.5 as-number 400
 #
 ipv4-family unicast
  undo synchronization
  peer 10.0.12.1 enable
  peer 10.0.12.1 route-policy per_1722 import    #第四步 在import方向使用,因为1722捕捉的172.16.2.0路由是10.0.12.1通告的
  peer 10.0.23.3 enable
  peer 10.0.23.3 next-hop-local              #IBGP邻居习惯配上
  peer 10.0.25.5 enable
#
route-policy per_1722 permit node 10                   #第二步 调用
 if-match ip-prefix per_1722                                  #如果匹配
 apply cost 5                                                        #将MED值设为5.MED值越小越优默认为0
#
route-policy per_1722 permit node 20              #第三步  其它未匹配的都通过
#
ip ip-prefix per_1722 index 10 permit 172.16.2.0 24            #第一步   匹配感兴趣路由
#
user-interface con 0
 authentication-mode password
user-interface vty 0 4
user-interface vty 16 20
#
wlan ac
#
return

 

 

AR3的配置

[V200R003C00]
#
 sysname R3
#
 snmp-agent local-engineid 800007DB03000000000000
 snmp-agent
#
 clock timezone China-Standard-Time minus 08:00:00
#
portal local-server load portalpage.zip
#
 drop illegal-mac alarm
#
 set cpu-usage threshold 80 restore 75
#
aaa
 authentication-scheme default
 authorization-scheme default
 accounting-scheme default
 domain default
 domain default_admin
 local-user admin password cipher %$%$K8m.Nt84DZ}e#<0`8bmE3Uw}%$%$
 local-user admin service-type http
#
firewall zone Local
 priority 15
#
interface GigabitEthernet0/0/0
 ip address 10.0.13.3 255.255.255.0
#
interface GigabitEthernet0/0/1
 ip address 10.0.23.3 255.255.255.0
#
interface GigabitEthernet0/0/2
 ip address 10.0.35.3 255.255.255.0
#
interface NULL0
#
interface LoopBack0
 ip address 10.0.3.3 255.255.255.255
#
bgp 200
 router-id 10.0.3.3
 peer 10.0.13.1 as-number 100
 peer 10.0.23.2 as-number 200
 peer 10.0.35.5 as-number 400
 #
 ipv4-family unicast
  undo synchronization
  peer 10.0.13.1 enable
  peer 10.0.13.1 route-policy per_1721 import
  peer 10.0.23.2 enable
  peer 10.0.23.2 next-hop-local
  peer 10.0.35.5 enable
#
route-policy per_1721 permit node 10
 if-match ip-prefix per_1721
 apply cost 5
#
route-policy per_1721 permit node 20
#
ip ip-prefix per_1721 index 10 permit 172.16.1.0 24
#
user-interface con 0
 authentication-mode password
user-interface vty 0 4
user-interface vty 16 20
#
wlan ac
#
return

 

 

AS300的AR4

[V200R003C00]
#
 sysname R4
#
 snmp-agent local-engineid 800007DB03000000000000
 snmp-agent
#
 clock timezone China-Standard-Time minus 08:00:00
#
portal local-server load portalpage.zip
#
 drop illegal-mac alarm
#
 set cpu-usage threshold 80 restore 75
#
aaa
 authentication-scheme default
 authorization-scheme default
 accounting-scheme default
 domain default
 domain default_admin
 local-user admin password cipher %$%$K8m.Nt84DZ}e#<0`8bmE3Uw}%$%$
 local-user admin service-type http
#
firewall zone Local
 priority 15
#
interface GigabitEthernet0/0/0
 ip address 10.0.14.4 255.255.255.0
#
interface GigabitEthernet0/0/1
 ip address 10.0.45.4 255.255.255.0
#
interface GigabitEthernet0/0/2
#
interface NULL0
#
interface LoopBack0
 ip address 10.0.4.4 255.255.255.255
#
bgp 300
 router-id 10.0.4.4
 peer 10.0.14.1 as-number 100
 peer 10.0.45.5 as-number 400
 #
 ipv4-family unicast
  undo synchronization
  peer 10.0.14.1 enable
  peer 10.0.45.5 enable
#

user-interface con 0
 authentication-mode password
user-interface vty 0 4
user-interface vty 16 20
#
wlan ac
#
return

 

 

AS400的AR5配置如下

[V200R003C00]
#
 sysname R5
#
 snmp-agent local-engineid 800007DB03000000000000
 snmp-agent
#
 clock timezone China-Standard-Time minus 08:00:00
#
portal local-server load portalpage.zip
#
 drop illegal-mac alarm
#
 set cpu-usage threshold 80 restore 75
#
aaa
 authentication-scheme default
 authorization-scheme default
 accounting-scheme default
 domain default
 domain default_admin
 local-user admin password cipher %$%$K8m.Nt84DZ}e#<0`8bmE3Uw}%$%$
 local-user admin service-type http
#
firewall zone Local
 priority 15
#
interface GigabitEthernet0/0/0
 ip address 10.0.25.5 255.255.255.0
#
interface GigabitEthernet0/0/1
 ip address 10.0.35.5 255.255.255.0
#
interface GigabitEthernet0/0/2
 ip address 10.0.45.5 255.255.255.0
#
interface NULL0
#
interface LoopBack0
 ip address 10.0.5.5 255.255.255.255
#
bgp 400
 router-id 10.0.5.5
 peer 10.0.25.2 as-number 200
 peer 10.0.35.3 as-number 200
 peer 10.0.45.4 as-number 300
 #
 ipv4-family unicast
  undo synchronization
  compare-different-as-med #不加此语句,实现不了要求的到192.168.1.0走R4,因为MED默认不允许比较来自不同AS的MED值,加上此语句才行,比较不同的ASmed值
                       
  network 10.0.5.5 255.255.255.255
  peer 10.0.25.2 enable
  peer 10.0.25.2 route-policy per_192 import
  peer 10.0.35.3 enable
  peer 10.0.35.3 route-policy per_1921 import
  peer 10.0.45.4 enable
  peer 10.0.45.4 route-policy per_1923 import
#
route-policy per_192 permit node 10
 if-match ip-prefix per_192
 apply cost 10
#
route-policy per_192 permit node 20
#
route-policy per_1921 permit node 10
 if-match ip-prefix per_192
 apply cost 20
#
route-policy per_1921 permit node 20
#
route-policy per_1923 permit node 10
 if-match ip-prefix per_192
 apply cost 1
#
route-policy per_1923 permit node 20
#
ip ip-prefix per_192 index 10 permit 192.168.1.0 24
#
user-interface con 0
 authentication-mode password
user-interface vty 0 4
user-interface vty 16 20
#
wlan ac
#
return

 

你可能感兴趣的:(interface,Address)