ENSP HCIP BGP初级实验2

2023-06-04 11:27:53 浏览数 (3)

1、每台设备BGP route id修改为自己的router id 2、AR4上有10.1.1.0/24,要求AR1访问AR4走上面的链路。使用协议首选值 3、在AR1发给AR3的10.1.1.0/24网段的路由协议首选值改为100,其他传递的路由协议首选值不变 4、要求RR设备访问20网段的时候通过AR3走,如果没有通过AR3发出则通过修改开销值的方式实现选路,并且不影响AR3去往AR2的loopback接口路由 5、在AR1上通告192.168.1.0/24网段,让AR4从AR2学习到的路由本地优先级改为50,从AR3学到的路由本地优先级改为80 6、AR5发布了一条10.1.5.0/24的路由,AR6上发布了一条10.1.6.0/24的路由。但是AR4访问5.0的路由时走AR6访问。AR4访问6.0的时候从AR5来走。要求在AR4上通过MED来实现。 7、AR1访问5.0网段走AR2,访问6.0网段走AR3,使用AS-path 8、在AR3上将AR1发来的20.1.1.0网段的路由和2.0网段路由起源属性修改为?

关键部分
代码语言:javascript复制
1、[AR*-bgp]router-id x.x.x.x

2、[AR1-bgp]peer 12.1.1.2 preferred-value 6000

3、[AR1]ip ip-prefix 1 index 10 permit 10.1.1.0 24
        route-policy 1 permit node 10 
         if-match ip-prefix 1 
         apply preferred-value 100
        route-policy 1 permit node 1000
   [AR1-bgp]peer 13.1.1.3 route-policy 1 import

4、[AR2-LoopBack0]ospf cost 10

5、[AR2]ip ip-prefix 5 permit 192.168.1.0 24
        route-policy 5 permit node 10 
         if-match ip-prefix 5 
         apply local-preference 50 
        route-policy 5 permit node 1000
   [AR2-bgp]peer 4.4.4.4 route-policy 5 export

   [AR4]ip ip-prefix 5 permit 192.168.1.0 24
        route-policy 5 permit node 10 
         if-match ip-prefix 5 
         apply local-preference 80
       route-policy 5 permit node 1000
   [AR4-bgp]peer 3.3.3.3 route-policy 5 import

6、[AR4]ip ip-prefix 2 index 10 permit 10.1.5.0 24
         route-policy 2 permit node 10 
          if-match ip-prefix 2 
          apply cost 50 
       route-policy 2 permit node 1000 
      peer 45.1.1.5 route-policy 2 import
  [AR6]ip ip-prefix 2 index 10 permit 10.1.6.0 24
         route-policy 2 permit node 10 
          if-match ip-prefix 2 
          apply cost 50 
       route-policy 2 permit node 1000 
      peer 45.1.1.5 route-policy 2 export

7、[AR1]ip ip-prefix 50 permit 10.1.5.0 24
   [AR1]ip ip-prefix 60 permit 10.1.6.0 24

   route-policy 1 permit node 20 
   if-match ip-prefix 50 
     apply preferred-value 0
    apply as-path 1 1 additive
   route-policy 1 permit node 30 
    if-match ip-prefix 60
    apply preferred-value 0

  route-policy 2 permit node 20 
   if-match ip-prefix 50 
   apply preferred-value 0
   route-policy 2 permit node 30 
    if-match ip-prefix 60
    apply preferred-value 0
    apply as-path 1 1 additive
  route-policy 2 permit node 1000
  peer 12.1.1.2 route-policy 2 import

8、[AR3]ip ip-prefix 10 permit 20.1.1.0 24
        ip ip-prefix 20 permit 20.1.2.0 24
   
route-policy 10 permit node 10
  if-match ip-prefix 10
  apply origin incomplete
route-policy 10 permit node 20
  if-match ip-prefix 20
  apply origin incomplete
route-policy 10 permit node 1000
peer 13.1.1.1 route-policy 10 import

AR1

