Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Table of Contents

Network Requirement

As shown in Figure. 1, BGP runs on all the switches.

An EBGP connection is established between Switch A and Switch B, and IBGP fullmesh connections are established between Switch B, Switch C, Configure load balancing on Switch A. 

Configure EBGP connections between Switch B and Switch A and between Switch B and Switch D. 

Configure IBGP EBGP connections between Switch B, Switch C , and Switch D.Configure an EBGP connection A and between Switch A C and Switch BD.

 Figure 1. BGP configurationBGP Load Balancing

Image Added

Procedure

This section describes the steps of how to configure basic BGP functions on SwitchA, SwitchB, SwitchC and SwitchD.

Switch A

Step1         Configure the VLANs and VLAN interfaces.

Code Block
admin@SwitchA# set vlans vlan-id 1030 l3-interface 10vlan30
admin@SwitchA# set vlans vlan-id 2040 l3-interface 20vlan40
admin@SwitchA# set interface gigabit-ethernet te-1/1/1 family ethernet-switching native-vlan-id 1030
admin@SwitchA# set interface gigabit-ethernet te-1/1/2 family ethernet-switching native-vlan-id 2040
admin@SwitchA# set vlanl3-interface vlan-interface 10vlan30 vif 10 address 192.168.1030.1 prefix-length 24
admin@SwitchA# set vlanl3-interface vlan-interface 20 vif 20vlan40 address 192.168.2040.1 prefix-length 24

Step2        Configure an EBGP connection.

Code Block
admin@SwitchA# set protocols bgp bgprouter-id 1.1.1.1
admin@SwitchA# set protocols bgp local-as 100
admin@SwitchA# set protocols bgp peerneighbor 192.168.2030.2 remote-as 200
admin@SwitchA# set protocols bgp peerneighbor 192.168.2040.2 localremote-ip 192.168.20.1
as 300

Step3        Enable IP routing.

Code Block
admin@SwitchA# set protocolsip bgprouting peer 192.168.20.2 next-hop-self true

...

enable true

Step4         Commit the configurations.

...

Code Block
admin@SwitchB# set vlans vlan-id 20 l3-interface 20vlan20
admin@SwitchB# set vlans vlan-id 30 l3-interface 30
admin@SwitchB# set vlans vlan-id 40 l3-interface 40vlan30
admin@SwitchB# set interface gigabit-ethernet gete-1/1/21 family ethernet-switching native-vlan-id 2030
admin@SwitchB# set interface gigabit-ethernet gete-1/1/32 family ethernet-switching native-vlan-id 3020
admin@SwitchB# set l3-interface gigabitvlan-ethernet ge-1/1/4 family ethernet-switching native-vlan-id 40
admin@SwitchB# set vlan-interface interface 20 vif 20 interface vlan20 address 192.168.20.2 prefix-length 24
admin@SwitchB# set vlanl3-interface vlan-interface 30 vif 30vlan30 address 192.168.30.12 prefix-length 24

Step2        Configure EBGP connections.

Code Block
admin@SwitchB# set vlan-interface interface 40 vif 40 address 192.168.40.1 prefix-length 24

Step2        Configure EBGP and IBGP connections.

Code Block
admin@SwitchB# set protocols bgp bgpprotocols bgp router-id 2.2.2.2
admin@SwitchB# set protocols bgp local-as 200
admin@SwitchB# set protocols bgp peerneighbor 192.168.2030.1 remote-as 100
admin@SwitchB# set protocols bgp peerneighbor 192.168.20.1 localremote-ip 192.168.20.2
as 400

Step3        Enable IP routing.

Code Block
admin@SwitchB# set protocolsip bgprouting peer 192.168.20.1 next-hop-self true
admin@SwitchB# set protocols bgp peer 192.168.30.2 as 200
admin@SwitchB# set protocols bgp peer 192.168.30.2 local-ip 192.168.30.1
admin@SwitchB# set protocols bgp peer 192.168.30.2 next-hop-self true
admin@SwitchB# set protocols bgp peerenable true

Step4         Commit the configurations.

Code Block
admin@SwitchB# commit

