55 lines
1.2 KiB
Plaintext
55 lines
1.2 KiB
Plaintext
# The router ID of a BGP router can theoretically be anything.
|
|
# It's common practice to set it to the IPv4 address that other routers will peer with.
|
|
router id 192.168.179.1;
|
|
|
|
# Export all learned IPv4 routes from peers into the kernel's routing table.
|
|
# This turns a BGP route server into a BGP router.
|
|
# Visible with `ip route show`.
|
|
protocol kernel
|
|
{
|
|
ipv4
|
|
{
|
|
import all;
|
|
export filter
|
|
{
|
|
if source = RTS_STATIC then reject;
|
|
krt_prefsrc = 192.168.179.1;
|
|
accept;
|
|
};
|
|
};
|
|
}
|
|
|
|
# The IPv4 routes to be announced.
|
|
protocol static
|
|
{
|
|
ipv4;
|
|
route 10.0.0.1/32 reject;
|
|
route 10.0.0.2/32 reject;
|
|
route 10.0.0.3/32 reject;
|
|
}
|
|
|
|
# Avoid hammering the kernel's routing table unnecessarily.
|
|
protocol device {
|
|
scan time 10;
|
|
}
|
|
|
|
# You can template peers.
|
|
template bgp PEER
|
|
{
|
|
# The ASN this router announces as.
|
|
local as 1;
|
|
ipv4
|
|
{
|
|
# DON'T EVER DO THIS ON THE REAL INTERNET.
|
|
# THIS IS HOW ROUTE LEAKS AND BGP HIJACKS HAPPEN.
|
|
import all;
|
|
export all;
|
|
};
|
|
}
|
|
|
|
# Peer with AS2! :-)
|
|
protocol bgp AS2 from PEER
|
|
{
|
|
# The IP address and ASN of the peer.
|
|
neighbor 192.168.179.2 as 2;
|
|
} |