OpenWRT: quagga bgp

From OnnoWiki
Jump to navigation Jump to search

sumber: https://martybugs.net/wireless/openwrt/quagga.cgi

edit /etc/quagga/zebra.conf:

 hostname jandakot
 ! define password for bgpd daemon (for connecting to daemon via telnet)
 password insertpasswordhere
 ! define enable password for bgpd daemon (for connecting to daemon via telnet)
 enable password insertpasswordhere
 !
 ! list interfaces
 interface eth1
 interface vlan0
 interface vlan1
 interface lo
 !
 ! null route to consolidate all subnets in this /24
 ip route 10.60.86.0/24 Null0 255
 !
 line vty

edit /etc/quagga/bgpd.conf:

 hostname jandakot
 ! define password for bgpd daemon (for connecting to daemon via telnet)
 password insertpasswordhere
 ! define enable password for bgpd daemon (for connecting to daemon via telnet)
 enable password insertpasswordhere
 !
 ! define router's BGP AS 
 router bgp 65086
 ! define ID of router - we use IP of the router
 bgp router-id 10.60.86.1
 ! define network address that this router knows about
 network 10.60.86.0/24
 !
 ! armadale neighbour 
 neighbor 10.60.74.253 remote-as 65074
 neighbor 10.60.74.253 soft-reconfiguration inbound
 neighbor 10.60.74.253 distribute-list freenet in
 neighbor 10.60.74.253 distribute-list freenet out
 !
 ! willetton neighbour 
 neighbor 10.60.84.253 remote-as 65084
 neighbor 10.60.84.253 soft-reconfiguration inbound
 neighbor 10.60.84.253 distribute-list freenet in
 neighbor 10.60.84.253 distribute-list freenet out
 !
 ! ACLs to stop people from propagating routes to their own private networks
 access-list freenet permit 10.48.0.0/12
 access-list freenet deny any
 !
 line vty
 exec-timeout 20160 0


edit /etc/init.d/S49quagga

 DAEMONS="zebra bgpd"

Debugging Quagga


 nc localhost 2605


 Hello, this is Quagga (version 0.98.4).
 Copyright 1996-2005 Kunihiro Ishiguro, et al.
 User Access Verification
 Password: insertpasswordhere
 jandakot>
 jandakot> show ip bgp summary
 BGP router identifier 10.60.86.1, local AS number 65086
 6 BGP AS-PATH entries
 0 BGP community entries
 Neighbor        V    AS MsgRcvd MsgSent   TblVer  InQ OutQ Up/Down  State/PfxRcd
 10.60.74.253    4 65074   10525   10232        0    0    0 6d21h24m        4
 10.60.84.253    4 65084   10013   10181        0    0    0 6d22h49m        2
 Total number of neighbors 2


This output provides details about how long each neighbour has been connected, and how many routes the WRT has received from each neighbour (in this example, 4 routes from the first neighbour, and 2 from the second).

The Up/Down status shows the time that that neighbour has been connected. If it shows anything other than a time, it means the bgpd daemon has not successfully connected to that neighbour, so check the bgpd configuration at both ends.

To view the BGP routing table, run the following commend in the bgpd telnet session:

 jandakot> show ip bgp


and you should get something similar to this output:

 BGP table version is 0, local router ID is 10.60.86.1
 Status codes: s suppressed, d damped, h history, * valid, > best, i - internal
 Origin codes: i - IGP, e - EGP, ? - incomplete
    Network          Next Hop            Metric LocPrf Weight Path
 *> 10.60.68.0/24    10.60.74.253                           0 65074 65068 i
 *> 10.60.74.0/24    10.60.74.253             0             0 65074 i
 *> 10.60.82.0/24    10.60.74.253                           0 65074 65082 i
 *> 10.60.84.0/24    10.60.84.253             0             0 65084 i
 *> 10.60.86.0/24    0.0.0.0                  0         32768 i
 *> 10.60.113.0/24   10.60.84.253                           0 65084 65113 i
 *> 10.64.0.0/12     10.60.74.253             0             0 65074 i
 Total number of prefixes 7


This view provides details of each route received via BGP, as well as the path to that route. For example, from the output above, we can see that the route to 10.60.82.0/24 (SouthArmadale) goes via AS65074 (the ArmadaleAP router) and AS65082 (the SouthArmadale router), and the next hop with respect to Jandakot is 10.60.74.253, which is the IP address at the ArmadaleAP end of the ArmadaleAP-Jandakot link.

To finish the telnet session, just type exit.

Telnet to Zebra Daemon To telnet to the zebra daemon, run:

 nc localhost 2601


and you'll be prompted for a password. You need to enter the first password that was defined in /etc/quagga/zebra.conf, and you'll then be rewarded with a prompt.

 root@JANDAKOT-AP:~# nc localhost 2601
 Hello, this is Quagga (version 0.98.4).
 Copyright 1996-2005 Kunihiro Ishiguro, et al.
 User Access Verification
 Password: insertpasswordhere
 jandakot>


To view the status of the routing table, run the following:

 jandakot> show ip route


and you should be rewarded with output similar to this:

 Codes: K - kernel route, C - connected, S - static, R - RIP, O - OSPF,
        B - BGP, > - selected route, * - FIB route
 K>* 0.0.0.0/0 via 10.60.74.253, eth1
 B>* 10.60.68.0/24 [20/0] via 10.60.74.253, eth1, 6d21h25m        
 B>* 10.60.74.0/24 [20/0] via 10.60.74.253, eth1, 6d21h25m        
 C>* 10.60.74.252/30 is directly connected, eth1
 B>* 10.60.82.0/24 [20/0] via 10.60.74.253, eth1, 6d21h25m        
 B>* 10.60.84.0/24 [20/0] via 10.60.84.253, vlan1, 6d22h50m        
 C>* 10.60.84.252/30 is directly connected, vlan1
 S   10.60.86.0/24 [255/0] is directly connected, Null0, bh
 C>* 10.60.86.0/28 is directly connected, vlan0
 C>* 10.60.86.252/30 is directly connected, vlan1
 B>* 10.60.113.0/24 [20/0] via 10.60.84.253, vlan1, 6d22h50m        
 B>* 10.64.0.0/12 [20/0] via 10.60.74.253, eth1, 6d21h25m        
 C>* 127.0.0.0/8 is directly connected, lo

Referensi


Pranala Menarik