Switch C

Step1         Configure the VLANs and VLAN interfaces.

Code Block
admin@SwitchC# set vlans vlan-id 40 l3-interface 40
admin@SwitchC# set vlans vlan-id 50 l3-interface 50
admin@SwitchC# set interface gigabit-ethernet te-1/1/2 family ethernet-switching native-vlan-id 40
admin@SwitchC# set interface gigabit-ethernet te-1/1/3 family ethernet-switching native-vlan-id 50
admin@SwitchC# set l3-interface vlan-interface vlan40 address 192.168.40.2 asprefix-length 20024
admin@SwitchB#admin@SwitchC# set protocols bgp peer l3-interface vlan-interface vlan50 address 192.168.4050.2 localprefix-ip 192.168.40.1
admin@SwitchB#length 24

Step2        Configure the EBGP connection.

Code Block
admin@SwitchC# set protocols bgp peerrouter-id 1923.1683.40.2 next-hop-self true

Step3         Commit the configurations.

Code Block
admin@SwitchB# commit

Switch C

Step1         Configure the VLANs and VLAN interfaces.

Code Block
3.3
admin@SwitchC# set vlansprotocols vlan-id 40 l3-interface 40bgp local-as 300
admin@SwitchC# set protocols vlansbgp vlan-id 50 l3-interface 50neighbor 192.168.40.1 remote-as 100
admin@SwitchC# set protocols interfacebgp gigabit-ethernet ge-1/1/4 family ethernet-switching native-vlan-id 40
admin@SwitchC# set interface gigabit-ethernet ge-1/1/5 family ethernet-switching native-vlan-id 50
admin@SwitchC# set vlan-interface interface 40 vif 40 address 192.168.40.2 prefix-length 24
admin@SwitchC# set vlan-interface interface 50 vif 50 address 192.168.50.2 prefix-length 24

Step2        Configure the IBGP connection.

Code Block
admin@SwitchC# set protocols bgp bgp-id 3.3.3.3
admin@SwitchC# set protocols bgp local-as 200
admin@SwitchC# set protocols bgp peer 192.168.40.1 as 200
admin@SwitchC# set protocols bgp peer 192.168.40.1 local-ip 192.168.40.2
admin@SwitchC# set protocols bgp peer 192.168.40.1 next-hop-self true
admin@SwitchC# set protocols bgp peerneighbor 192.168.50.1 remote-as 400

Step3        Enable IP routing.

Code Block
admin@SwitchC# set ip routing enable true

Step4         Commit the configurations.

Code Block
admin@SwitchC# commit

Switch D

Step1         Configure the VLANs and VLAN interfaces.

Code Block
admin@SwitchD# set vlans vlan-id 10 l3-interface vlan10
admin@SwitchD# set vlans vlan-id 20 l3-interface vlan20
admin@SwitchD# set vlans vlan-id 50 l3-interface vlan50
admin@SwitchD# set interface gigabit-ethernet te-1/1/1 family ethernet-switching native-vlan-id 10
admin@SwitchD# set interface gigabit-ethernet te-1/1/2 family ethernet-switching native-vlan-id 20
admin@SwitchD# set interface gigabit-ethernet te-1/1/3 family ethernet-switching native-vlan-id 50
admin@SwitchD# set l3-interface vlan-interface vlan10 address 192.168.10.1 prefix-length 24
admin@SwitchD# set l3-interface vlan-interface vlan20 address 192.168.20.1 prefix-length 24
admin@SwitchD# set l3-interface vlan-interface vlan50 address 192.168.50.1 as 200
admin@SwitchC#prefix-length 24

Step2        Configure the EBGP connection.

Code Block
admin@SwitchD# set protocols bgp peerrouter-id 1924.1684.50.14.4
admin@SwitchD# set protocols bgp local-ipas 400
admin@SwitchD# set protocols bgp neighbor 192.168.5020.2
admin@SwitchC# remote-as 200
admin@SwitchD# set protocols bgp peerneighbor 192.168.50.12 next-hop-selfremote-as 300

Step3        Enable IP routing.

