Full BGP Route Olive & Dynamips
Goal: Injected Full global bgp route into olive or dynamips
tools:
1. Olive
2. GNS3
3. VMware
First step Installing libbgpdump & p5-Net-BGP
to inject internet route to your home lab router you need to install BGPsimple
bgpsimple is simple BGP peering and route injection script
its just perl script allows to setup an BGP adjacency with a BGP peer, monitor the messages and updates received from that peer, and to send out updates from a predefined set of NLRIs/attributes. BGP session and message handling is done by Net::BGP.
The script was mainly written to take a file with BGP route information (TABLE_DUMP_V2 format) and to inject these routes over a BGP adjacency. It grew a little over the time, and has some additional features to tweak and filter those routes before advertising them to the peer.
UPDATE messages received will be logged. Currently, there is no implementation of any local routing policy (except the features and sanity checks described at the NOTES section). Furthermore, no adj-rib-in and adj-rib-out databases are maintained.
Please note that you might need to patch Net::BGP to get correct handling of AGGREGATOR attributes (see the end of this file), this got fixed in Net::BGP version 0.12.
You can redistribute and modify this script under the terms of the GNU General Public License version 3.
BGPsimple installation guide
1. install FreeBSD in VMware i dont explain detail installation freebsd on VMware and i’m not using ubuntu or others Linux distro. I just want simple installation and don’t want wasting time just for waiting the installation complete.
2. if your freebsd installed correctly in VMware you need connect your freebsd to internet to install bgpsimple.
3. install depedency software to run bgpsimple script, you just need to type this command to your freebsd.
FreeBSD# cd /usr/ports/net/libbgpdump/ && make install clean
===> Vulnerability check disabled, database not found
===> Extracting for libbgpdump-1.4.99.9
=> MD5 Checksum OK for libbgpdump-1.4.99.9.tar.gz.
=> SHA256 Checksum OK for libbgpdump-1.4.99.9.tar.gz.
===> Patching for libbgpdump-1.4.99.9
===> Configuring for libbgpdump-1.4.99.9
checking for gcc… cc
checking for C compiler default output file name… a.out
checking whether the C compiler works… yes
checking whether we are cross compiling… no
checking for suffix of executables…
FreeBSD# cd /usr/ports/net/p5-Net-BGP/ && make install clean
===> Vulnerability check disabled, database not found
=> Net-BGP-0.13.tar.gz doesn’t seem to exist in /usr/ports/distfiles/.
=> Attempting to fetch from ftp://ftp.funet.fi/pub/languages/perl/CPAN/modules/by-module/Net/.
just wait until installation is completed
4. after installation libbgpdump & p5-Net-BGP complete download bgpsimple perl script at this link
http://code.google.com/p/bgpsimple/downloads/list
Getting route information
The original intention of the script was to feed as many routes to a peer as possible for testing purposes. To get large amounts of real world prefixes, dumps from a DFZ attached peers must be retrieved. Luckily, there are some ressources that provide such dumps, for example RIPE RIS (http://www.ripe.net/projects/ris/rawdata.html). Simply fetch a full dump from http://data.ris.ripe.net/rrc00/ (bview.).
The script cannot work with this binary data, some conversion has to be done. To do that, get the bgpdump library/utility (http://www.ris.ripe.net/source/). Compile bgpdump, then feed the dump through it. Make sure to specify the -m option to produce the condensed format:
FreeBSD#fetch http://data.ris.ripe.net/rrc16/2008.02/bview.20080201.0759.gz
create dump route with the name of bgproute
FreeBSD# zcat bview.20080201.0759.gz | bgpdump -m - > bgproute
Now testing BGP peering to Olive or dynamips
To interconnecting Olive <–> GNS3 <–> Vmware
I need cisco switch to connecting Vmware <–> olive
use c3600 as Vlan Switch
You need create cloud in your gns3, add your vmware interface and olive tap interface and connected to c3600 as vlan switch
configure c3600 trunk port thaht connected to olive, and each port that connect to vmware configure
as access port, i hope you have deep knowledge about switching and running qemu script properly
test ping freebsd <–> Logical-system R3
FreeBSD# ping 172.16.0.13
PING 172.16.0.13 (172.16.0.13): 56 data bytes
64 bytes from 172.16.0.13: icmp_seq=0 ttl=64 time=21.533 ms
64 bytes from 172.16.0.13: icmp_seq=1 ttl=64 time=2.091 ms
64 bytes from 172.16.0.13: icmp_seq=2 ttl=64 time=1.928 ms
64 bytes from 172.16.0.13: icmp_seq=3 ttl=64 time=1.956 ms
^C
— 172.16.0.13 ping statistics —
4 packets transmitted, 4 packets received, 0.0% packet loss
round-trip min/avg/max/stddev = 1.928/6.877/21.533/8.462 ms
YESSS…!!!! Connected
test ping freebsd <–> Logical-system T2
FreeBSD# ping 172.18.0.1
PING 172.18.0.1 (172.18.0.1): 56 data bytes
64 bytes from 172.18.0.1: icmp_seq=0 ttl=64 time=4.795 ms
64 bytes from 172.18.0.1: icmp_seq=1 ttl=64 time=1.763 ms
64 bytes from 172.18.0.1: icmp_seq=2 ttl=64 time=3.482 ms
64 bytes from 172.18.0.1: icmp_seq=3 ttl=64 time=1.827 ms
^C
— 172.18.0.1 ping statistics —
4 packets transmitted, 4 packets received, 0.0% packet loss
round-trip min/avg/max/stddev = 1.763/2.967/4.795/1.261 ms
T2#
YESSSS…!!!! Connected
Now testing BGP peering to Olive
i use this topology from JNCIP study guide to test ebgp peering
This is Simple command IBGP peering FreeBSD <–> Logical-System T2
FreeBSD# ./bgp_simple.pl -myas 65222 -myip 172.18.0.2 -peerip 172.18.0.1 -peeras 65222 -p bgproute -n
—————————————- CONFIG SUMMARY ————————————————–
Configured for an iBGP session between me (ASN65222, 172.18.0.2) and peer (ASN65222, 172.18.0.1).
Using 600 seconds as KeepAlive value and 1800 seconds as HoldTime value for this peer.
Will use prefixes from file myroute.
Maximum number of prefixes to be advertised: 20000.
Will spoof next hop address to 172.18.0.2.
———————————————————————————————————-
Update received from peer [172.18.0.1], ASN [65222]: prfx [10.0.0.0/8] aspath [64512] locprf [100] comm [] orig [IGP] agg [64512 10.0.3.5] nxthp [172.16.0.17]
Update received from peer [172.18.0.1], ASN [65222]: prfx [32.0.0.0/16] aspath [64512 420] locprf [100] comm [] orig [IGP] agg [] nxthp [172.16.0.17]
. . . .
Send Update: prfx [63.123.232.0/24] aspath [25152 23148 701 11486 11927] locprf [0] orig [IGP] nxthp [172.18.0.2]
Send Update: prfx [63.123.234.0/24] aspath [25152 23148 701 11486 11927] locprf [0] orig [IGP] nxthp [172.18.0.2]
Send Update: prfx [63.123.236.0/24] aspath [25152 23148 701 11486 26312] locprf [0] orig [IGP] nxthp [172.18.0.2]
Send Update: prfx [63.123.239.0/24] aspath [25152 23148 3356 2828 26312] locprf [0] orig [IGP] nxthp [172.18.0.2]
Send Update: prfx [63.123.245.0/24] aspath [25152 23148 701 11486 11927] locprf [0] orig [IGP] nxthp [172.18.0.2]
Send Update: prfx [63.124.1.0/24] aspath [25152 23148 701 22314] locprf [0] orig [IGP] nxthp [172.18.0.2]
Send Update: prfx [63.124.20.0/23] aspath [25152 23148 701 1699] locprf [0] orig [INCOMPLETE] nxthp [172.18.0.2]
Send Update: prfx [63.124.22.0/24] aspath [25152 23148 701 1699] locprf [0] orig [INCOMPLETE] nxthp [172.18.0.2]
Send Update: prfx [63.124.78.0/23] aspath [25152 23148 701 6619] locprf [0] orig [IGP] nxthp [172.18.0.2]
You can limit the number of prefix being injected,
i want to inject 50000 prefix just add (-m 50000)
FreeBSD# ./bgp_simple.pl -myas 65222 -myip 172.18.0.2 -peerip 172.18.0.1 -peeras 65222 -p bgproute -m 50000 -n
[edit logical-systems]
AREMA@JNCIP# run show bgp summary logical-system r3
Groups: 3 Peers: 6 Down peers: 1
Table Tot Paths Act Paths Suppressed History Damp State Pending
inet.0 478436 476742 0 0 49969 0
Peer AS InPkt OutPkt OutQ Flaps Last Up/Dwn State|#Active/Received/Accepted/Damped…
10.0.2.1 65001 56 66956 0 0 15:28 4/5/5/0 0/0/0/0
10.0.3.4 65000 68 66970 0 0 14:35 9/12/12/0 0/0/0/0
10.0.6.1 65000 37 66968 0 0 14:46 2/2/2/0 0/0/0/0
10.0.6.2 65000 13 42 0 1 11:35 Connect
172.16.0.14 65222 231807 43605 0 0 2:14 230989/231804/230991/0 0/0/0/0
172.16.0.18 65222 63614 66900 0 0 15:31 245738/246613/245738/0 0/0/0/0
YESSS….!!!! I got The Internet Route year 2008
AREMA@JNCIP# …protocol bgp aspath-regex ".* (701 33383) .*" logical-system r3
inet.0: 246658 destinations, 478465 routes (245782 active, 0 holddown, 1689 hidden)
+ = Active Route, - = Last Active, * = Both
63.126.166.0/24 *[BGP/170] 00:09:24, localpref 100
AS path: 65222 25152 23148 701 33383 I
to 172.16.0.14 via fxp7.103
> to 172.16.0.18 via fxp7.204
[BGP/170] 00:03:38, localpref 100
AS path: 65222 25152 23148 701 33383 I
> to 172.16.0.14 via fxp7.103
192.85.23.0/24 *[BGP/170] 00:07:28, localpref 100, from 172.16.0.18
AS path: 65222 25152 23148 701 33383 I
> to 172.16.0.14 via fxp7.103
to 172.16.0.18 via fxp7.204
[BGP/170] 00:03:04, localpref 100
AS path: 65222 25152 23148 701 33383 I
> to 172.16.0.14 via fxp7.103
192.85.24.0/24 *[BGP/170] 00:07:28, localpref 100
AS path: 65222 25152 23148 701 33383 I
to 172.16.0.14 via fxp7.103
Now change the console to dynamips
Connected to Dynamips VM "Cisco" (ID 1, type c3600) - Console port
Cisco1>
*Mar 1 00:00:37.223: %BGP-5-ADJCHANGE: neighbor 172.19.0.1 Up
Cisco1#show ip bgp sum
BGP router identifier 172.19.0.2, local AS number 420
BGP table version is 231353, main routing table version 231259
231352 network entries using 27068184 bytes of memory
231352 path entries using 12030304 bytes of memory
38705/38704 BGP path/bestpath attribute entries using 4799420 bytes of memory
35537 BGP AS-PATH entries using 1429944 bytes of memory
1 BGP community entries using 24 bytes of memory
0 BGP route-map cache entries using 0 bytes of memory
0 BGP filter-list cache entries using 0 bytes of memory
BGP using 45327876 total bytes of memory
BGP activity 466254/234901 prefixes, 466253/234901 paths, scan interval 60 secs
Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd
172.19.0.1 4 65010 79722 83 201434 17 0 00:04:03 231345
Cisco1#sh ip bgp regexp (701 33383)
BGP table version is 127592, local router ID is 172.19.0.2
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
r RIB-failure, S Stale
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
*> 63.126.166.0/24 172.19.0.1 0 65010 64512 65222 25152 23148 701 33383 i
*> 192.85.23.0 172.19.0.1 0 65010 64512 65222 25152 23148 701 33383 i
*> 192.85.24.0 172.19.0.1 0 65010 64512 65222 25152 23148 701 33383 i
*> 192.85.75.0 172.19.0.1 0 65010 64512 65222 25152 23148 701 33383 i
*> 192.85.88.0 172.19.0.1 0 65010 64512 65222 25152 23148 701 33383 i
*> 192.85.89.0 172.19.0.1 0 65010 64512 65222 25152 23148 701 33383 i
*> 192.85.123.0 172.19.0.1 0 65010 64512 65222 25152 23148 701 33383 i
*> 192.85.133.0 172.19.0.1 0 65010 64512 65222 25152 23148 701 33383 i
*> 192.85.154.0 172.19.0.1 0 65010 64512 65222 25152 23148 701 33383 i
YESSS…!!!! I got it this route
If the BGP connection between bgpsimple and your Olive or dynamips router dies due to a hold timer expiring, you can get around this by doing two things:
this optional options to increase the holdtime and keepalive
keepalive is 1/3 holdtime
edit your bgpsimple script
FreeBSD#ee bgp_simple.pl
go to line 119 & 120 change
my $infile;
my $outfile;
my $prefix_limit;
my $verbose = 0;
my $dry;
my $next_hop_self = "0";
my $adj_next_hop = 0;
my $default_local_pref = 0;
my $myas;
my $myip;
my $peeras;
my $peerip;
my %regex_filter;
my $holdtime = 1500;
my $keepalive = 500;



