bgpmon

NAME

bgpmon - BGP Monitoring Script

SYNOPSIS

# bgpmon.pl6 --port=1179 -my-asn=65000 --my-bgp-id=192.0.2.9 \
         192.168.150.252 65000

DESCRIPTION

This provides an interface to receive and send BGP update message from a command line script.

EXAMPLES

RECEIVE ROUTES FROM PEER

To see real-time BGP announcements from a peer:

# bgpmon.pl6 --my-asn=65000 --my-bgp-id=192.0.2.9 192.168.150.252 65000

ANNOUNCING TO A PEER

To announce a prefix to a peer:

# bgpmon.pl6 --my-asn=65000 --my-bgp-id=192.0.2.9 \
        --announce=192.0.2.0/24-192.0.2.9
        192.168.150.252 65000

This will connect to 192.168.150.252 and send prefix 192.0.2.0/24 with a next-hop of 192.0.2.9.

REQUIRED PARAMETERS

--my-asn=<asn>

This is our ASN value.

--my-bgp-id=<ip>

This is our BGP identifier, expressed as an IPv4 address. Typically this is an IP address assigned to this host.

<peer-IP> <peer-ASN>

The last items on the command line are the peers to which we connect and from which we accept connections.

OPTIONAL PARAMETERS

--passive

If this is provided, the script will not attempt to connect to the BGP peers. Instead, it will simply await connections.

--port=<port>

This is the BGP port to listen on. The default port, 179, requires elevated privileges, so this may be useful for user-level BGP code.

--listen-host=<host>

This is the BGP host to listen on. The default host, 0.0.0.0, is equivilent to "all IPv4 addresses." Use :: if you would like to listen to IPv6 too.

--allow-unknown-peers

If this is present, peers that aren't explictly defined will be allowed to connect. We'll accept whatever ASN they provide on the initial connection (this initial ASN value will be remembered until this script exits). This is useful to minimize configuration requirements.

--asn-filter <asn-list>

