|
| 1 | +--- |
| 2 | +description: How to configure IPv6 using Tunnelbroker on your VPS. |
| 3 | +--- |
| 4 | + |
| 5 | +This how-to is for super-newbie and may depend on your system's OS, but it has already been tested on `Ubuntu (22, 23 and 24)` with `netplan`. |
| 6 | + |
| 7 | +### Hello Tunnelbroker! |
| 8 | + |
| 9 | +1. Create an account at [Tunnelbroker](https://tunnelbroker.net) |
| 10 | +2. Create a new `Create Regular Tunnel` |
| 11 | +3. Enter your server IPv4 and select the Tunnelbroker server with the lowest ping to your server. `ping xxx.xxx.xxx.xxx` |
| 12 | +4. (Optional) Get IPv6 /48 block by clicking `assign /48` |
| 13 | +5. Go to `Example Configurations` |
| 14 | +6. Select `Linux (netplan 0.103+)` |
| 15 | +7. Copy the whole config |
| 16 | + |
| 17 | +[WARNING] `xxxx` or `xxx` for example: `2001:470:xxxx:xxx::2/64` is just for censoring real information PLEASE REPLACE IT WITH YOUR IPV6 |
| 18 | + |
| 19 | +Example configuration generated from tunnelbroker.net |
| 20 | +```yml |
| 21 | +network: |
| 22 | + version: 2 |
| 23 | + tunnels: |
| 24 | + he-ipv6: |
| 25 | + mode: sit |
| 26 | + remote: 216.218.142.50 |
| 27 | + local: 195.xxx.xx.xxx |
| 28 | + addresses: |
| 29 | + - "2001:470:xxxx:xxx::2/64" |
| 30 | + routes: |
| 31 | + - to: default |
| 32 | + via: "2001:470:xxxx:xxx::1" |
| 33 | +``` |
| 34 | +
|
| 35 | +On your server, go to the netplan folder: `cd /etc/netplan` |
| 36 | + |
| 37 | +Create a new file using your choice of text editor, but in this how-to, we will be using nano. |
| 38 | +`nano 99-he-tunnel.yaml` |
| 39 | + |
| 40 | +Then paste the whole configuration into that file. |
| 41 | + |
| 42 | +Example configuration of 99-he-tunnel.yaml with /64 |
| 43 | +``` |
| 44 | +network: |
| 45 | + version: 2 |
| 46 | + tunnels: |
| 47 | + he-ipv6: |
| 48 | + mode: sit |
| 49 | + remote: 216.218.142.50 |
| 50 | + local: 195.xxx.xx.xxx |
| 51 | + addresses: |
| 52 | + - "2001:470:xxxx:xxx::2/64" |
| 53 | + routes: |
| 54 | + - to: default |
| 55 | + via: "2001:470:xxxx:xxx::1" |
| 56 | +``` |
| 57 | +
|
| 58 | +Example configuration of 99-he-tunnel.yaml with /48 |
| 59 | +``` |
| 60 | +network: |
| 61 | + version: 2 |
| 62 | + tunnels: |
| 63 | + he-ipv6: |
| 64 | + mode: sit |
| 65 | + remote: 216.218.142.50 |
| 66 | + local: 195.xxx.xx.xxx |
| 67 | + addresses: |
| 68 | + - "2001:470:xxxx::2/48" |
| 69 | + routes: |
| 70 | + - to: default |
| 71 | + via: "2001:470:xxxx::1" |
| 72 | +``` |
| 73 | +
|
| 74 | +### [Optional] You already had IPv6 but still want to use Tunnelbroker. |
| 75 | +Most hosting providers will have an OS image that is generated configuration called `50-cloud-init.yaml`. |
| 76 | +
|
| 77 | +Start edit that file: `nano 50-cloud-init.yaml` |
| 78 | +
|
| 79 | +Example configuration from 50-cloud-init.yaml |
| 80 | +``` |
| 81 | +network: |
| 82 | + ethernets: |
| 83 | + ens3: |
| 84 | + addresses: |
| 85 | + - 195.xxx.xx.xxx/23 |
| 86 | + - 2402:xxxx:xxxx::xx/128 |
| 87 | + - 2402:xxxx:xxxx:xxxx::a/56 |
| 88 | + gateway4: 195.xxx.xx.x |
| 89 | + gateway6: 2402:xxxx:xxxx::1 |
| 90 | + match: |
| 91 | + macaddress: 00:34:a0:e1:de:5d |
| 92 | + nameservers: |
| 93 | + addresses: |
| 94 | + - 8.8.8.8 |
| 95 | + - 8.8.4.4 |
| 96 | + - 2001:4860:4860::8888 |
| 97 | + - 2001:4860:4860::8844 |
| 98 | + routes: |
| 99 | + - scope: link |
| 100 | + to: 195.xxx.xx.x |
| 101 | + via: 0.0.0.0 |
| 102 | + - scope: link |
| 103 | + to: 2402:xxxx:xxxx::1 |
| 104 | + via: ::0 |
| 105 | + version: 2 |
| 106 | +``` |
| 107 | +
|
| 108 | +We will be removing |
| 109 | +``` |
| 110 | + addresses: |
| 111 | + - 195.xxx.xx.xxx/23 |
| 112 | + - 2402:xxxx:xxxx::xx/128 <--- |
| 113 | + - 2402:xxxx:xxxx:xxxx::a/56 <--- |
| 114 | + gateway4: 195.xxx.xx.x |
| 115 | + gateway6: 2402:xxxx:xxxx::1 <--- |
| 116 | +``` |
| 117 | +
|
| 118 | +And |
| 119 | +``` |
| 120 | + - scope: link <--- |
| 121 | + to: 2402:xxxx:xxxx::1 <--- |
| 122 | + via: ::0 <--- |
| 123 | +``` |
| 124 | +
|
| 125 | +Final configuration |
| 126 | +``` |
| 127 | +network: |
| 128 | + ethernets: |
| 129 | + ens3: |
| 130 | + addresses: |
| 131 | + - 195.xxx.xx.xxx/23 |
| 132 | + gateway4: 195.xxx.xx.x |
| 133 | + match: |
| 134 | + macaddress: 00:34:a0:e1:de:5d |
| 135 | + nameservers: |
| 136 | + addresses: |
| 137 | + - 8.8.8.8 |
| 138 | + - 8.8.4.4 |
| 139 | + - 2001:4860:4860::8888 |
| 140 | + - 2001:4860:4860::8844 |
| 141 | + routes: |
| 142 | + - scope: link |
| 143 | + to: 195.xxx.xx.x |
| 144 | + via: 0.0.0.0 |
| 145 | + version: 2 |
| 146 | +``` |
| 147 | +
|
| 148 | +### Applying netplan and checking your IPv6 |
| 149 | +
|
| 150 | +Let try our new configuration: `netplan try` |
| 151 | +
|
| 152 | +Ignore the warning and if there is no error then just press enter to accept new configuration. |
| 153 | +
|
| 154 | +Reboot server one time: `reboot` |
| 155 | +
|
| 156 | +Try your IPv6 from Tunnelbroker: `ping6 google.com` |
| 157 | +Try curl to make sure that it is Tunnelbroker IPv6: `curl -6 https://ifconfig.co` |
| 158 | +And it should return `2001:470:xxxx:xxx::2` or `2001:470:xxxx::2` if you are using /48 |
| 159 | +
|
| 160 | +Next, we're going to configure IPv6 for Lavalink. |
| 161 | +Enable non local binding |
| 162 | +`sysctl -w net.ipv6.ip_nonlocal_bind=1` |
| 163 | +And so the next time you don't need to type it again |
| 164 | +`echo 'net.ipv6.ip_nonlocal_bind = 1' >> /etc/sysctl.conf` |
| 165 | +
|
| 166 | +Now, we replace this command with our IPv6 from Tunnelbroker. |
| 167 | +`ip -6 route replace local 2001:470:xxxx:xxx::/64 dev lo` |
| 168 | +or if you are using /48 |
| 169 | +`ip -6 route replace local 2001:470:xxxx::/48 dev lo` |
| 170 | +
|
| 171 | +Now test your new configuration |
| 172 | +```cmd |
| 173 | +ping6 -I 2001:470:xxxx:xxx:dead::beef google.com |
| 174 | +``` |
| 175 | +or if you are using /48 |
| 176 | +```cmd |
| 177 | +ping6 -I 2001:470:xxxx:dead::beef google.com |
| 178 | +``` |
| 179 | + |
| 180 | +Now you can use your new IPv6 `2001:470:xxxx:xxx::/64` or `2001:470:xxxx::/48` to put in your Lavalink configuration. |
0 commit comments