Trying to learn how IPv6 works with OpenVPN, so I wanted to setup following scheme.
I have a VPS server (Ubuntu), which have been allocated a /48 subnet.
ISP ipv6 gateway is XXXX:XXXX:XXXX::1
Server ipv6 address is XXXX:XXXX:XXXX:39::1
The idea is that any clients connecting to server gets an ip address on the XXXX:XXXX:XXXX:39:2::/64 subnet.
Server configuration file is based on the sample configuration from OpenVPN with the following additions:
dev tun
tun-ipv6
server-ipv6 XXXX:XXXX:XXXX:39:2::/64
push "route-ipv6 XXXX:XXXX:XXXX:39::/48"
Restarting OpenVPN server gave no problems.
Server is assigned following ip addresses:
eth0: XXXX:XXXX:XXXX:39::1/48
tun0: XXXX:XXXX:XXXX:39::2/64
Client is assigned:
OpenVPN tap: XXXX:XXXX:XXXX:39:2:0:1:0, and I can ping XXXX:XXXX:XXXX:39::1 just fine. However pinging ISP gateway from client makes connection time out.
I can ping ISP ipv6 gateway from server.
I have allowed traffic from XXXX:XXXX:XXXX:39:2::/64 in Ubuntu Firewall.
What am I missing?
I should mention server is running OpenVPN version 2.2.1 - is that the reason for the complaining?
Turns out it is was not quite so easy to use my hosted server as an IPv6 gateway. It is doable though it is a multi step process.
I ended up asking bit in here, so the following is a summary of what I have learned during the process.
To get a routable subnet I went to Hurricane Electric and got myself a routed /48 subnet from Hurricane Electric. Visit https://tunnelbroker.net for more information about how to obtain your own subnet.
They will provide a IPv6 routed over IPv4 tunnel and also tell you what you should add to you
/etc/interfaces
.My IPv6 addresses on the tunnel link is on the form:
2001:470:xxxx:xxx::/64
. Therefore the following lines should be added to/etc/interfaces
:But due to my server already have a public IPv6 address, it will cause some issues that we will have to mitigate before I can ping anything from the Tunnelbroker subnet.
#Enter policy based routing.
The idea is that the server decides which outbound link it should for IPv6 traffic depending on source IPv6 address.
The rules are pretty simple.
This means you need two routing tables. The default routing table (called:
main
) and your own table (I called minemynet6
).First add an entry for custom routing table:
For agument sake lets say I am assigned the subnet
2001:db8:cafe::/48
.I made a script that is called by OpenVPN when VPN link is up, since my /48 subnet resides only on my VPN link. The script goes a bit like this:
#Verification of configuration
You can verify your routing setup with the command:
ip -6 rule show
It should contain something like:
The routing table for Tunnelbroker link can be found with:
ip -6 route show table mynet6
And it should output something like:
You default routing table is found here:
ip -6 route show table main
And it should have among others the lines:
That should take of what the server have todo when it recieve traffic from the /48 subnet. How you assign the /48 subnet your to own network is an entire different chapter, that I am not going cover here. :-)