Code Block
admin@SwitchC# set ip routing enable true

Step3  Step4         Commit the configurations.

Code Block
admin@SwitchC#admin@SwitchD# commit

Switch D

...

Viewing BGP Peer Status on Switch B and Switch C

Code Block
admin@SwitchD#admin@SwitchB# setrun vlansshow vlan-id 30 l3-interface 30
admin@SwitchD# set vlans vlan-id 50 l3-interface 50
admin@SwitchD# set interface gigabit-ethernet ge-1/1/3 family ethernet-switching native-vlan-id 30
admin@SwitchD# set interface gigabit-ethernet ge-1/1/5 family ethernet-switching native-vlan-id 50
admin@SwitchD# set vlan-interface interface 30 vif 40 address 192.168.30.2 prefix-length 24
admin@SwitchD# set vlan-interface interface 50 vif 50 address 192.168.50.1 prefix-length 24

Step2        Configure the IBGP connection.

Code Block
admin@SwitchD# set protocols bgp bgp-id 4.4.4.4
admin@SwitchD# set protocols bgp local-as 200
admin@SwitchD# set protocols bgp peer 192.168.30.1 as 200
admin@SwitchD# set protocols bgp peer 192.168.30.1 local-ip 192.168.30.2
admin@SwitchD# set protocols bgp peer 192.168.30.1 next-hop-self true
admin@SwitchD# set protocols bgp peer 192.168.50.2 as 200
admin@SwitchD# set protocols bgp peer 192.168.50.2 local-ip 192.168.50.1
admin@SwitchD# set protocols bgp peer 192.168.50.2 next-hop-self true

Step3         Commit the configurations.

Code Block
admin@SwitchD# commit

Viewing BGP Peer Status on Switch B

Code Block
admin@SwitchB# run show bgp peers detail 
Peer 2: local 192.168.20.2/179 remote 192.168.20.1/179
Peer ID: 1.1.1.1
Peer State: ESTABLISHED
Admin State: START
Negotiated BGP Version: 4
Peer AS Number: 100
Updates Received: 20, Updates Sent: 2
Messages Received: 634, Messages Sent: 611
Time since last received update: 1685 seconds
Number of transitions to ESTABLISHED: 1
Time since last entering ESTABLISHED state: 15995 seconds
Retry Interval: 120 seconds
Hold Time: 90 seconds, Keep Alive Time: 30 seconds
Configured Hold Time: 90 seconds, Configured Keep Alive Time: 30 seconds
Minimum AS Origination Interval: 0 seconds
Minimum Route Advertisement Interval: 0 seconds
Peer 2: local 192.168.30.1/179 remote 192.168.30.2/179
Peer ID: 4.4.4.4
Peer State: ESTABLISHED
Admin State: START
Negotiated BGP Version: 4
Peer AS Number: 100
Updates Received: 20, Updates Sent: 2
Messages Received: 634, Messages Sent: 611
Time since last received update: 1685 seconds
Number of transitions to ESTABLISHED: 1
Time since last entering ESTABLISHED state: 15995 seconds
Retry Interval: 120 seconds
Hold Time: 90 seconds, Keep Alive Time: 30 seconds
Configured Hold Time: 90 seconds, Configured Keep Alive Time: 30 seconds
Minimum AS Origination Interval: 0 seconds
Minimum Route Advertisement Interval: 0 seconds
Peer 3: local 192.168.40.1/179 remote 192.168.40.2/179
Peer ID: 3.3.3.3
Peer State: ESTABLISHED
Admin State: START
Negotiated BGP Version: 4
Peer AS Number: 100
Updates Received: 20, Updates Sent: 2
Messages Received: 634, Messages Sent: 611
Time since last received update: 1685 seconds
Number of transitions to ESTABLISHED: 1
Time since last entering ESTABLISHED state: 15995 seconds
Retry Interval: 120 seconds
Hold Time: 90 seconds, Keep Alive Time: 30 seconds
Configured Hold Time: 90 seconds, Configured Keep Alive Time: 30 seconds
Minimum AS Origination Interval: 0 seconds
Minimum Route Advertisement Interval: 0 seconds

