BGP/Examples/Example 2:Two routers with two peers
From ImageStream Router Documentation
(→BGP configuration) |
(→BGP configuration) |
||
Line 113: | Line 113: | ||
! | ! | ||
route-map rm_peer_1_in permit 5 | route-map rm_peer_1_in permit 5 | ||
- | |||
- | |||
- | |||
set local-preference 100 | 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 !