Skip to contentSkip to conversation

Set interface metric instead letting it on auto (OS choice) when we have redirect-gateway present to enforce the desired effect for IPv6

Openvpn-devel s7r 4 participants 8 messages Jul 27, 2018 – Jul 29, 2018

lore
Share & tools
lore

s7r

author
#0 lore raw

Hello,

I have run into a problem which raised my attention. I am not sure if I can call this a bug, but I think it's best to discuss here and decide if it should be addressed in OpenVPN or let it as it is at operating system layer.

I am connecting to a VPN server that assigns:
- one public IPv4 address;
- one public IPv6 /64 subnet;

It is aimed to redirect all client's internet traffic for internet destinations for both IPv4 and IPv6 so all required parameters for this purpose are present (redirect-gateway def1, redirect-gateway ipv6, route-ipv6 ::/0).

The client has only IPv4 internet connectivity, the VPN server is listening only on IPV4 as well, so both sides of the tunnel are always IPv4.

When the client connects to the VPN using a Wi-Fi default internet connection, it works as expected. Client's IPv4 traffic and IPv6 traffic goes through the VPN for all internet destination, and as expected IPv6 has priority for dual-stacked destinations in the internet.

When the same client with the same environment / setup connects to the same VPN but using a wired network connection (1gbps), the traffic is routed via the VPN for IPv4 but IPv6 is not preferred for dual-stacked destinations. The IPv6 default route is present, but somehow not used automatically for dual-stacked destinations on the internet. It only works if raw IPv6 addresses are stated (excluded DNS hostnames) like $ ping -6 <raw_IPv6_address>.

Solution was to set interface metric for the TAP adapter for both TCP/IPv4 and TCP/IPv6 to 15, which is lower than what the wired ethernet interface had (25), and then it worked as expected, IPv6 from the tunnel was preferred for dual-stacked destinations on the internet.

The question here is if it makes sense to also set the interface metric for both TCP/IPv4 and TCP/IPv6 to the lowest value (for example 1) when redirect-gateway def1 / redirect-gateway ipv6 are present (or pushed) in client config, since if these are present it is obvious what is the desired effect for the client.

#1 lore raw

HI,

Quoted 4 lines · On Fri, Jul 27, 2018 at 05:57:14PM +0300, s7r wrote:

I have run into a problem which raised my attention. I am not sure if I can call this a bug, but I think it's best to discuss here and decide if it should be addressed in OpenVPN or let it as it is at operating system layer.

It's always much more interesting if the OS in question is not mentioned at all... :-)

gert

Signature · 6 lines
"If was one thing all people took for granted, was conviction that if you 
 feed honest figures into a computer, honest figures come out. Never doubted 
 it myself till I met a computer with a sense of humor."
                             Robert A. Heinlein, The Moon is a Harsh Mistress

Gert Doering - Munich, Germany                             [email protected]...
author
#2 lore raw
Quoted 8 lines · Gert Doering

HI,

Quoted 4 lines · On Fri, Jul 27, 2018 at 05:57:14PM +0300, s7r wrote:

I have run into a problem which raised my attention. I am not sure if I can call this a bug, but I think it's best to discuss here and decide if it should be addressed in OpenVPN or let it as it is at operating system layer.

Quoted 5 lines

It's always much more interesting if the OS in question is not mentioned at all... :-)

gert

Hello,

Sorry - I have missed this information because I thought it's irrelevant and it should apply to _any_ operating system, if it is to be applied at all. The OS where I experienced the behavior is Windows 10 Enterprise (64 bit) all up to date with OpenVPN community version 2.4.6-l602, vpn client running in UDP mode.

Hope this information is sufficient.

#3 lore raw

Hi

Quoted 17 lines · On Sat, Jul 28, 2018 at 9:46 PM, s7r <[email protected]...> wrote:
Quoted 8 lines · Gert Doering

HI,