Configuring Switch A to Advertise Route 192.168.10.0/24

Code Block
admin@SwitchA# set policy policy-statement direct-to-bgp term t1 from protocol connected 
admin@SwitchA# set policy policy-statement direct-to-bgp term t1 from network4 192.168.10.0/24
admin@SwitchA# set policy policy-statement direct-to-bgp term t1 then accept 
admin@SwitchA# set protocols bgp export direct-to-bgp
admin@SwitchA# commit

...

Code Block
admin@SwitchD# run show bgp routes 
Status Codes: * valid route, > best route
Origin Codes: i IGP, e EGP, ? incomplete 
Prefix Nexthop Peer AS Path
------ ------- ---- -------
*> 192.168.10.0/24 192.168.20.1 1.1.1.1 100 ?
admin@SwitchD# 

...

Code Block
admin@SwitchD# run show bgp routes 
Status Codes: * valid route, > best route
Origin Codes: i IGP, e EGP, ? incomplete 
Prefix Nexthop Peer AS Path
------ ------- ---- -------
192.168.10.0/24 192.168.20.1 2.2.2.2 100 ?
admin@SwitchD# 

The preceding command output display that the route to destination 192.168.10.0/24 becomes invalid because the next hop address of this route is unreachable. 

Configuring Switch B to Advertise a Connected Route

Code Block
admin@SwitchB# set policy policy-statement direct-to-bgp term t1 from protocol connected 
admin@SwitchB# set policy policy-statement direct-to-bgp term t1 then accept 
admin@SwitchB# set protocols bgp export direct-to-bgp
admin@SwitchB# commit

Ping 192.168.10.1 on Switch C:

Code Block
admin@SwitchC# run ping 192.168.10.1
PING 192.168.10.1 (192.168.10.1) 56(84) bytes of data.
64 bytes from 192.168.10.1: icmp_req=1 ttl=63 time=4.68 ms
64 bytes from 192.168.10.1: icmp_req=2 ttl=63 time=4.46 ms
64 bytes from 192.168.10.1: icmp_req=3 ttl=63 time=5.35 ms
64 bytes from 192.168.10.1: icmp_req=4 ttl=63 time=4.52 ms
64 bytes from 192.168.10.1: icmp_req=5 ttl=63 time=4.51 ms 
192.168.10.1 ping statistics —
5 packets transmitted, 5 received, 0% packet loss, time 4017ms
rtt min/avg/max/mdev = 4.460/4.709/5.358/0.338 ms

View the BGP routing table of Switch C:

Code Block
admin@SwitchC# run show bgp routes 
Status Codes: * valid route, > best route
Origin Codes: i IGP, e EGP, ? incomplete 
Prefix Nexthop Peer AS Path
------ ------- ---- -------
192.168.10.0/24 192.168.20.1 2.2.2.2 100 ?
*> 192.168.20.0/24 192.168.40.1 2.2.2.2?
*>192.168.30.0/24 192.168.40.1 2.2.2.2?
bgp neighbor
BGP neighbor on vlan30: 192.168.30.1, remote AS 100, local AS 200, external link
  BGP version 4, remote router ID 1.1.1.1, local router ID 2.2.2.2
  BGP state = Idle
  Last read 00:15:06, Last write never
  Hold time is 180, keepalive interval is 60 seconds
  Graceful restart information:
    Local GR Mode: Helper*
    Remote GR Mode: NotApplicable
    R bit: False
    Timers:
      Configured Restart Time(sec): 120
      Received Restart Time(sec): 0
  Message statistics:
    Inq depth is 0
    Outq depth is 0
                         Sent       Rcvd
    Opens:                  0          0
    Notifications:          0          0
    Updates:                0          0
    Keepalives:             0          0
    Route Refresh:          0          0
    Capability:             0          0
    Total:                  0          0
  Minimum time between advertisement runs is 0 seconds
 
 For address family: IPv4 Unicast
  Not part of any update group
  Community attribute sent to this neighbor(all)
  0 accepted prefixes
 
  Connections established 0; dropped 0
  Last reset 00:15:06,  Waiting for Peer IPv6 LLA