This is a comma seperated lists of ASNs. If an UPDATE message is received that has an AS path element or aggregation ASN from this list, the UPDATE will be printed. Otherwise it will be silently ignored (unless it instead matches a constraint from --cidr-filter. The default is to have no filtering.

--cidr-filter <cidr-list>

This is a comma seperated lists of CIDRs. If an UPDATE message is received that has an NRLI or withdrawn/unreachable prefix from this list, the UPDATE will be printed. Otherwise it will be silently ignored (unless it instead matches a constraint from --asn-filter. The default is to have no filtering.

--announce <prefixs-and-nexthops>

--announce 192.0.2.0/24-192.0.2.1,10.0.0.0/8-192.0.2.1

A comma seperated list of prefixes to announce along with the appropriate next hop. The next hop is seperated from the prefix by a hypen, while multiple prefixes are seperated by a comma.

--communities <community-list>

A comma seperated list of communities to advertise with any --announce routes provided.

--af-ipv6

If present, advertise address family IPv6 Unicast support to the remote peer.

--hold-time <seconds>

If present, advertise the given hold time. Must be zero or 3..65535.

--short-format

If present, use the short output format rather than the more human-readable format. The short format is pipe seperated and contains lines in the following format:

For OPEN messages, a typical line looks like:

O|15466360000|192.0.2.2

The fields are "O" (Open), followed by a Posix time stamp, followed by the peer that sent the Open message.

For UPDATE messages, a typical line looks like:

U|15466360000|192.0.2.2|192.0.2.0/24|192.0.2.2|65001 i|65001:123 65001:345

The fields are "U" (Update), followed by a Posix time stamp, followed by the peer's IP address, followed by the CIDR announced, followed by the next hop, followed by the full AS path plus origin, and ending with a list of space-seperated communities in the BGP message.

--max-log-messages=<num>

This will cause the bgpmon script to exit after a certain number of messages are output.

--batch-size

Decoding the BGP messages is done with a multi-threaded process. This selects how many messages should be processed per thread.

--cores

Number of cores to use to decode BGP messages. This defaults to the number of CPU cores installed in the system.

--lint-mode

Only output messages that trigger some "lint" checks (and match any filters in place). For example, private ASNs in the Aggregator path attribute of an UPDATE message.

--color

Enable basic output colorization to make output slightly easier to read.

Net::BGP v0.9.0

BGP Server Support

Authors

  • Joelle Maslak

License

Artistic-2.0

Dependencies

ifDateTime::MonotonicDigestNativeHelpers::BlobOO::MonitorsStrictClassSys::DomainnameSys::HostAddrTCP::LowLevelTerminal::ANSIColor

Test Dependencies

Provides

  • Net::BGP
  • Net::BGP::AFI
  • Net::BGP::AFI-SAFI
  • Net::BGP::AS-List
  • Net::BGP::CIDR
  • Net::BGP::Capability
  • Net::BGP::Capability::ASN32
  • Net::BGP::Capability::Deprecated-Dynamic-Capability
  • Net::BGP::Capability::FQDN
  • Net::BGP::Capability::Generic
  • Net::BGP::Capability::Graceful-Restart
  • Net::BGP::Capability::Graceful-Restart::Per-AF
  • Net::BGP::Capability::MPBGP
  • Net::BGP::Capability::Route-Refresh
  • Net::BGP::Capability::Route-Refresh-Cisco
  • Net::BGP::Command
  • Net::BGP::Command::BGP-Message
  • Net::BGP::Command::Dead-Child
  • Net::BGP::Command::Stop
  • Net::BGP::Connection
  • Net::BGP::Connection-List
  • Net::BGP::Connection-Role
  • Net::BGP::Controller
  • Net::BGP::Controller-Handle-BGP
  • Net::BGP::Conversions
  • Net::BGP::Conversions-Post201812
  • Net::BGP::Conversions-Pre201812
  • Net::BGP::Error
  • Net::BGP::Error::Bad-Option-Length
  • Net::BGP::Error::Bad-Parameter-Length
  • Net::BGP::Error::Hold-Time-Too-Short
  • Net::BGP::Error::Length-Too-Long
  • Net::BGP::Error::Length-Too-Short
  • Net::BGP::Error::Marker-Format
  • Net::BGP::Error::Unknown-Version
  • Net::BGP::Event
  • Net::BGP::Event::BGP-Message
  • Net::BGP::Event::Closed-Connection
  • Net::BGP::Event::New-Connection
  • Net::BGP::IP
  • Net::BGP::Message
  • Net::BGP::Message::Generic
  • Net::BGP::Message::Keep-Alive
  • Net::BGP::Message::Notify
  • Net::BGP::Message::Notify::Cease
  • Net::BGP::Message::Notify::Cease::Administrative-Reset
  • Net::BGP::Message::Notify::Cease::Administrative-Shutdown
  • Net::BGP::Message::Notify::Cease::Connection-Rejected
  • Net::BGP::Message::Notify::Cease::Generic
  • Net::BGP::Message::Notify::Cease::Peer-Deconfigured
  • Net::BGP::Message::Notify::Generic
  • Net::BGP::Message::Notify::Header
  • Net::BGP::Message::Notify::Header::Connection-Not-Syncronized
  • Net::BGP::Message::Notify::Header::Generic
  • Net::BGP::Message::Notify::Hold-Timer-Expired
  • Net::BGP::Message::Notify::Open
  • Net::BGP::Message::Notify::Open::Bad-Peer-AS
  • Net::BGP::Message::Notify::Open::Generic
  • Net::BGP::Message::Notify::Open::Unsupported-Optional-Parameter
  • Net::BGP::Message::Notify::Open::Unsupported-Version
  • Net::BGP::Message::Open
  • Net::BGP::Message::Update
  • Net::BGP::Parameter
  • Net::BGP::Parameter::Capabilities
  • Net::BGP::Parameter::Generic
  • Net::BGP::Path-Attribute
  • Net::BGP::Path-Attribute::AS-Path
  • Net::BGP::Path-Attribute::AS4-Aggregator
  • Net::BGP::Path-Attribute::AS4-Path
  • Net::BGP::Path-Attribute::Aggregator
  • Net::BGP::Path-Attribute::Atomic-Aggregate
  • Net::BGP::Path-Attribute::Cluster-List
  • Net::BGP::Path-Attribute::Community
  • Net::BGP::Path-Attribute::Extended-Community
  • Net::BGP::Path-Attribute::Generic
  • Net::BGP::Path-Attribute::Local-Pref
  • Net::BGP::Path-Attribute::Long-Community
  • Net::BGP::Path-Attribute::MED
  • Net::BGP::Path-Attribute::MP-NLRI
  • Net::BGP::Path-Attribute::MP-Unreachable
  • Net::BGP::Path-Attribute::Next-Hop
  • Net::BGP::Path-Attribute::Origin
  • Net::BGP::Path-Attribute::Originator-ID
  • Net::BGP::Peer
  • Net::BGP::Peer-List
  • Net::BGP::SAFI
  • Net::BGP::Speaker
  • Net::BGP::Speaker::Display
  • Net::BGP::Time
  • Net::BGP::Validation

The Camelia image is copyright 2009 by Larry Wall. "Raku" is trademark of the Yet Another Society. All rights reserved.