Configuration procedure
Procedure
- Configure IP addresses for interfaces (omitted.)
- Configure OSPF on Switch B, C, and D.
- # Configure Switch B.
switch(config)# router ospf switch(ospf)# area 0 switch(ospf)# network 192.1.1.0/ 0.0.0.255 switch(ospf)# network 194.1.1.0/ 0.0.0.255 switch(ospf)# exit
- # Configure Switch C.
switch(config)# router ospf switch(ospf)# enable switch(ospf)# area 0 switch(ospf)# network 193.1.1.0/ 0.0.0.255 switch(ospf)# network 195.1.1.0/ 0.0.0.255 switch(ospf)# exit
- # Configure Switch D.
switch(config)# router ospf switch(ospf)# enable switch(ospf)# area 0 switch(ospf)# network 194.1.1.0/ 0.0.0.255 switch(ospf)# network 195.1.1.0/ 0.0.0.255 switch(ospf)# exit
- Configure BGP connections.
- # Configure Switch A.
switch(config)# router bgp 100 switch(bgp)# neighbor 192.1.1.2 remote-as 200 switch(bgp)# neighbor 193.1.1.2 remote-as 200
- # Add network 1.0.0.0/8 to the BGP routing table
on Switch A.
switch(bgp)# network 1.0.0.0/8 switch(bgp)# exit
- # Configure Switch B.
switch(config)# router bgp 200 switch(bgp)# neighbor 192.1.1.1 remote-as 100 switch(bgp)# neighbor 194.1.1.1 remote-as 200 switch(bgp)# exit
- # Configure Switch C.
switch(config)# router bgp 200 switch(bgp)# neighbor 193.1.1.1 remote-as 100 switch(bgp)# neighbor 195.1.1.1 remote-as 200 switch(bgp)# exit
- # Configure Switch D.
switch(config)# router bgp 200 switch(bgp)# neighbor 194.1.1.2 remote-as 200 switch(bgp)# neighbor 195.1.1.2 remote-as 200 switch(bgp)# exit
- Configure attributes for route 1.0.0.0/8, making Switch D give priority to the route learned from Switch C.
- # Configure a higher MED value for the route 1.0.0.0/8 advertised from Switch A to peer 192.1.1.2.
- # Define a prefix-list to permit route 1.0.0.0/8.
switch(config)# ip prefix-list pl_1 permit 1.0.0.0/24
- # Define two routing policies, apply_med_50,
which sets the MED for route 1.0.0.0/8 to 50, and apply_med_100, which
sets the MED for route 1.0.0.0/8 to 100.
switch(config)# route-map apply_med_50 permit switch(route-map-apply_med_50)# match ip address prefix-list pl_1 switch(route policy)# set metric 50 switch(route policy)route-map apply_med_50 permit seq 20 switch(route policy)# exit switch(config)# route-map apply_med_100 permit switch(route policy)# match ip address prefix-list pl_1 switch(route policy)# set metric 100 switch(route policy)# route-map apply_med_100 permit seq 20 switch(route policy)# exit
- # Apply routing policy apply_med_50 to the route
advertised to peer 193.1.1.2 (Switch C), and apply_med_100 to the
route advertised to peer 192.1.1.2 (Switch B.)
switch(config)# bgp 100 switch(bgp)# neighbor 193.1.1.2 route-map apply_med_50 out switch(bgp)# neighbor 192.1.1.2 route-policy apply_med_100 out switch(bgp)# exit
- # Display the BGP routing table on Switch D.
switch(config)# show ip bgp Local AS : 100 Local Router-id : 194.1.1.1 BGP Table Version : 1 Status codes: * - valid, > - best, i - internal, e - external, s - stale Origin codes: i - IGP, e - EGP, ? - incomplete Network Nexthop Metric LocalPref Weight AsPath ------------------------------------------------------- *>e 1.0.0.0/24 194.1.1.2 50 0 100i *>e 1.0.0.0/24 195.1.1.2 100 0 100i
- You can ensure that route 1.0.0.0/8 is the optimal route. Configure different local preferences on Switch B and C for route 1.0.0.0/ 8, making Switch D give priority to the route from Switch C.
- # Define an ip prefix-list on Router C, permitting
route 1.0.0.0/8.
switch(config)# ip prefix-list pl_1 permit 1.0.0.0/8
- # Configure a routing policy named localpref on Switch C, setting the local
preference of route 1.0.0.0/8 to 200 (the default is 100.)
switch(config)# route-map localpref permit seq 10 switch(route-policy)# match ip address prefix-list pl_1 switch(route-policy)# set local-preference 200 switch(route-policy)# route-map localpref permit seq 20
- # Apply routing policy localpref to routes from peer 193.1.1.1.
switch(config)# router bgp 200 switch(bgp)# neighbor 193.1.1.1 route-map localpref in switch(bgp)# exit
- # Display the routing table on Switch D.
switch(config)# show ip bgp Local AS : 100 Local Router-id : 194.1.1.1 BGP Table Version : 1 Status codes: * - valid, > - best, i - internal, e - external, s - stale Origin codes: i - IGP, e - EGP, ? - incomplete Network Nexthop Metric LocalPref Weight AsPath ------------------------------------------------------- *>e 1.0.0.0/24 200.1.3.1 200 0 100i * i 1.0.0.0/24 100 0 100i
- You can see that route 1.0.0.0/8 from Switch D to Switch C is the optimal route.