BGP Connect Retry Timer in Seconds: 120
Read thread: off  Write thread: off  FD used: -1
 
BGP neighbor is 192.168.20.2, remote AS 400, local AS 200, internal link
 Administratively shut down
  BGP version 4, remote router ID 3.3.3.3, local router ID 2.2.2.2
  BGP state = Idle
  Last read 00:15:06, Last write never
  Hold time is 180, keepalive interval is 60 seconds
  Graceful restart information:
    Local GR Mode: Helper*
    Remote GR Mode: NotApplicable
    R bit: False
    Timers:
      Configured Restart Time(sec): 120
      Received Restart Time(sec): 0
  Message statistics:
    Inq depth is 0
    Outq depth is 0
                         Sent       Rcvd
    Opens:                  0          0
    Notifications:          0          0
    Updates:                0          0
    Keepalives:             0          0
    Route Refresh:          0          0
    Capability:             0          0
    Total:                  0          0
  Minimum time between advertisement runs is 600 seconds
 
 For address family: IPv4 Unicast
  Not part of any update group
  Advertise bestpath per AS via addpath
  Override ASNs in outbound updates if aspath equals remote-as
  Community attribute sent to this neighbor(all)
  0 accepted prefixes
 
  Connections established 0; dropped 0
  Last reset 00:15:06,  No AFI/SAFI activated for peer
  External BGP neighbor may be up to 255 hops away.
BGP Connect Retry Timer in Seconds: 111
Peer Authentication Enabled
Read thread: off  Write thread: off  FD used: -1
 
BGP neighbor is 192.168.40.2, remote AS 200, local AS 200, internal link
  BGP version 4, remote router ID 4.4.4.4, local router ID 2.2.2.2
  BGP state = Active
  Last read 00:15:06, Last write never
  Hold time is 180, keepalive interval is 60 seconds
  Graceful restart information:
    Local GR Mode: Helper*
    Remote GR Mode: NotApplicable
    R bit: False
    Timers:
      Configured Restart Time(sec): 120
      Received Restart Time(sec): 0
  Message statistics:
    Inq depth is 0
    Outq depth is 0
                         Sent       Rcvd
    Opens:                  0          0
    Notifications:          0          0
    Updates:                0          0
    Keepalives:             0          0
    Route Refresh:          0          0
    Capability:             0          0
    Total:                  0          0
  Minimum time between advertisement runs is 0 seconds
 
For address family: IPv4 Unicast
  Not part of any update group
  Advertise bestpath per AS via addpath
  Override ASNs in outbound updates if aspath equals remote-as
  Community attribute sent to this neighbor(all)
  0 accepted prefixes
 
  Connections established 0; dropped 0
  Last reset 00:15:06,  No AFI/SAFI activated for peer
  External BGP neighbor may be up to 255 hops away.
BGP Connect Retry Timer in Seconds: 111
Peer Authentication Enabled
Read thread: off  Write thread: off  FD used: -1

Configuring Switch D to Advertise Route 192.168.10.0/24

Code Block
admin@SwitchD# set protocols bgp ipv4-unicast network 192.168.10.0/24
admin@SwitchD# commit

Configure Switch A to Enable BGP Load Balancing

Because Switch A has two routes to reach AS 400, configuring load balancing over the two BGP routes on Switch A can improve link usage.

Code Block
admin@SwitchA# set protocols bgp ipv4-unicast multipath ibgp maximum-paths 2
admin@SwitchA# commit

 Then you can view the BGP routing table to 192.168.10.0/24 on Switch A, you can find that:

  • The route 192.168.10.0/24 has two next hops, 192.168.30.2 and 192.168.40.2, both of which are marked with a greater-than sign (>), indicating that they are the optimal routes.

  • By using the run show bgp route 192.168.10.0/24 command, you can find two routes to 192.168.10.0/24. One has next hop 192.168.30.2 and output interface VLAN interface vlan30, and the other has next hop 192.168.40.2 and output interface VLAN interface vlan40.