BGP/Examples/Example 2:Two routers with two peers

From ImageStream Router Documentation

< BGP | Examples(Difference between revisions)
Jump to: navigation, search
(BGP configuration)
 
(19 intermediate revisions not shown)
Line 1: Line 1:
-
This is meant to be an example, and not a complete BGP (Border Gateway Protocol) routing configuration.  
+
:This is meant to be an example, and ''not'' a complete BGP (Border Gateway Protocol) routing configuration.
 +
===Scenario===
 +
:You have two connections to the internet. One connection through ISP 1, one connection through ISP 2. Each ISP has a router connected to it. Each router has two ethernet ports, Ethernet port 0 is connected to the other router, while ethernet port 1 is connected to your LAN. You want to advertise your network of 192.168.42.0/24 to both ISPs. Furthermore, you want to ensure that traffic always has a path in and out of your network.
 +
===Network Diagram===
 +
+-------------------------+            +----------------------+
 +
|                        |            |                      |
 +
| ISP 1                  |            | ISP 2                |
 +
| AS  932                |            | AS  8855            |
 +
|                        |            |                      |
 +
+-------------------------+            +----------------------+
 +
    | 12.23.4.1/30                          | 120.2.4.1/30
 +
    |                                      |   
 +
    | EBGP                                  | EBGP
 +
    |                                      |   
 +
---------------------------------------------------------
 +
    |                AS 9009              |
 +
    | 12.23.4.2/30                          | 120.2.4.2/30
 +
+----------------+                      +---------------+
 +
| Router 1      | 192.168.40.1/30      | Router 2      |
 +
|                |-----------------------|              |
 +
+----------------+        192.168.40.2/30+---------------+
 +
            | 192.168.42.2/24              | 192.168.42.3/24
 +
            |                              |
 +
            |                              |
 +
            ---------[  LAN Switch  ]--------
 +
 +
:Ensure that all routers running BGP have at least 512MB of memory. Remember to save your configurations to flash whenever you are finished configuring your dynamic routing setup!
 +
 +
===Configuration===
 +
:There is more to this configuration than only BGP. First, the routers connect together via Ethernet0. Static routes must be assigned to each router so that either router knows to find its other half.
 +
====Router 1====
 +
=====wan.conf=====
 +
!
 +
interface Serial0
 +
  ip address 12.23.4.2 255.255.255.252
 +
!
 +
interface Ethernet0
 +
  ip address 192.168.40.1 255.255.255.252
 +
!
 +
interface Ethernet1
 +
  ip address 192.168.42.2 255.255.255.0
 +
!
 +
ip route add default via 12.23.4.1
 +
 +
=====BGP configuration=====
 +
!
 +
router bgp 9009
 +
  bgp router-id 12.23.4.2
 +
  bgp log-neighbor-changes
 +
  network 192.168.42.0/24
   
   
-
Router Diagram
+
  # Begin configuration for ISP 1
-
---------------------------        ------------------------
+
  neighbor 12.23.4.1 remote-as 932
-
|        +------------+  |        |  +------------+      |
+
  neighbor 12.23.4.1 soft-reconfiguration inbound
-
|  AS    |Router 1    |  |        |  |Router 2    | AS   |
+
   neighbor 12.23.4.1 description ISP 1
-
| 9966    |172.16.96.76|  |        |  |10.200.10.3 | 8855 |
+
  neighbor 12.23.4.1 route-map rm_peer_1_in in
-
|        +------------+  |        |  +------------+      |
+
  neighbor 12.23.4.1 route-map rm_peer_1_out out
-
|                  /      |        |      |              |
+
   
-
---------------------------        ------------------------
+
  # Begin configuration for Router 2
-
                /                        |
+
  neighbor 192.168.40.2 remote-as 9009
-
          EBGP /        |----------------|     
+
  neighbor 192.168.40.2 soft-reconfiguration inbound
-
              /        |      EBGP     
+
  neighbor 192.168.40.2 description Router 2
-
---------------------------------------------------------
+
  neighbor 192.168.40.2 next-hop-self
-
              / AS 9009 |   
+
!
-
+------------+ ----------|
+
  ip prefix-list pl_peer_1_out seq 5 permit 192.168.42.0/24
