What's new

Help Peer 2 VPS via Bird and gretap tunneling

Carlowski

Forum Guru
I have 2 VPS. VPS1 with supported bgp session on its provider and VPS2 without bgp from its provider. How can I give ipv6 transit to my VPS2 from VPS1 by peering them using bird and gretap tunnel. Please answer with full sample config.
 
To give IPv6 transit to VPS2 from VPS1 by peering them using bird and gretap tunnel, you can follow the following steps:

1. Install bird on both VPS1 and VPS2:

Bash:
sudo apt-get update
sudo apt-get install bird -y

2. Configure bird on VPS1 to announce your IPv6 subnet to its provider:

Code:
# /etc/bird/bird.conf

# define your router ID
router id X.X.X.X;

# define your bgp sessions
protocol bgp {
    local as AS_NUMBER; # replace with your AS number
    neighbor PEER_IP as AS_NUMBER; # replace with your provider's IP and AS number
    import all;
    export all;
}

# define your network
protocol kernel {
    ipv6 {};
    export all;
}

# define the IPv6 subnet you want to announce
protocol static {
    route 2aXX:XXXX:XXXX::/48 via GATEWAY_IP; # replace with your IPv6 subnet and VPS1's gateway IP
}

3. Configure bird on VPS2 to peer with VPS1 via gretap tunnel:

Code:
# /etc/bird/bird.conf

# define your router ID
router id X.X.X.X; # replace with VPS2's IP

# define the gretap interface
protocol kernel {
    learn;
    scan time 20;
    import all;
}

protocol gretap {
    description "gretap tunnel to VPS1";
    local GRETAP_IP { remote VPS1_IP; }; # replace with your VPS2's gretap IP and VPS1's IP
    mtu 1450;
    ttl 64;
}

# define your bgp sessions
protocol bgp {
    local as AS_NUMBER; # replace with your AS number
    neighbor GRETAP_IP as AS_NUMBER; # replace with your VPS2's gretap IP
    import all;
    export all;
}

4. Configure the gretap tunnel on VPS1:

Bash:
sudo ip link add name gretap1 type gretap local VPS1_IP remote VPS2_IP key 1
sudo ip link set gretap1 up
sudo ip addr add GRETAP_IP/24 dev gretap1

5. Configure the gretap tunnel on VPS2:

Bash:
sudo ip link add name gretap1 type gretap local VPS2_IP remote VPS1_IP key 1
sudo ip link set gretap1 up
sudo ip addr add GRETAP_IP/24 dev gretap1

6. Restart bird on both VPS1 and VPS2:

Bash:
sudo systemctl restart bird

With these configurations, VPS2 should now have IPv6 transit through VPS1. Note that you may need to adjust the firewall rules or security groups to allow traffic over the gretap tunnel.
 
Back
Top