Quoted 4 lines · On Fri, Jul 27, 2018 at 05:57:14PM +0300, s7r wrote:

I have run into a problem which raised my attention. I am not sure if I can call this a bug, but I think it's best to discuss here and decide if it should be addressed in OpenVPN or let it as it is at operating system layer.

Quoted 5 lines

It's always much more interesting if the OS in question is not mentioned at all... :-)

gert

Hello,

Quoted 7 lines

Sorry - I have missed this information because I thought it's irrelevant and it should apply to _any_ operating system, if it is to be applied at all. The OS where I experienced the behavior is Windows 10 Enterprise (64 bit) all up to date with OpenVPN community version 2.4.6-l602, vpn client running in UDP mode.

Hope this information is sufficient.

Not really. Sounds like DNS resolution is changing with metric of the interface which very much points to a WIndows only behaviour.

And, in that case whether a DNS server is set on the tun interface and which DNS server gets used when its "working" as expected and when its "not working" would be relevant. Also whether block-outside-dns is in use.

Selva

author
#4 lore raw
Quoted 11 lines · Selva Nair
Quoted 2 lines

Hope this information is sufficient.

Not really. Sounds like DNS resolution is changing with metric of the interface which very much points to a WIndows only behaviour.

And, in that case whether a DNS server is set on the tun interface and which DNS server gets used when its "working" as expected and when its "not working" would be relevant. Also whether block-outside-dns is in use.

Thanks for the hint Selva. Indeed it looks like something DNS related. The primary wired network interface has 1 IPv4-listening DNS server (192.168.1.1, which uses 2 upstream IPv4-listening DNS server from the ISP). The tun device has 2 IPv4 listening DNS servers (google) and 2 IPv6 listening DNS servers (google) pushed via dhcp-option DNS.

When it is "not working", the DNS server from the wired network interface (192.168.1.1) is used. When it is "working", as when the metric for the tun/tap adapter is changed to be lower than primary wired network interface, google IPv6 listening DNS server is used.

I imagined that it is a problem because even if the IPv4 listening DNS server from the wired network interface is used, that should still be able to deliver AAAA records for dual-stacked hostnames and then the IPv6 route to be used for anything (ping,traceroute,whatever).

#5 lore raw

Hi

Quoted 11 lines

Thanks for the hint Selva. Indeed it looks like something DNS related. The primary wired network interface has 1 IPv4-listening DNS server (192.168.1.1, which uses 2 upstream IPv4-listening DNS server from the ISP). The tun device has 2 IPv4 listening DNS servers (google) and 2 IPv6 listening DNS servers (google) pushed via dhcp-option DNS.

When it is "not working", the DNS server from the wired network interface (192.168.1.1) is used. When it is "working", as when the metric for the tun/tap adapter is changed to be lower than primary wired network interface, google IPv6 listening DNS server is used.

Apparently that's how Windows work. Use --block-outside-dns if you want to be sure that the DNS servers set on the tun/tap is used. That will block dns traffic via all other interfaces and also lower the metric of tun interface.

Selva

#6 lore raw
In reply to s7r

Hi,

Quoted 5 lines · On Sun, Jul 29, 2018 at 04:46:14AM +0300, s7r wrote:

Sorry - I have missed this information because I thought it's irrelevant and it should apply to _any_ operating system, if it is to be applied at all. The OS where I experienced the behavior is Windows 10 Enterprise (64 bit) all up to date with OpenVPN community version 2.4.6-l602, vpn client running in UDP mode.

Only Windows exhibits this funkiness. Other OSes just do what they are told - "here's the most specific route, go and use it".

gert

Signature · 6 lines
"If was one thing all people took for granted, was conviction that if you 
 feed honest figures into a computer, honest figures come out. Never doubted 
 it myself till I met a computer with a sense of humor."
                             Robert A. Heinlein, The Moon is a Harsh Mistress

Gert Doering - Munich, Germany                             [email protected]...