代码语言:javascript复制
[V200R003C00]
#
sysname AR1
#
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 12.1.1.1 255.255.255.0
#
interface GigabitEthernet0/0/1
ip address 13.1.1.1 255.255.255.0
#
interface GigabitEthernet0/0/2
#
interface NULL0
#
bgp 1
router-id 1.1.1.1
peer 12.1.1.2 as-number 2
peer 13.1.1.3 as-number 2
#
ipv4-family unicast
undo synchronization
network 20.1.1.0 255.255.255.0
network 20.1.2.0 255.255.255.0
network 192.168.1.0
peer 12.1.1.2 enable
peer 12.1.1.2 route-policy 2 import
peer 12.1.1.2 preferred-value 6000
peer 13.1.1.3 enable
peer 13.1.1.3 route-policy 1 import
#
route-policy 1 permit node 10
if-match ip-prefix 1
apply preferred-value 100
#
route-policy 1 permit node 20
if-match ip-prefix 50
apply as-path 1 1 additive
apply preferred-value 0
#
route-policy 1 permit node 30
if-match ip-prefix 60
apply preferred-value 0
#
route-policy 1 permit node 10000
#
route-policy 2 permit node 20
if-match ip-prefix 50
apply preferred-value 0
#
route-policy 2 permit node 30
if-match ip-prefix 60
apply as-path 1 1 additive
apply preferred-value 0
#
route-policy 2 permit node 1000
#
ip ip-prefix 1 index 10 permit 10.1.1.0 24
ip ip-prefix 50 index 10 permit 10.1.5.0 24
ip ip-prefix 60 index 10 permit 10.1.6.0 24
ip ip-prefix 20 index 10 permit 20.1.1.0 24
#
ip route-static 20.1.1.0 255.255.255.0 NULL0
ip route-static 20.1.2.0 255.255.255.0 NULL0
ip route-static 192.168.1.0 255.255.255.0 NULL0
#
user-interface con 0
authentication-mode password
user-interface vty 0 4
user-interface vty 16 20
#
wlan ac
#
return

AR2

代码语言:javascript复制
[V200R003C00]
#
 sysname AR2
#
 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 12.1.1.2 255.255.255.0 
#
interface GigabitEthernet0/0/1
 ip address 24.1.1.2 255.255.255.0 
#
interface GigabitEthernet0/0/2
 ip address 23.1.1.2 255.255.255.0 
#
interface NULL0
#
interface LoopBack0
 ip address 2.2.2.2 255.255.255.255 
 ospf cost 10
#
bgp 2
 router-id 2.2.2.2
 peer 4.4.4.4 as-number 2 
 peer 4.4.4.4 connect-interface LoopBack0
 peer 12.1.1.1 as-number 1 
 #
 ipv4-family unicast
  undo synchronization
  peer 4.4.4.4 enable
  peer 4.4.4.4 route-policy 5 export
  peer 4.4.4.4 next-hop-local 
  peer 12.1.1.1 enable
#
ospf 1 router-id 2.2.2.2 
 area 0.0.0.0 
  network 2.2.2.2 0.0.0.0 
  network 23.1.1.0 0.0.0.255 
  network 24.1.1.0 0.0.0.255 
#
route-policy 5 permit node 10 
 if-match ip-prefix 5 
 apply local-preference 50 
#
route-policy 5 permit node 1000 
#
ip ip-prefix 5 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

AR3

代码语言:javascript复制
[V200R003C00]
#
 sysname AR3
#
 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 13.1.1.3 255.255.255.0 
#
interface GigabitEthernet0/0/1
 ip address 34.1.1.3 255.255.255.0 
#
interface GigabitEthernet0/0/2
 ip address 23.1.1.3 255.255.255.0 
#
interface NULL0
#
interface LoopBack0
 ip address 3.3.3.3 255.255.255.0 
#
bgp 2
 router-id 3.3.3.3
 peer 4.4.4.4 as-number 2 
 peer 4.4.4.4 connect-interface LoopBack0
 peer 13.1.1.1 as-number 1 
 #
 ipv4-family unicast
  undo synchronization
  peer 4.4.4.4 enable
  peer 4.4.4.4 next-hop-local 
  peer 13.1.1.1 enable
  peer 13.1.1.1 route-policy 10 import
#
ospf 1 router-id 3.3.3.3 
 area 0.0.0.0 
  network 3.3.3.0 0.0.0.255 
  network 23.1.1.0 0.0.0.255 
  network 34.1.1.0 0.0.0.255 
#
route-policy 5 permit node 1000 
#
route-policy 10 permit node 10 
 if-match ip-prefix 10 
 apply origin incomplete
#
route-policy 10 permit node 20 
 if-match ip-prefix 20 
 apply origin incomplete
#
route-policy 10 permit node 1000 
#
ip ip-prefix 10 index 10 permit 20.1.1.0 24
ip ip-prefix 20 index 10 permit 20.1.2.0 24
#
user-interface con 0
 authentication-mode password
user-interface vty 0 4
user-interface vty 16 20
#
wlan ac
#
return

AR4

代码语言:javascript复制
[V200R003C00]
#
 sysname AR4
#
 board add 0/4 4GET 
#
 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 24.1.1.4 255.255.255.0 
#
interface GigabitEthernet0/0/1
 ip address 34.1.1.4 255.255.255.0 
#
interface GigabitEthernet0/0/2
 ip address 45.1.1.4 255.255.255.0 
#
interface GigabitEthernet4/0/0
 ip address 46.1.1.4 255.255.255.0 
