[Xorp-hackers] BGP questions

Ben Greear greearb at candelatech.com
Tue Apr 20 10:54:35 PDT 2010


On 04/20/2010 10:15 AM, Li Zhao wrote:
> The real simple one might be that using two routers to build bgp adjacency. And then redistribute some static routes. And then change interface state which the static route is using as next-hop to see if bgp stopped redistributing it.

I'm not sure things are working.  Should I expect to see more info about
the bgp peer (like state, for instance?)

And I assume at least subnet routes should be shown in 'show bgp routes' ?

My current config has two routers.  Outside interfaces are running OSPF
but not connected to other OSPF routers.  One pair of interfaces (rddVR8, rddVR9)
connects the two routers, and these interfaces are supposed to be running
BGP.  There are no obvious errors in the logs, and bgp connections appear
to be properly established:

[root at ct503-10G-09 lanforge]# netstat -an|grep 179
tcp        0      0 5.1.1.2:179                 0.0.0.0:*                   LISTEN
tcp        0      0 5.1.1.1:179                 0.0.0.0:*                   LISTEN
tcp        0      0 5.1.1.1:179                 5.1.1.2:18692               ESTABLISHED
tcp        0      0 5.1.1.2:18692               5.1.1.1:179                 ESTABLISHED



root at ct503-10G-09> show bgp peers
Peer 1: local 5.1.1.1/179 remote 5.1.1.2/179
root at ct503-10G-09> show bgp routes
Status Codes: * valid route, > best route
Origin Codes: i IGP, e EGP, ? incomplete

    Prefix                Nexthop                    Peer            AS Path
    ------                -------                    ----            -------
root at ct503-10G-09> show route table ipv4 unicast connected
2.2.2.0/24	[connected(0)/0]
		> via rddVR6/rddVR6
5.1.1.0/24	[connected(0)/0]
		> via rddVR8/rddVR8
8.1.2.0/24	[connected(0)/0]
		> via rddVR3/rddVR3
root at ct503-10G-09> show route table ipv4 unicast ebgp
root at ct503-10G-09> show route table ipv4 unicast ibgp
root at ct503-10G-09> show route table ipv4 unicast final
0.0.0.0/0	[static(220)/1]
		> to 0.0.0.0 via my_discard/my_discard
2.2.2.0/24	[connected(0)/0]
		> via rddVR6/rddVR6
5.1.1.0/24	[connected(0)/0]
		> via rddVR8/rddVR8
8.1.2.0/24	[connected(0)/0]
		> via rddVR3/rddVR3
root at ct503-10G-09>



Config file for this router is below.  The other router's config is similar (and farther below)
/* For Virtual-Router: Router-0 */

interfaces {
     interface my_discard {
         unreachable: true
         vif my_discard {
         }
     }

     interface "rddVR6" {
         vif "rddVR6" {
             address 2.2.2.1 {
                 prefix-length: 24
             }
         }
     }

     interface "rddVR8" {
         vif "rddVR8" {
             address 5.1.1.1 {
                 prefix-length: 24
             }
         }
     }

     interface "rddVR3" {
         vif "rddVR3" {
             address 8.1.2.1 {
                 prefix-length: 24
             }
         }
     }

}

fea {
     unicast-forwarding4 {
         disable: false
         table-id: 10001
     }
}

policy {
     policy-statement static-to-bgp {
         term export {
             from {
                 protocol: "static"
             }
             then {
                 metric: 0
             }
         }
     }

     policy-statement connected-to-bgp {
         term export {
             from {
                 protocol: "connected"
             }
             then {
                 metric: 0
             }
         }
     }
}

protocols {
     static {
         interface-route 0.0.0.0/0 {
             next-hop-interface: "my_discard"
             next-hop-vif: "my_discard"
         }
     }

     ospf4 {
         router-id: 127.1.0.1
         area 0.0.0.0 {
             interface "rddVR6" {
                 vif "rddVR6" {
                     address 2.2.2.1 {
                        interface-cost: 1
                     }
                 }
             }

             interface "rddVR3" {
                 vif "rddVR3" {
                     address 8.1.2.1 {
                        interface-cost: 1
                     }
                 }
             }

         } /* area */

         /* traceoptions {
             flag all {
                 disable: false
             }
         } */
     }
     bgp {
         bgp-id: 0.0.0.1
         local-as: 1
         peer 5.1.1.2 {
             local-ip: 5.1.1.1
             /* local-dev: "rddVR8" */
             as: 2
             next-hop: 5.1.1.2
             holdtime: 5
             delay-open-time: 5
             client: false
             confederation-member: false
             ipv4-unicast: false
             disable: false
         }
     } /* end of bgp4 proto */

}

  /* End of Config File */

Router-2 config:

/* For Virtual-Router: Router-1 */

interfaces {
     interface my_discard {
         unreachable: true
         vif my_discard {
         }
     }

     interface "rddVR0" {
         vif "rddVR0" {
             address 1.1.1.2 {
                 prefix-length: 24
             }
         }
     }

     interface "rddVR13" {
         vif "rddVR13" {
             address 4.1.1.2 {
                 prefix-length: 24
             }
         }
     }

     interface "rddVR9" {
         vif "rddVR9" {
             address 5.1.1.2 {
                 prefix-length: 24
             }
         }
     }

}

fea {
     unicast-forwarding4 {
         disable: false
         table-id: 10002
     }
}

policy {
     policy-statement static-to-bgp {
         term export {
             from {
                 protocol: "static"
             }
             then {
                 metric: 0
             }
         }
     }

     policy-statement connected-to-bgp {
         term export {
             from {
                 protocol: "connected"
             }
             then {
                 metric: 0
             }
         }
     }
}

protocols {
     static {
         interface-route 0.0.0.0/0 {
             next-hop-interface: "my_discard"
             next-hop-vif: "my_discard"
         }
     }

     ospf4 {
         router-id: 127.1.0.2
         area 0.0.0.0 {
             interface "rddVR0" {
                 vif "rddVR0" {
                     address 1.1.1.2 {
                        interface-cost: 1
                     }
                 }
             }

             interface "rddVR13" {
                 vif "rddVR13" {
                     address 4.1.1.2 {
                        interface-cost: 1
                     }
                 }
             }

         } /* area */

         /* traceoptions {
             flag all {
                 disable: false
             }
         } */
     }
     bgp {
         bgp-id: 0.0.0.2
         local-as: 2
         peer 5.1.1.1 {
             local-ip: 5.1.1.2
             /* local-dev: "rddVR9" */
             as: 1
             next-hop: 5.1.1.1
             holdtime: 5
             delay-open-time: 5
             client: false
             confederation-member: false
             ipv4-unicast: false
             disable: false
         }
     } /* end of bgp4 proto */

}

  /* End of Config File */



Thanks,
Ben

-- 
Ben Greear <greearb at candelatech.com>
Candela Technologies Inc  http://www.candelatech.com



More information about the Xorp-hackers mailing list