Gentoo Archives: gentoo-user

From: Grant Taylor <gtaylor@×××××××××××××××××××××.net>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] Enable "regular" network traffic when using VPN
Date: Mon, 18 Jun 2018 14:36:18
Message-Id: ded3555a-c255-3285-e97a-cfeb4eaf40b6@spamtrap.tnetconsulting.net
In Reply to: Re: [gentoo-user] Enable "regular" network traffic when using VPN by Mick
1 On 06/18/2018 04:30 AM, Mick wrote:
2 > Hi Grant,
3
4 Hi Mick,
5
6 > I am not overly familiar with networkmanager and the OP has not shared any
7 > screenshots or tab-by-tab NM settings, but had a look on a Gnome desktop
8 > and when hovering over the "Use only for resources on this connection"
9 > setting in the IPv4 Routes tab, it offers this tip:
10 >
11 > "If enabled, this connection will never be used as the default network
12 > connection."
13 >
14 > This tip alone hints that enabling it ought to create a split tunnel,
15 > for any subnets defined within this tab to be routed via the VPN, but
16 > everything else to be routed via the default route.
17
18 Agreed.
19
20 > When Hilco enabled it he obtained this route table:
21 >
22 > …
23 >
24 > The above does not offer him a route into the company's LAN and he cannot
25 > connect to the servers *.i.company.com.
26
27 Small nuance that routes don't deal with names and that names must be
28 translated to IPs. But that does require making sure there are routes
29 to the proper name server to do said translation.
30
31 > When the above setting is left disabled, then Hilco can access the company
32 > domain, but not the Internet - a full tunnel. His route table now shows
33 > tun0 as being the default NIC:
34
35 It seems like you're using "full tunnel" to mean that everything is
36 routed through the tunnel. Save for the VPN tunnel traffic itself.
37
38 I figured that's what you meant, but I wanted to ask and be sure.
39
40 > My understanding of a "split tunnel" or "split horizon" as you call it
41 > involves two routes:
42 >
43 > 1. Route for connections via the VPN tunnel:
44 >
45 > One route is used to direct datagrams from a local subnet or a virtual
46 > VPN IP allocated by the remote VPN gateway, e.g. $SOME_COMPANY_IP_1,
47 > via the VPN tunnel (tun0) to the remote company's LAN.
48 >
49 > 2. Route for all other connections, outside the VPN tunnel:
50 >
51 > A second route is typically the default route of the PC for all other
52 > connections and it is used to route datagrams outside the VPN tunnel.
53
54 Agreed. Though there may be more routes for additional subnets routed
55 through the VPN. This is what I think Hilco is wanting to do.
56
57 > Some VPN clients add a new routing policy rule table (e.g. strongswan),
58 > but others (e.g. racoon) add routes for the VPN tunnel in the main
59 > routing policy rule table.
60
61 I was not aware that any VPNs used alternate routing tables and rules to
62 use them. But that does make sense. Programmatically, that may be
63 simpler to maintain and clean up after the VPN is shut down too. I.e.
64 assume that anything in the routing table is for the VPN and safe to
65 remove, along with the single predictable rule referencing said table.
66
67 > In contrast, a "full tunnel" directs all outgoing datagrams from any
68 > local subnet via the VPN.
69
70 I agree at a high level. The nuanced nitpicks don't matter at this point.
71
72 > I appreciate what I describe above is inverse to what the setting "Use
73 > only for resources on this connection" is meant to do, but I merely go
74 > by the route tables Hilco has provided.
75
76 My not-yet-awake brain doesn't see the inverse issue that you're
77 referring to. But I'm used to dealing with VPNs, so maybe something is
78 instinctive for me.
79
80 > Hmm ... prompted by your question in this post I had to give it a second
81 > thought, and I've come up with this hypothesis:
82 >
83 > IF no specific subnet routes are defined on the NM routes tab AND the "Use
84 > only for resources on this connection" is selected, then it may be that
85 > networkmanager translates no subnet entry to mean 0.0.0.0/0 - ALL routes
86 > will be tunneled via the VPN, leaving nothing for the default route.
87
88 Using a (translated or not) route of "0.0.0.0/0" seems antithetical to
89 "Use only for resources on this connection".
90
91 > Without more information on NM's specific settings I'm not sure why
92 > routing is screwed up like this. :-)
93
94 I don't think it is screwed up. Enabling "Use only for resources on
95 this connection" doesn't change the default route. Disabling "Use only
96 for resources on this connection" does change the default route.
97
98 It does look like NetworkManager has the concept of additional routes
99 that should be routed through the VPN. However when hovering over the
100 box that I think you enter them in, "Editing IPv4 routes for VPN
101 connection $NAME", I get a tool tip balloon that says "IP addresses
102 identify your computer on the network. Click the Add button to add an
103 IP address.". Which makes one think the dialog box is for enter IP
104 addresses. However I suspect that's an artifact of how the dialog box
105 is constructed and re-using the same code as for entering IPs. The
106 Address, Netmask, Gateway, and Metric fields do sound like routes.
107 Though I question the wisdom of a static gateway in this case verses the
108 tunnel device.
109
110 > Nevertheless, adding a route manually for the remote LAN subnet as per
111 > my previous post should deliver a 'split tunnel/horizon', assuming the
112 > DNS nameservers are also somehow sorted out.
113
114 I suspect that the client needs to be directed to use the DNS servers on
115 the corporate LAN and ensure that their IPs / networks are also routed
116 through the LAN.
117
118 Or do something creative like run a local DNS server that knows to send
119 queries for company.com to a DNS server through the VPN.
120
121
122
123 --
124 Grant. . . .
125 unix || die

Replies

Subject Author
Re: [gentoo-user] Enable "regular" network traffic when using VPN Mick <michaelkintzios@×××××.com>