Ungleich IPv6 wireguard VPN » History » Version 2
Timothée Floure, 01/20/2020 05:25 PM
Add DNS64 info to proxy all trffic via VPN
| 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 | 2 | Timothée Floure | h2. Proxy all traffic via the VPN |
| 40 | |||
| 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 | |||
| 55 | That section is not written yet, see #7560. |
||
| 56 | |||
| 57 | 1 | Timothée Floure | h2. Wireguard VPN on vpn-2a0ae5c1.ungleich.ch |
| 58 | |||
| 59 | * Server: vpn-2a0ae5c1.ungleich.ch |
||
| 60 | * Port: 51820 |
||
| 61 | * Requires a public key |
||
| 62 | * Client network: 2a0a:e5c1:100::/40 |
||
| 63 | * Client network size: /48 |
||
| 64 | |||
| 65 | h3. Sample clustomer client configuration |
||
| 66 | |||
| 67 | * "Install wireguard":https://www.wireguard.com/install/ |
||
| 68 | * Create your private key: @umask 077; wg genkey > privkey@ |
||
| 69 | * Get your public key: @wg pubkey < privkey@ |
||
| 70 | ** You need to send this pubkey to ungleich |
||
| 71 | * You will get your network definition after we have received your public key |
||
| 72 | * Create /etc/wireguard/wg0.conf |
||
| 73 | |||
| 74 | <pre> |
||
| 75 | [Interface] |
||
| 76 | PrivateKey = YOURKEYHERE |
||
| 77 | Address = YOURIPv6IPADDRESSHERE/48 |
||
| 78 | ListenPort = 51280 |
||
| 79 | |||
| 80 | [Peer] |
||
| 81 | PublicKey = hi60lGP+xEUQ+kVnqA7PlJAO1SVqTS1W36g0LhFP0xQ= |
||
| 82 | Endpoint = vpn-2a0ae5c1.ungleich.ch:51820 |
||
| 83 | AllowedIPs = ::/0 |
||
| 84 | </pre> |
||
| 85 | |||
| 86 | * *ONLY change* the PrivateKey and the Address entries. |
||
| 87 | * *ALL other entries* (especially PublicKey, Endpoint and AllowedIPs) need to *stay as is* |
||
| 88 | |||
| 89 | h3. How to setup the VPN (the easy way) |
||
| 90 | |||
| 91 | Once you have created the configuration, you can simply call |
||
| 92 | |||
| 93 | <pre> |
||
| 94 | wg-quick up wg0 |
||
| 95 | </pre> |
||
| 96 | |||
| 97 | And to stop the VPN, you can use |
||
| 98 | |||
| 99 | <pre> |
||
| 100 | wg-quick down wg0 |
||
| 101 | </pre> |
||
| 102 | |||
| 103 | |||
| 104 | h3. How to setup the VPN (the manual way) |
||
| 105 | |||
| 106 | |||
| 107 | Commands for setting it up |
||
| 108 | |||
| 109 | <pre> |
||
| 110 | MY_NET=2a0a:e5c1:XXXX::1/48 |
||
| 111 | |||
| 112 | ip link add dev wg0 type wireguard |
||
| 113 | |||
| 114 | # Replace with your range |
||
| 115 | ip addr add $MY_NET dev wg0 |
||
| 116 | |||
| 117 | # Add routing |
||
| 118 | ip route add 2a0a:e5c1::/32 dev wg0 |
||
| 119 | ip route add ::/0 via 2a0a:e5c1:100::1 |
||
| 120 | |||
| 121 | # Configure the interface |
||
| 122 | wg setconf wg0 /etc/wireguard/wg0.conf |
||
| 123 | |||
| 124 | # Bring it up |
||
| 125 | ip link set wg0 up |
||
| 126 | </pre> |
||
| 127 | |||
| 128 | h3. About usable IPv6 addresses |
||
| 129 | |||
| 130 | 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. |
||
| 131 | 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 |
||
| 132 | are supposed to answer on this address. |
||
| 133 | |||
| 134 | In other words, in your wg0.conf use: |
||
| 135 | |||
| 136 | <pre> |
||
| 137 | [Interface] |
||
| 138 | ... |
||
| 139 | Address = 2a0a:e5c1:101::42/48 |
||
| 140 | </pre> |
||
| 141 | |||
| 142 | Do *NOT* use: |
||
| 143 | |||
| 144 | <pre> |
||
| 145 | [Interface] |
||
| 146 | ... |
||
| 147 | # Don't use this |
||
| 148 | Address = 2a0a:e5c1:101::/48 |
||
| 149 | </pre> |
||
| 150 | |||
| 151 | |||
| 152 | h3. How to debug |
||
| 153 | |||
| 154 | * wg show # Show configuration |
||
| 155 | * ping 2a0a:e5c1:100::1 # Try to ping the gateway |
||
| 156 | |||
| 157 | If you want to send us your configuration, you should remove your private key from wg0.conf. |
||
| 158 | Under Linux/BSD/MacOS you can do that as follows: |
||
| 159 | |||
| 160 | <pre> |
||
| 161 | cat /etc/wireguard/wg0.conf | sed 's/\(PrivateKey =\).*/\1 MYPRIVATEKEY/' |
||
| 162 | </pre> |
||
| 163 | |||
| 164 | The result could look as follows: |
||
| 165 | |||
| 166 | <pre> |
||
| 167 | root@line:~# cat /etc/wireguard/wg0.conf | sed 's/\(PrivateKey =\).*/\1 MYPRIVATEKEY/' |
||
| 168 | [Interface] |
||
| 169 | PrivateKey = MYPRIVATEKEY |
||
| 170 | ListenPort = 51280 |
||
| 171 | Address = 2a0a:e5c1:101::42/48 |
||
| 172 | #DNS = 2a0a:e5c0::3, 2a0a:e5c0::4 |
||
| 173 | |||
| 174 | [Peer] |
||
| 175 | PublicKey = hi60lGP+xEUQ+kVnqA7PlJAO1SVqTS1W36g0LhFP0xQ= |
||
| 176 | Endpoint = vpn-2a0ae5c1.ungleich.ch:51820 |
||
| 177 | AllowedIPs = ::/0 |
||
| 178 | </pre> |
||
| 179 | |||
| 180 | h3. How to config wireguard on mobile phone(android / ios) |
||
| 181 | |||
| 182 | <pre> |
||
| 183 | You should fill out DNS field. |
||
| 184 | ex) for ipv6 DNS ==> 2a0a:e5c0::3 or 2a0a:e5c0::4 |
||
| 185 | and you should assgin phone own IP. |
||
| 186 | ex) laptop Address = 2a0a:e5c1:101::42/48 |
||
| 187 | phone Address = 2a0a:e5c1:101::43/48 |
||
| 188 | another things are same as client's configutaion. |
||
| 189 | </pre> |
||
| 190 | |||
| 191 | h3. How to config IPv6 DNS on wireguard(if it can't find DNS) |
||
| 192 | |||
| 193 | <pre> |
||
| 194 | You should fill out DNS field. |
||
| 195 | ex) for ipv6 DNS ==> 2a0a:e5c0::3 or 2a0a:e5c0::4 |
||
| 196 | DNS = 2a0a:e5c0::3 |
||
| 197 | </pre> |
||
| 198 | |||
| 199 | h3. How to config wireguard manually on Mac OS without APP(for using IPv4 and IPv6 at the same time) |
||
| 200 | |||
| 201 | <pre> |
||
| 202 | 1) install wireguard on macOS |
||
| 203 | - brew install wireguard-tools |
||
| 204 | |||
| 205 | 2)find wireguard install location |
||
| 206 | - cd /usr/local/etc/wireguard |
||
| 207 | |||
| 208 | 3) create wg0.conf in wireguard location(refer to above) |
||
| 209 | |||
| 210 | 4) run wireguard |
||
| 211 | - wg-quick up wg0 |
||
| 212 | </pre> |
||
| 213 | |||
| 214 | h2. OpenVPN on openvpn.ungleich.ch |
||
| 215 | |||
| 216 | * Server: openvpn.ungleich.ch |
||
| 217 | * Port: 1195 |
||
| 218 | * Requires a certificate |
||
| 219 | * Address range: 2a0a:e5c0:3::/48 |
||
| 220 | ** Client networks are /64 |
||
| 221 | |||
| 222 | *END OF LIFE by 2019-06-30* |