My setup:
GRE Tunnel using 10.42.1.0/24 for IPv4 and fd00:42::/48 for IPv6.
Host 1 (colo2) will announce: 2a07:1c42:10::/48 using AS208717.
Host 2 (vps1) will announce: 192.168.5.5/32 using AS65000.
First create the GRE tunnels:
host 1:
/etc/network/interfaces:
auto vps1
iface vps1 inet tunnel
address 10.42.1.1
netmask 255.255.255.0
mode gre
endpoint 37.97.204.107
dstaddr 10.42.1.2
local 82.94.183.130
post-up ip -6 addr add fd00:42::1/48 dev vps1
/etc/bird/bird.conf:
log syslog all;
debug protocols all;
router id 10.42.1.1;
protocol bgp vps1 {
local as 208717;
neighbor 10.42.1.2 as 65000;
source address 10.42.1.1;
multihop;
import all;
export none;
}
protocol device {
}
protocol direct {
interface "lo";
}
protocol kernel {
metric 0;
learn;
import none;
export all;
}
protocol static {
route 10.42.1.0/24 via 10.42.1.2;
}
/etc/bird/bird6.conf:
log syslog all;
debug protocols all;
router id 10.42.1.1;
filter export_subnets {
if net ~ [ 2a07:1c42:10::/48 ] then {
accept;
}
reject;
}
protocol bgp vps1 {
description "GRE tunnel vps1.zuijlen.eu";
local as 208717;
neighbor fd00:42::2 as 65000;
source address fd00:42::1;
multihop;
import all;
export filter export_subnets;
}
protocol device {
}
protocol direct {
interface "lo";
}
protocol kernel {
metric 0;
learn;
import none;
export all;
}
protocol static {
route fd00:42::/48 via fd00:42::2;
}
Host 2:
/etc/network/interfaces:
auto colo2
iface colo2 inet tunnel
address 10.42.1.2
netmask 255.255.255.0
mode gre
endpoint 82.94.183.130
dstaddr 10.42.1.1
local 37.97.204.107
post-up ip -6 addr add fd00:42::2/48 dev colo2
/etc/bird/bird.conf:
log syslog all;
debug protocols all;
router id 10.42.1.2;
filter export_subnets {
if net ~ [ 192.168.5.5/32 ] then {
accept;
}
reject;
}
protocol bgp colo2 {
local as 65000;
neighbor 10.42.1.1 as 208717;
source address 10.42.1.2;
multihop;
import all;
export filter export_subnets;
}
protocol device {
}
protocol direct {
interface "lo";
}
protocol kernel {
metric 0;
learn;
import none;
export all;
}
protocol static {
route 10.42.1.0/24 via 10.42.1.1;
}
#protocol static static_bgp {
# route 192.168.5.5/32 via 10.42.1.2;
#}
/etc/bird/bird6.conf:
log syslog all;
debug protocols all;
router id 10.42.1.2;
protocol bgp colo2 {
description "GRE tunnel colo2.zuijlen.eu";
local as 65000;
neighbor fd00:42::1 as 208717;
source address fd00:42::2;
multihop;
import all;
export none;
}
protocol device {
}
protocol direct {
interface "lo";
}
protocol kernel {
metric 0;
learn;
import none;
export all;
}
protocol static {
route fd00:42::/48 via fd00:42::1;
}
Announcing ranges:
In this setup anything that is added to device lo will be automatically announced.
root@vps1:~# ip addr add 192.168.5.5/32 dev lo
root@colo2:~# ip -6 add add 2a07:1c42:10::1/48 dev lo
root@vps1:~# birdc show protocols
BIRD 1.6.3 ready.
name proto table state since info
colo2 BGP master up 17:08:24 Established
device1 Device master up 17:08:23
direct1 Direct master up 17:08:23
kernel1 Kernel master up 17:08:23
static1 Static master up 17:08:23
root@vps1:~# birdc show route all
BIRD 1.6.3 ready.
192.168.5.5/32 dev lo [direct1 17:08:23] * (240)
Type: device unicast univ
10.42.1.0/24 via 10.42.1.1 on colo2 [static1 17:08:23] * (200)
Type: static unicast univ
root@vps1:~# birdc show protocols all colo2
BIRD 1.6.3 ready.
name proto table state since info
colo2 BGP master up 17:08:24 Established
Preference: 100
Input filter: ACCEPT
Output filter: export_subnets
Routes: 0 imported, 1 exported, 0 preferred
Route change stats: received rejected filtered ignored accepted
Import updates: 0 0 0 0 0
Import withdraws: 0 0 --- 0 0
Export updates: 2 0 1 --- 1
Export withdraws: 0 --- --- --- 0
BGP state: Established
Neighbor address: 10.42.1.1
Neighbor AS: 208717
Neighbor ID: 10.42.1.1
Neighbor caps: refresh enhanced-refresh restart-aware AS4
Session: external multihop AS4
Source address: 10.42.1.2
Hold timer: 130/240
Keepalive timer: 44/80
root@vps1:~# birdc6 show protocols
BIRD 1.6.3 ready.
name proto table state since info
colo2 BGP master up 23:46:29 Established
device1 Device master up 2019-06-22
direct1 Direct master up 2019-06-22
kernel1 Kernel master up 2019-06-22
static1 Static master up 2019-06-22
root@vps1:~# birdc6 show route all
BIRD 1.6.3 ready.
2a07:1c42:10::/48 via fd00:42::1 on colo2 [colo2 23:46:29] * (100/?) [AS208717i]
Type: BGP unicast univ
BGP.origin: IGP
BGP.as_path: 208717
BGP.next_hop: fd00:42::1
BGP.local_pref: 100
fd00:42::/48 via fd00:42::1 on colo2 [static1 14:33:32] * (200)
Type: static unicast univ
root@vps1:~# birdc6 show protocols all colo2
BIRD 1.6.3 ready.
name proto table state since info
colo2 BGP master up 23:46:29 Established
Description: GRE tunnel colo2.zuijlen.eu
Preference: 100
Input filter: ACCEPT
Output filter: REJECT
Routes: 1 imported, 0 exported, 1 preferred
Route change stats: received rejected filtered ignored accepted
Import updates: 1 0 0 0 1
Import withdraws: 0 0 --- 0 0
Export updates: 8 5 3 --- 0
Export withdraws: 2 --- --- --- 0
BGP state: Established
Neighbor address: fd00:42::1
Neighbor AS: 208717
Neighbor ID: 10.42.1.1
Neighbor caps: refresh enhanced-refresh restart-aware AS4
Session: external multihop AS4
Source address: fd00:42::2
Hold timer: 152/240
Keepalive timer: 19/80
root@colo2:~# birdc show protocols
BIRD 1.6.3 ready.
name proto table state since info
vps1 BGP master up 17:08:24 Established
device1 Device master up 23:54:59
direct1 Direct master up 23:54:59
kernel1 Kernel master up 23:54:59
static1 Static master up 23:54:59
root@colo2:~# birdc show route all
BIRD 1.6.3 ready.
192.168.5.5/32 via 10.42.1.2 on vps1 [vps1 17:08:24] * (100/?) [AS65000i]
Type: BGP unicast univ
BGP.origin: IGP
BGP.as_path: 65000
BGP.next_hop: 10.42.1.2
BGP.local_pref: 100
10.42.1.0/24 via 10.42.1.2 on vps1 [static1 18:54:51] * (200)
Type: static unicast univ
root@colo2:~# birdc show protocols all vps1
BIRD 1.6.3 ready.
name proto table state since info
vps1 BGP master up 17:08:24 Established
Preference: 100
Input filter: ACCEPT
Output filter: REJECT
Routes: 1 imported, 0 exported, 1 preferred
Route change stats: received rejected filtered ignored accepted
Import updates: 1 0 0 0 1
Import withdraws: 0 0 --- 0 0
Export updates: 3 1 2 --- 0
Export withdraws: 1 --- --- --- 0
BGP state: Established
Neighbor address: 10.42.1.2
Neighbor AS: 65000
Neighbor ID: 10.42.1.2
Neighbor caps: refresh enhanced-refresh restart-aware AS4
Session: external multihop AS4
Source address: 10.42.1.1
Hold timer: 178/240
Keepalive timer: 63/80
root@colo2:~# birdc6 show protocols
BIRD 1.6.3 ready.
name proto table state since info
device1 Device master up 2019-06-21
static1 Static master up 2019-06-22
kernel1 Kernel master up 2019-06-22
vps1 BGP master up 23:46:29 Established
direct1 Direct master up 2019-06-22
root@colo2:~# birdc6 show route all
BIRD 1.6.3 ready.
2a07:1c42:10::/48 dev lo [direct1 2019-06-22] * (240)
Type: device unicast univ
fd00:42::/48 via fd00:42::2 on vps1 [static1 23:46:25] * (200)
Type: static unicast univ
root@colo2:~# birdc6 show protocols all vps1
BIRD 1.6.3 ready.
name proto table state since info
vps1 BGP master up 23:46:29 Established
Description: GRE tunnel vps1.zuijlen.eu
Preference: 100
Input filter: ACCEPT
Output filter: export_subnets
Routes: 0 imported, 1 exported, 0 preferred
Route change stats: received rejected filtered ignored accepted
Import updates: 0 0 0 0 0
Import withdraws: 0 0 --- 0 0
Export updates: 2 0 1 --- 1
Export withdraws: 0 --- --- --- 0
BGP state: Established
Neighbor address: fd00:42::2
Neighbor AS: 65000
Neighbor ID: 10.42.1.2
Neighbor caps: refresh enhanced-refresh restart-aware AS4
Session: external multihop AS4
Source address: fd00:42::1
Hold timer: 220/240
Keepalive timer: 33/80
Try it out:
root@vps1:~# ping6 -c 1 2a07:1c42:10::1
PING 2a07:1c42:10::1(2a07:1c42:10::1) 56 data bytes
64 bytes from 2a07:1c42:10::1: icmp_seq=1 ttl=64 time=1.31 ms
--- 2a07:1c42:10::1 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 1.317/1.317/1.317/0.000 ms
root@colo2:~# ping -c 1 192.168.5.5
PING 192.168.5.5 (192.168.5.5) 56(84) bytes of data.
64 bytes from 192.168.5.5: icmp_seq=1 ttl=64 time=1.26 ms
--- 192.168.5.5 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 1.264/1.264/1.264/0.000 ms