An example of a Linux edge router running Quagga: your own autonomous system, two IPv4 upstreams and an IPv6 BGP session with the first one. The setup uses two files: zebra.conf for interfaces and static routes, and bgpd.conf for BGP and filters. Addresses and AS numbers come from documentation ranges, so replace them with your own.
Interfaces and routes: zebra.conf
In zebra we describe the interfaces towards the upstreams and the local network, and add Null0 routes for our own prefixes. Without them, BGP will not announce a network that is not in the routing table. ipv6 nd suppress-ra turns off Router Advertisements on interfaces that do not need them.
hostname edge-01
log file /var/log/quagga/zebra.log
!
interface br0
ip address 203.0.113.1/24
ipv6 address 2001:db8:100::1/64
ipv6 nd suppress-ra
!
interface eth0
description ISP1
ip address 192.168.1.2/30
ipv6 address 2001:db8:ffff:1::2/64
ipv6 nd suppress-ra
!
interface eth1
description ISP2
ip address 10.254.0.2/30
ipv6 nd suppress-ra
!
ip route 203.0.113.0/24 Null0 254
ipv6 route 2001:db8::/32 Null0 254
!
ip forwarding
ipv6 forwarding
BGP sessions: bgpd.conf
IPv4 neighbors are configured as usual. An IPv6 neighbor is declared in the main section but activated under address-family ipv6, together with the announced IPv6 network and the filters for that session.
hostname edge-01
log file /var/log/quagga/bgpd.log
!
router bgp 64500
bgp router-id 192.168.1.2
bgp log-neighbor-changes
network 203.0.113.0/24
!
neighbor 192.168.1.1 remote-as 64501
neighbor 192.168.1.1 description ISP1
neighbor 192.168.1.1 soft-reconfiguration inbound
neighbor 192.168.1.1 route-map ISP-in in
neighbor 192.168.1.1 route-map ISP-out out
!
neighbor 10.254.0.1 remote-as 64502
neighbor 10.254.0.1 description ISP2
neighbor 10.254.0.1 soft-reconfiguration inbound
neighbor 10.254.0.1 route-map ISP-in in
neighbor 10.254.0.1 route-map ISP-out out
!
neighbor 2001:db8:ffff:1::1 remote-as 64501
neighbor 2001:db8:ffff:1::1 description ISP1_IPv6
!
address-family ipv6
network 2001:db8::/32
neighbor 2001:db8:ffff:1::1 activate
neighbor 2001:db8:ffff:1::1 soft-reconfiguration inbound
neighbor 2001:db8:ffff:1::1 route-map ISP-v6-in in
neighbor 2001:db8:ffff:1::1 route-map ISP-v6-out out
exit-address-family
Filters
Inbound, we drop routes with private AS numbers in the path, bogon networks and our own prefixes coming back from outside. Outbound, we allow only our own networks, so a configuration mistake cannot turn you into a transit for someone else's traffic.
ip prefix-list bogons seq 20 permit 127.0.0.0/8 le 32
ip prefix-list bogons seq 30 permit 10.0.0.0/8 le 32
ip prefix-list bogons seq 35 permit 172.16.0.0/12 le 32
ip prefix-list bogons seq 40 permit 192.168.0.0/16 le 32
ip prefix-list bogons seq 45 permit 169.254.0.0/16 le 32
ip prefix-list bogons seq 50 permit 224.0.0.0/4 le 32
ip prefix-list bogons seq 55 permit 240.0.0.0/4 le 32
ip prefix-list MY-IPv4 seq 5 permit 203.0.113.0/24 le 32
ip prefix-list IPv4-out seq 10 permit 203.0.113.0/24
!
ipv6 prefix-list MY-IPv6 seq 5 permit 2001:db8::/32 le 128
ipv6 prefix-list IPv6-out seq 10 permit 2001:db8::/32
!
ip as-path access-list 1 permit _6451[2-9]_
ip as-path access-list 1 permit _645[2-9][0-9]_
ip as-path access-list 1 permit _64[6-9][0-9][0-9]_
ip as-path access-list 1 permit _65[0-9][0-9][0-9]_
route-map ISP-in deny 100
match as-path 1
route-map ISP-in deny 110
match ip address prefix-list bogons
route-map ISP-in deny 120
match ip address prefix-list MY-IPv4
route-map ISP-in permit 200
!
route-map ISP-out permit 100
match ip address prefix-list IPv4-out
route-map ISP-out deny 200
!
route-map ISP-v6-in deny 100
match as-path 1
route-map ISP-v6-in deny 110
match ipv6 address prefix-list MY-IPv6
route-map ISP-v6-in permit 200
!
route-map ISP-v6-out permit 100
match ipv6 address prefix-list IPv6-out
route-map ISP-v6-out deny 200
Checking
Connect to bgpd (telnet localhost 2605 or vtysh) and check the sessions with show ip bgp summary and show bgp ipv6 summary, and the announcements with show ip bgp neighbors 192.168.1.1 advertised-routes.
Similar examples for Cisco and MikroTik are on the blog. If you need help with BGP, get in touch.