#
interface GigabitEthernet4/0/1
#
interface GigabitEthernet4/0/2
#
interface GigabitEthernet4/0/3
#
interface NULL0
#
interface LoopBack0
 ip address 4.4.4.4 255.255.255.255 
#
bgp 2
 router-id 4.4.4.4
 peer 2.2.2.2 as-number 2 
 peer 2.2.2.2 connect-interface LoopBack0
 peer 3.3.3.3 as-number 2 
 peer 3.3.3.3 connect-interface LoopBack0
 peer 45.1.1.5 as-number 3 
 peer 46.1.1.6 as-number 3 
 #
 ipv4-family unicast
  undo synchronization
  network 10.1.1.0 255.255.255.0 
  peer 2.2.2.2 enable
  peer 2.2.2.2 reflect-client
  peer 2.2.2.2 next-hop-local 
  peer 3.3.3.3 enable
  peer 3.3.3.3 route-policy 5 import
  peer 3.3.3.3 reflect-client
  peer 3.3.3.3 next-hop-local 
  peer 45.1.1.5 enable
  peer 45.1.1.5 route-policy 2 import
  peer 46.1.1.6 enable
#
ospf 1 router-id 4.4.4.4 
 area 0.0.0.0 
  network 4.4.4.4 0.0.0.0 
  network 24.1.1.0 0.0.0.255 
  network 34.1.1.0 0.0.0.255 
#
route-policy 5 permit node 10 
 if-match ip-prefix 5 
 apply local-preference 80 
#
route-policy 2 permit node 10 
 if-match ip-prefix 2 
 apply cost 50 
#
route-policy 2 permit node 1000 
#
ip ip-prefix 5 index 10 permit 192.168.1.0 24
ip ip-prefix 2 index 10 permit 10.1.5.0 24
#
ip route-static 10.1.1.0 255.255.255.0 NULL0
#
user-interface con 0
 authentication-mode password
user-interface vty 0 4
user-interface vty 16 20
#
wlan ac
#
return

AR5

代码语言:javascript复制
[V200R003C00]
#
 sysname AR5
#
 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 45.1.1.5 255.255.255.0 
#
interface GigabitEthernet0/0/1
 ip address 56.1.1.5 255.255.255.0 
#
interface GigabitEthernet0/0/2
#
interface NULL0
#
interface LoopBack0
 ip address 5.5.5.5 255.255.255.255 
#
bgp 3
 router-id 5.5.5.5
 peer 6.6.6.6 as-number 3 
 peer 6.6.6.6 connect-interface LoopBack0
 peer 45.1.1.4 as-number 2 
 #
 ipv4-family unicast
  undo synchronization
  network 10.1.5.0 255.255.255.0 
  peer 6.6.6.6 enable
  peer 6.6.6.6 next-hop-local 
  peer 45.1.1.4 enable
#
ospf 1 router-id 5.5.5.5 
 area 0.0.0.0 
  network 5.5.5.5 0.0.0.0 
  network 56.1.1.0 0.0.0.255 
#
ip route-static 10.1.5.0 255.255.255.0 NULL0
#
user-interface con 0
 authentication-mode password
user-interface vty 0 4
user-interface vty 16 20
#
wlan ac
#
return

AR6

代码语言:javascript复制
[V200R003C00]
#
 sysname AR6
#
 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 46.1.1.6 255.255.255.0 
#
interface GigabitEthernet0/0/1
 ip address 56.1.1.6 255.255.255.0 
#
interface GigabitEthernet0/0/2
#
interface NULL0
#
interface LoopBack0
 ip address 6.6.6.6 255.255.255.255 
#
bgp 3
 router-id 6.6.6.6
 peer 5.5.5.5 as-number 3 
 peer 5.5.5.5 connect-interface LoopBack0
 peer 46.1.1.4 as-number 2 
 #
 ipv4-family unicast
  undo synchronization
  network 10.1.6.0 255.255.255.0 
  peer 5.5.5.5 enable
  peer 5.5.5.5 next-hop-local 
  peer 46.1.1.4 enable
  peer 46.1.1.4 route-policy 2 export
#
ospf 1 router-id 6.6.6.6 
 area 0.0.0.0 
  network 6.6.6.6 0.0.0.0 
  network 56.1.1.0 0.0.0.255 
#
route-policy 2 permit node 10 
 if-match ip-prefix 2 
 apply cost 50 
#
route-policy 2 permit node 1000 
#
ip ip-prefix 2 index 10 permit 10.1.6.0 24
#
ip route-static 10.1.6.0 255.255.255.0 NULL0
#
user-interface con 0
 authentication-mode password
user-interface vty 0 4
user-interface vty 16 20
#
wlan ac
#
return

1 人点赞