-
|Main Router |
+
  !
-
|192.168.10.5|
+
  route-map rm_peer_1_out permit 5
-
+------------+
+
  match ip address prefix-list pl_peer_1_out
-
      |                               
+
  !
-
      | IBGP           
+
  route-map rm_peer_1_in permit 5
-
      |               
+
  set local-preference 100
-
+------------+                     
+
!
-
|2nd  Router |
+
-
|192.168.10.6|-----------|         
+
-
+------------+          |
+
-
    \            AS 9009 |   
+
-
---------------------------------------------------------
+
-
      \                  |    EBGP
+
-
      \ EBGP            |----------------|
+
-
        \                                |
+
-
        \                                |
+
-
---------------------------        --------------------------
+
-
|          \              |        |                        |
+
-
|        +------------+  |        | +-------------+      |
+
-
|  AS    |Router 5   |  |        |  |Router 6    | AS    |
+
-
| 35000  |2.1.1.1    | |        | |191.255.40.5 | 40000 |
+
-
|        +------------+ |        | +-------------+      |
+
-
---------------------------        --------------------------
+
-
  Ensure that all routers running BGP have at least 192 MB of memory. Remember to save your configurations to flash whenever you are finished configuring your dynamic routing setup! To enable BGP, do the following:
+
====Router 2====
-
At the Login: prompt, enter root.  
+
=====wan.conf=====
-
At the Password: prompt, enter your password.  
+
  !
-
Choose Option 1 (Configuration and Update Menu) from the Main Menu. Select Option 3 (Service Configuration).  
+
interface Serial0
-
From the Service Configuration menu, you can see the status of the Dynamic routing (gated) package. If gated is running, the option will show "(running)".  
+
  ip address 120.2.4.2 255.255.255.252
-
To start gated, choose Option 3 (Dynamic routing) and choose Option 5 (Start gated) from the Dynamic routing menu. You will also want to select Option 3 (Enable gated on boot) to ensure that BGP session will be established at boottime. Ensure that you have configured gated prior to attempting to start it. Unless it is properly configured, gated will not start.  
+
!
-
  In our example above, we will be configuring the "Main Router". From the Dynamic routing menu, choose Option 1 (gated configuration). Our AS for this example will be 9009. Choose Option 4 (Configure BGP) from the menu. This will open a file in your default editor.  
+
interface Ethernet0
-
Edit the "autonomoussystem" parameter. In this case, our AS number is 9009:
+
  ip address 192.168.40.2 255.255.255.252
-
Edit the first "External peeras" section
+
!
-
Add additional sections for each external and internal peer
+
interface Ethernet1
-
  The completed file for our example should look like this:
+
  ip address 192.168.42.3 255.255.255.0
 +
!
 +
ip route add default via 120.2.4.1
 +
 
 +
=====BGP configuration=====
 +
!
 +
router bgp 9009
 +
  bgp router-id 120.2.4.2
 +
  bgp log-neighbor-changes
 +
  network 192.168.42.0/24
 +
 +
  # Begin configuration for ISP 2
 +
  neighbor 120.2.4.1 remote-as 8855
 +
  neighbor 120.2.4.1 soft-reconfiguration inbound
 +
  neighbor 120.2.4.1 description ISP 2
 +
  neighbor 120.2.4.1 route-map rm_peer_1_in in
 +
  neighbor 120.2.4.1 route-map rm_peer_1_out out
 +
   
 +
  # Begin configuration for Router 2
 +
  neighbor 192.168.40.1 remote-as 9009
 +
  neighbor 192.168.40.1 soft-reconfiguration inbound
 +
  neighbor 192.168.40.1 description Router 1
 +
  neighbor 192.168.40.1 next-hop-self
 +
!
 +
  ip prefix-list pl_peer_1_out seq 5 permit 192.168.42.0/24
 +
!
 +
route-map rm_peer_1_out permit 5
 +
  match ip address prefix-list pl_peer_1_out
 +
!
 +
route-map rm_peer_1_in permit 5
 +
  set local-preference 100
 +
!

Latest revision as of 14:58, 11 September 2015

This is meant to be an example, and not a complete BGP (Border Gateway Protocol) routing configuration.

Contents

