download bgpmon.pl
This script makes use of a zebra that receives a full bgp-table, in my
case this zebra is in a full bgp-mesh with my network to receive unfiltered
bgp from all routers, it checks the community we use to give transit to all
our bgp-speaking and non bgp-speaking customers, and if a prefix is added or
removed in that community a mail is sent that contains the prefix and the
registered data for that prefix (ripedb).
The bgpd and this script must be run on the same host to work.
A mail can look like this:
From: some@mailadress.se
To: receiving@mailadress.se
Subject: bgp-prefix 4 removed, 0 added
--------------------------------------------------------------------------------
prefix 193.10.130.0/25 REMOVED
Description: LTUKIRUNA LTU space phys in Kiruna
nexthop 130.242.83.154 irf1-srp1.sunet.se
origin AS25072 IRF-AS Swedish Institute of Space Physics
--------------------------------------------------------------------------------
prefix 193.10.130.0/25 REMOVED
Description: LTUKIRUNA LTU space phys in Kiruna
nexthop 130.242.83.154 irf1-srp1.sunet.se
origin AS25072 IRF-AS Swedish Institute of Space Physics
--------------------------------------------------------------------------------
prefix 193.10.130.128/25 REMOVED
Description: LTUKIRUNA LTU space phys in Kiruna
nexthop 130.242.83.154 irf1-srp1.sunet.se
origin AS25072 IRF-AS Swedish Institute of Space Physics
--------------------------------------------------------------------------------
prefix 193.10.130.128/25 REMOVED
Description: LTUKIRUNA LTU space phys in Kiruna
nexthop 130.242.83.154 irf1-srp1.sunet.se
origin AS25072 IRF-AS Swedish Institute of Space Physics
or if there are added routes it mixes these with the removed during
the same interval
I just use the bgpd in the zebra-kit, exampleconfig below:
the zebrad does NOT have to be running since I dont want any of
the received routes to be present in my forwardingtable on the pc
I just want the debug-information.
Current configuration:
!
hostname bgplogger-bgpd
password apassword
enable password apassword
log file /var/log/bgpd.log
log stdout
!
router bgp 1653
bgp router-id 11.22.33.44
neighbor SUNET-CORE peer-group
neighbor SUNET-CORE remote-as 1653
neighbor SUNET-CORE next-hop-self
neighbor SUNET-CORE filter-list INGET out
neighbor 11.11.11.11 peer-group SUNET-CORE
neighbor 11.11.11.11 description boras1
neighbor 22.22.22.22 peer-group SUNET-CORE
neighbor 22.22.22.22 description boras2
neighbor 33.33.33.33 peer-group SUNET-CORE
neighbor 33.33.33.33 description borlange2
neighbor 44.44.44.44 peer-group SUNET-CORE
neighbor 44.44.44.44 description borlange1
!
access-list VTYLOGINS permit 55.55.55.55/24
access-list VTYLOGINS permit 127.0.0.1/32
access-list VTYLOGINS deny any
!
ip as-path access-list INGET deny .*
!
line vty
access-class VTYLOGINS
exec-timeout 120 0
!
end
And, you must also set debugging like this:
bgplogger-bgpd# debug bgp updates
for the script to be able to look at the bgp-information, the logfile
actually includes ALL the bgp-prefixes in the Internet, and can be quite
useful to have to do post-mortem examinations of bad manners of bgp-announcements.
All of the above presumes that you actually use communities on your prefixes that
are to be announced to external peers on IX:es, if you don't, dont use this script.