Gentoo Archives: gentoo-user

From: Mick <michaelkintzios@×××××.com>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] Enable "regular" network traffic when using VPN
Date: Sat, 09 Jun 2018 11:22:04
Message-Id: 9688488.tJC6naXaEd@dell_xps
In Reply to: Re: [gentoo-user] Enable "regular" network traffic when using VPN by Hilco Wijbenga
1 On Saturday, 9 June 2018 01:20:18 BST Hilco Wijbenga wrote:
2 > On Fri, Jun 8, 2018 at 4:34 PM Mick <michaelkintzios@×××××.com> wrote:
3 > > On Friday, 8 June 2018 23:21:52 BST Grant Taylor wrote:
4 > > > On 06/08/2018 03:31 PM, Hilco Wijbenga wrote:
5 > > > > Sigh, I take it back. That causes the internal sites to no longer
6 > > > > work.
7 > > >
8 > > > Okay.
9 > > >
10 > > > So you're on the proper track.
11 > > >
12 > > > I'm guessing the work network isn't a simple single prefix. Or at least
13 > > > the VPN client doesn't route enough through the VPN.
14 > > >
15 > > > Check your routing table with the VPN connected. Is enough being routed
16 > > > through? Do you need to add additional prefixes?
17 > > >
18 > > > If DNS is working properly for internal resources, make sure that what
19 > > > they resolve to is routed through the VPN.
20 > >
21 > > I don't know what networkmanager offers in terms of VPN settings, but as
22 > > Grant says you need to set split routing. As it currently is, everything
23 > > is sent out through the tunnel and your work's router is not set up to
24 > > route out to the Internet your VPN connection.
25 > >
26 > > If networkmanager does not get you what you want, you can do this with 'ip
27 > > route'. Delete the default route, then set again the default route via
28 > > the
29 > > your local gateway:
30 > >
31 > > # ip route del default via 192.168.1.254 dev wlan0
32 > > # ip route add default via 192.168.1.254 dev wlan0
33 > >
34 > > then create an additional route for the remote subnet if it's not there:
35 > >
36 > > # ip route add 10.10.20.0/24 via 172.16.1.1 dev wlan0
37 > >
38 > > Where 10.10.20.0/24 is your work's subnet and 172.16.1.1 is the local VPN
39 > > IP address for your PC. Something along these lines ought to work.
40 >
41 > I fooled around with "ip" but while removing ("del default") was easy,
42 > "add default" did not seem to do anything.
43 >
44 > Let me give some more information, perhaps that will help.
45 >
46 > Setup without VPN
47 > $ ip route
48 > default via 192.168.151.1 dev eth0 proto static metric 100
49 > 127.0.0.0/8 via 127.0.0.1 dev lo
50 > 192.168.151.0/24 dev eth0 proto kernel scope link src 192.168.151.103 metric
51 > 100
52 >
53 > (192.168.151.1 is my own gateway, an old computer functioning as router)
54 >
55 >
56 > Setup with VPN (Gateway: vpn.company.com; Other DNS Servers:
57 > dns1,dns2; Search Domains:
58 > r1.i.company.com,r2.i.company.com,r3.i.company.com,r4.i.company.com,r5.i.com
59 > pany.com,r6.i.company.com,r7.i.company.com,r8.i.company.com,i.company.com,co
60 > nfig) $ ip route
61 > default via 192.168.151.1 dev eth0 proto static metric 100
62 > $SOME_COMPANY_IP_1 dev tun0 proto kernel scope link src
63 > $SOME_COMPANY_IP_1 metric 50
64
65 You can try adding a route against this link so the first IP is a subnet for
66 your connection to the remote LAN. If for example $SOME_COMPANY_IP_1 is
67 192.168.10.5 you can try:
68
69 # ip route add 192.168.10.0/24 via 192.168.10.5 dev tun0
70
71
72 > 127.0.0.0/8 via 127.0.0.1 dev lo
73 > 192.168.151.0/24 dev eth0 proto kernel scope link src 192.168.151.103 metric
74 > 100 192.168.151.1 dev eth0 proto static scope link metric 100
75 > $VPN_GATEWAY via 192.168.151.1 dev eth0 proto static metric 100
76 >
77 > (where $SOME_COMPANY_IP is the IP of some internal server, and
78
79 I think you'll find $SOME_COMPANY_IP_1 is the remote LAN IP address offered by
80 the company's VPN gateway to your PC, so that you can connect to the company's
81 LAN subnet.
82
83
84 > $VPN_GATEWAY is the IP of vpn.company.com).
85 > ==> This does _not_ allow me to access (e.g.) *.i.company.com but
86 > everything else works fine.
87 >
88 >
89 > Same setup but without "Use only for resources on this connection":
90 > $ ip route
91 > default dev tun0 proto static scope link metric 50
92 > default via 192.168.151.1 dev eth0 proto static metric 100
93 > $SOME_COMPANY_IP_2 dev tun0 proto kernel scope link src
94 > $SOME_COMPANY_IP_2 metric 50
95 > 127.0.0.0/8 via 127.0.0.1 dev lo
96 > 192.168.151.0/24 dev eth0 proto kernel scope link src 192.168.151.103 metric
97 > 100 192.168.151.1 dev eth0 proto static scope link metric 100
98 > $VPN_GATEWAY via 192.168.151.1 dev eth0 proto static metric 100
99 >
100 > (note that $SOME_COMPANY_IP_1 and $SOME_COMPANY_IP_2 differ only in
101 > the last digit; this seems to go up by one every time I connect to
102 > VPN, so probably irrelevant)
103
104 The company's VPN gateway will increment new VPN connections giving them the
105 next IP address allocated to the VPN pool. When you disconnect your client,
106 the VPN gateway ought to tear down the connection and release the IP address,
107 but this does not happen instantaneously in most implementations in case the
108 disconnection is temporary. So this is to be expected.
109
110
111 > ==> This allows me to access *.i.company.com but breaks everything else.
112
113 It would do so, because everything is sent out the default device tun0 and
114 your company's firewall will not route connections from your VPN allocated LAN
115 address to the Internet. Just curious, does it allow you to connect to the
116 Internet AND your company's LAN, if while under this set up you run:
117
118 # ip route del default via 192.168.151.1 dev eth0
119 # ip route add default via 192.168.151.1 dev eth0
120
121 This would add the default via 192.168.151.1 above your default dev tun0.
122
123 > What would be the "correct" output for "ip route"?
124
125 It depends on the platform, VPN client and its configuration. I don't have a
126 VPN configured at present to compare.
127
128 --
129 Regards,
130 Mick

Attachments

File name MIME type
signature.asc application/pgp-signature

Replies

Subject Author
Re: [gentoo-user] Enable "regular" network traffic when using VPN Hilco Wijbenga <hilco.wijbenga@×××××.com>