Scenario

You have two connections to the internet. One connection through ISP 1, one connection through ISP 2. Each ISP has a router connected to it. Each router has two ethernet ports, Ethernet port 0 is connected to the other router, while ethernet port 1 is connected to your LAN. You want to advertise your network of 192.168.42.0/24 to both ISPs. Furthermore, you want to ensure that traffic always has a path in and out of your network.

Network Diagram

+-------------------------+            +----------------------+
|                         |            |                      |
| ISP 1                   |            | ISP 2                | 
| AS  932                 |            | AS  8855             |
|                         |            |                      |
+-------------------------+            +----------------------+
   | 12.23.4.1/30                          | 120.2.4.1/30
   |                                       |    
   | EBGP                                  | EBGP
   |                                       |     
---------------------------------------------------------
   |                 AS 9009               |
   | 12.23.4.2/30                          | 120.2.4.2/30
+----------------+                       +---------------+
| Router 1       | 192.168.40.1/30       | Router 2      |
|                |-----------------------|               |
+----------------+        192.168.40.2/30+---------------+
           | 192.168.42.2/24               | 192.168.42.3/24
           |                               |
           |                               |
           ---------[  LAN Switch  ]--------
Ensure that all routers running BGP have at least 512MB of memory. Remember to save your configurations to flash whenever you are finished configuring your dynamic routing setup!

Configuration

There is more to this configuration than only BGP. First, the routers connect together via Ethernet0. Static routes must be assigned to each router so that either router knows to find its other half.

Router 1

wan.conf
!
interface Serial0
 ip address 12.23.4.2 255.255.255.252
!
interface Ethernet0
 ip address 192.168.40.1 255.255.255.252
!
interface Ethernet1
 ip address 192.168.42.2 255.255.255.0
!
ip route add default via 12.23.4.1
BGP configuration
!
router bgp 9009
 bgp router-id 12.23.4.2
 bgp log-neighbor-changes
 network 192.168.42.0/24

 # Begin configuration for ISP 1
 neighbor 12.23.4.1 remote-as 932
 neighbor 12.23.4.1 soft-reconfiguration inbound
 neighbor 12.23.4.1 description ISP 1
 neighbor 12.23.4.1 route-map rm_peer_1_in in
 neighbor 12.23.4.1 route-map rm_peer_1_out out

 # Begin configuration for Router 2
 neighbor 192.168.40.2 remote-as 9009
 neighbor 192.168.40.2 soft-reconfiguration inbound
 neighbor 192.168.40.2 description Router 2
 neighbor 192.168.40.2 next-hop-self
!
ip prefix-list pl_peer_1_out seq 5 permit 192.168.42.0/24
!
route-map rm_peer_1_out permit 5
 match ip address prefix-list pl_peer_1_out
!
route-map rm_peer_1_in permit 5
 set local-preference 100
!

Router 2

wan.conf
!
interface Serial0
 ip address 120.2.4.2 255.255.255.252
!
interface Ethernet0
 ip address 192.168.40.2 255.255.255.252
!
interface Ethernet1
 ip address 192.168.42.3 255.255.255.0
!
ip route add default via 120.2.4.1
BGP configuration
!
router bgp 9009
 bgp router-id 120.2.4.2
 bgp log-neighbor-changes
 network 192.168.42.0/24

 # Begin configuration for ISP 2
 neighbor 120.2.4.1 remote-as 8855
 neighbor 120.2.4.1 soft-reconfiguration inbound
 neighbor 120.2.4.1 description ISP 2
 neighbor 120.2.4.1 route-map rm_peer_1_in in
 neighbor 120.2.4.1 route-map rm_peer_1_out out

 # Begin configuration for Router 2
 neighbor 192.168.40.1 remote-as 9009
 neighbor 192.168.40.1 soft-reconfiguration inbound
 neighbor 192.168.40.1 description Router 1
 neighbor 192.168.40.1 next-hop-self
!
ip prefix-list pl_peer_1_out seq 5 permit 192.168.42.0/24
!
route-map rm_peer_1_out permit 5
 match ip address prefix-list pl_peer_1_out
!
route-map rm_peer_1_in permit 5
 set local-preference 100
!
Personal tools
Router software releases