Project

General

Profile

Ungleich IPv6 wireguard VPN » History » Version 3

Timothée Floure, 02/18/2020 02:41 PM
Add setup instructions for NAT64

1 1 Timothée Floure
h1. Ungleich IPv6 wireguard VPN
2
3
{{toc}}
4
5
*%{color:red}This document only concerns VPN clients and is intended for end-users/customers. See [[The ungleich VPN infrastructure]] page for server-side documentation.%*
6
7
h2. Status
8
9
This document is *IN PRODUCTION*.
10
11
h2. How to get VPN
12
13
* If you are a VM users of DataCenterLight, you get it for free
14
* Otherwise you can book it at https://IPv6VPN.ch
15
* In both cases, send a request to support at ungleich.ch
16
17
Technically, the following steps are necessary:
18
19
<pre>
20
1. Install Wireguard
21
 https://www.wireguard.com/install/
22
23
2. Create your private key:
24
 umask 077; wg genkey > privkey
25
26
3. Get your public key
27
  wg pubkey < privkey
28
29
4. Send us the pubkey
30
</pre>
31
32
If you want to be fast, you can already take these steps before contacting support.
33
34
35
h2. Security of IPv6 vs. NAT
36
37
A quick reminder: whether you are using private RFC1918 IPv4 addresses or IPv6 addresses, if you don't want people to access your network, you need to configure a firewall.
38
39 3 Timothée Floure
h2. Proxy all traffic (IPv6 + NAT64 for IPv4) via the VPN
40 2 Timothée Floure
41
It is possible to forward (almost) all traffic to the ungleich VPN by using our DNS64 resolvers. You can do so by configuring 2a0a:e5c0:2:12:0:f0ff:fea9:c451 (unbound1.place6.ungleich.ch) and 2a0a:e5c0:2:12:0:f0ff:fea9:c45d (unbound2.place6.ungleich.ch) as DNS servers when connected to the VPN.
42
43
It will:
44
45
* Use those two servers (via the VPN) for "DNS":https://en.wikipedia.org/wiki/Domain_Name_System traffic.
46
* Route all traffic to domain names (resolved by any of the two DNS servers) via the VPN.
47
48
It won't:
49
50
* Route traffic to specific IP addresses (= bypassing DNS) via the VPN.
51
* Route traffic from application using their own DNS resolving system (e.g. Firefox with DNS-over-HTTPS enabled).
52
53
h3. Setup instruction
54 1 Timothée Floure
55 3 Timothée Floure
It's dead-simple! You only have to add the following lines to the @[Interface]@ section (just below (@ListenPort = 51280@) of your wireguard configuration:
56
57
<pre>
58
DNS = 2a0a:e5c0:2:12:0:f0ff:fea9:c451
59
DNS = 2a0a:e5c0:2:12:0:f0ff:fea9:c45d
60
</pre>
61 2 Timothée Floure
62 1 Timothée Floure
h2. Wireguard VPN on vpn-2a0ae5c1.ungleich.ch
63
64
* Server: vpn-2a0ae5c1.ungleich.ch
65
* Port: 51820
66
* Requires a public key
67
* Client network: 2a0a:e5c1:100::/40
68
* Client network size: /48
69
70
h3. Sample clustomer client configuration
71
72
* "Install wireguard":https://www.wireguard.com/install/
73
* Create your private key: @umask 077; wg genkey > privkey@
74
* Get your public key: @wg pubkey < privkey@
75
** You need to send this pubkey to ungleich
76
* You will get your network definition after we have received your public key
77
* Create /etc/wireguard/wg0.conf
78
79
<pre>
80
[Interface]
81
PrivateKey = YOURKEYHERE
82
Address = YOURIPv6IPADDRESSHERE/48
83
ListenPort = 51280
84
85
[Peer]
86
PublicKey = hi60lGP+xEUQ+kVnqA7PlJAO1SVqTS1W36g0LhFP0xQ=
87
Endpoint = vpn-2a0ae5c1.ungleich.ch:51820
88
AllowedIPs = ::/0
89
</pre>
90
91
* *ONLY change* the PrivateKey and the Address entries.
92
* *ALL other entries* (especially PublicKey, Endpoint and AllowedIPs) need to *stay as is*
93
94
h3. How to setup the VPN (the easy way)
95
96
Once you have created the configuration, you can simply call
97
98
<pre>
99
wg-quick up wg0
100
</pre>
101
102
And to stop the VPN, you can use
103
104
<pre>
105
wg-quick down wg0
106
</pre>
107
108
109
h3. How to setup the VPN (the manual way)
110
111
112
Commands for setting it up
113
114
<pre>
115
MY_NET=2a0a:e5c1:XXXX::1/48
116
117
ip link add dev wg0 type wireguard
118
119
# Replace with your range
120
ip addr add $MY_NET dev wg0
121
122
# Add routing
123
ip route add 2a0a:e5c1::/32 dev wg0
124
ip route add ::/0 via 2a0a:e5c1:100::1
125
126
# Configure the interface
127
wg setconf wg0 /etc/wireguard/wg0.conf
128
129
# Bring it up
130
ip link set wg0 up
131
</pre>
132
133
h3. About usable IPv6 addresses
134
135
We route a /48 to everyone. Even though technically possible, you should not use the *zero address* of your network, as it is reserved for reaching all routers.
136
I.e. if your IPv6 network was 2a0a:e5c1:101::/48, don't use 2a0a:e5c1:101::. The reason for this is that all routers (devices that have ip forwarding enabled) for this network
137
are supposed to answer on this address.
138
139
In other words, in your wg0.conf use:
140
141
<pre>
142
[Interface]
143
...
144
Address = 2a0a:e5c1:101::42/48
145
</pre>
146
147
Do *NOT* use:
148
149
<pre>
150
[Interface]
151
...
152
# Don't use this
153
Address = 2a0a:e5c1:101::/48
154
</pre>
155
156
157
h3. How to debug
158
159
* wg show # Show configuration
160
* ping 2a0a:e5c1:100::1 # Try to ping the gateway
161
162
If you want to send us your configuration, you should remove your private key from wg0.conf.
163
Under Linux/BSD/MacOS you can do that as follows:
164
165
<pre>
166
cat /etc/wireguard/wg0.conf  | sed 's/\(PrivateKey =\).*/\1 MYPRIVATEKEY/'
167
</pre>
168
169
The result could look as follows:
170
171
<pre>
172
root@line:~# cat /etc/wireguard/wg0.conf  | sed 's/\(PrivateKey =\).*/\1 MYPRIVATEKEY/'
173
[Interface]
174
PrivateKey = MYPRIVATEKEY
175
ListenPort = 51280
176
Address = 2a0a:e5c1:101::42/48
177
#DNS = 2a0a:e5c0::3, 2a0a:e5c0::4
178
179
[Peer]
180
PublicKey = hi60lGP+xEUQ+kVnqA7PlJAO1SVqTS1W36g0LhFP0xQ=
181
Endpoint = vpn-2a0ae5c1.ungleich.ch:51820
182
AllowedIPs = ::/0
183
</pre>
184
185
h3. How to config wireguard on mobile phone(android / ios)
186
187
<pre>
188
You should fill out DNS field.
189
ex) for ipv6 DNS ==> 2a0a:e5c0::3 or 2a0a:e5c0::4
190
and you should assgin phone own IP.
191
ex) laptop Address = 2a0a:e5c1:101::42/48
192
    phone Address = 2a0a:e5c1:101::43/48
193
another things are same as client's configutaion.
194
</pre>
195
196
h3. How to config IPv6 DNS on wireguard(if it can't find DNS)
197
198
<pre>
199
You should fill out DNS field.
200
ex) for ipv6 DNS ==> 2a0a:e5c0::3 or 2a0a:e5c0::4
201
DNS = 2a0a:e5c0::3
202
</pre>
203
204
h3. How to config wireguard manually on Mac OS without APP(for using IPv4 and IPv6 at the same time) 
205
206
<pre>
207
1) install wireguard on macOS
208
- brew install wireguard-tools
209
210
2)find wireguard install location
211
- cd /usr/local/etc/wireguard
212
213
3) create wg0.conf in wireguard location(refer to above)
214
215
4) run wireguard
216
- wg-quick up  wg0
217
</pre>
218
219
h2. OpenVPN on openvpn.ungleich.ch
220
221
* Server: openvpn.ungleich.ch
222
* Port: 1195
223
* Requires a certificate
224
* Address range: 2a0a:e5c0:3::/48
225
** Client networks are /64
226
227
*END OF LIFE by 2019-06-30*