Picobgp is a small and easy to use BGP routing software that can automatically setup routing within a VPN or generic network. It allows routing advertisements and topology updates with minimal configuration by command line arguments. Key features include routing advertising, topology updates, and being tiny and easy to use.
1. picobgp
● non-compliant-bgp
● routing advertising
● tolopogy update
● tiny and easy to use
for picobgp v0.2
CC-BY: Claudio Mignanti (2012)
2. picobgp - Take over of your vpn
picobgp was written to automatically setup routing inside a vpn,
but can be used also in a generic net.
Suppose that you have some vpn peers, serverA and your
laptop.
Now serverA is also part of a local lan, say 10.0.8.0/24 and you
want that your laptop can reach all the serverA-lan with
minimus effort.
picobgp can help you!
7. picobgp - command args
picobgp DOESN'T support Supported args in v0.2 are:
configuration with files but only
by cmdline args. -1
one-shot advertising
Supported args in v0.1 are: (useful inside script)
-i <interface> -c
Specify the outgoing interface cascade
-s x.x.x.x/y annunce the subnet received.
Specify the subnet This option can lead to routing
(option can be repeated for loop!
each subnet) KEEP your network in tree
forms!!!
8. and don't forgot to...
.. enable routing on your servers
echo 1 | sudo tee /proc/sys/net/ipv4/ip_forward
10. # pbgp -i eth0 -s 10.1.1.9/29
eth1: 10.1.1.1
# pbgp -i eth1 -s 192.168.1.0/24
# pbgp -c -i eth0 -s 10.1.1.0/29
eth0: 192.168.1.2
ServerB announce also ServerA subnet
# pbgp -i eth0
On v0.1+ the -c option allow the propagation of
subnets
11. picobgp as daemon
Daemon mode un-supported for choice.
# ./pbgp -cs 1.1.1.0/24 & >/dev/null 2>&1
is what you are looking for...
Do you like to know why this choice?
12. picobgp inside scripts
We want to annouce a given subnet if a host inside the
subnet reply to ping
#!/bin/bash
while 1; do
ping -c 1 192.168.1.9 && pbgp -1s 192.168.1.0/24
sleep 5
done
-1 option is one-shot and die mode (thanks Clauz for the idea)
13. Behind the scene
The bgpmsg struct is In update_rt() function this
inizialized with the program structure is used to inizialize
args and than spammed on a struct rtentry and then
iface broadcast address passed to a ioctl that
every 3 seconds. manipolate the kernel route
table.
typedef struct sbgpmsg { ioctl (sd, SIOCADDRT, &rtentry);
struct in_addr addr;
struct in_addr netmask; If a subnet is not spammed
struct in_addr loc_addr; for more that 10 secs the
time_t l_update; route entry is deleted.
} bgpmsg;
14. what's next?!?!??!
KNOW ISSUE for v0.1: TODO:
* msg are broadcast using ideas?
255.255.255.255 and is not
using the effective broadcast
address of the passed
interface
* DELRT show be bogus
15. Use picobgp for redundant gateway
HostA has 10.0.1.9 inside it
LAN 10.0.1.0/24 and the gws
are 10.0.1.1 and 10.0.1.2
We want to setup the route