I've managed to setup OpenVPN for full IPv4 connectivity using tap0. Now I want to do the same for IPv6.
Addresses and network setup (note that my real prefix is replaced by 2001:db8):
2001:db8::100:0:0/96 my assigned IPv6 range
2001:db8::100:abc:0/112 OpenVPN IPv6 range
2001:db8::100:abc:1 tap0 (on server) (set as gateway on client)
2001:db8::100:abc:2 tap0 (on client)
2001:db8::1:2:3:4 gateway for server
Home laptop (tap0: 2001:db8::100:abc:2/112 gateway 2001:db8::100:abc:1/112)
| | | (running Kubuntu 10.10; OpenVPN 2.1.0-3ubuntu1)
| wifi | |
router |
| OpenVPN
INTERNET |
eth0 | /tap0
VPS (eth0:2001:db8::1:2:3:4/64 gateway 2001:db8::1)
(tap0: 2001:db8::100:abc:1/112)
(running Debian 6; OpenVPN 2.1.3-2)
The server has both native IPv4 and IPv6 connectivity, the client has only IPv4.
I can ping6 to and from my server over OpenVPN, but not to other machines (for example, ipv6.google.com
).
net.ipv6.conf.all.forwarding
is set to 1
, I've tried disabling net.ipv6.conf.all.accept_ra
as well, without luck.
Using tcpdump
on both the server and client, I can see that packets are actually transferred over tap0 to eth0. The router (2001:db8::1) send a neighbor solicitation for the client (2001:db8::100:abc:2) to eth0 after it receives the ICMP6 echo-request. The server does not respond to that solicitation, which causes the ICMP6 echo-request not be routed to the destination.
How can I make this IPv6 connection work?
Timothy Baldwins answer put me on the right track, although the answer was rather cryptic. IPv6 neighbor advertisements/solicitation is like ARP for IPv6. It's used to "see" other machines on the network. The router send a neighbor solicitation on which the machine (server or client) should reply on with a neighbor advertisement.
Even with
net.ipv6.conf.all.forwarding
set to1
, neighbor advertisements and solicitations are not forwarded. To make eth0 forward neighbor advertisements and solicitations, eth0 should be set as proxy for the IPv6 address of the client behind tap0, and proxying for neighbor stuff should be enabled for eth0:Unfortunately, it's not possible to retrieve the list of proxies added, nor does
ip -6
show error messages on repeatedly executing the command. Neither am I sure if "neigh del proxy" works, it does not give an error message and the C source is not really meaningful to me.As I do not want to do everything manually, I've created a script which does the work for me.
Server configuration
IPv6 addresses are based on the IPv4 part (the 1 in 10.8.0.1). The prefix and netmask are stored in
/etc/openvpn/variables
.The next steps are made for setting up OpenVPN with encrypted IPv4/IPv6 connectivity to the Internet over a native IPv4 connection. RSA keys and tls-auth are used for authentication and MITM prevention.
/etc/openvpn/variables
contains variables which are used for the up script (run on startup, after creation of tap0 device) and client-connect script (run after the client has authenticated)./etc/openvpn/server-clientconnect.sh
is executed as root and makes sure that IPv6 is routed properly by adding the IPv6 address to the eth0 proxy. Becauseclient-connect
is called after OpenVPN switched to the user specified by theUser
setting,sudo
is needed to give the script sufficient permissions to run as root. Of course, variables should be checked before using, the number should be between and including 2 ad 254. (1 is the gateway, 255 the broadcast address).To make this work, the user
vpn
should be allowed to run the script while preserving$ifconfig_pool_remote_ip
which contains the remote network IPv4 address. Add the next lines to the sudoers file by executingsudo visudo
and appending:/etc/openvpn/server-up.sh
enables IPv4, IPv6 forwarding (eth0+tap0 did not work, it really had to beall
) and neighbor proxy on eth0. It adds the gateway address to serverstap0
too.Finally, the OpenVPN configuration file at
/etc/openvpn/internet.conf
:For completeness, permissions and ownerships of files in
/etc/openvpn
:Firewall settings:
Configuration on client
/etc/openvpn/client.conf
:ta.key
andca.key
are the same files from the server.home.key
andhome.crt
are files, created on the server.client-up.sh
adds the IPv6 address and route (based on IPv4 address):The guide at http://www.ipsidixit.net/2010/03/24/239/ was very helpful and OpenVPN manual page is useful for information about various settings.
The upstream router is configured for 2001:db8::100:abc:2 to be on the directly attached link, set net.ipv6.conf.eth0.proxy_ndp = 1 to pretend that it is.