Skip to content

Instantly share code, notes, and snippets.

@Juul
Last active January 25, 2018 00:55
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Juul/957855bb5841100109eaeb90e8c6b01b to your computer and use it in GitHub Desktop.
Save Juul/957855bb5841100109eaeb90e8c6b01b to your computer and use it in GitHub Desktop.
# add a new client mode wifi interface
Edit `/etc/config/wireless` adding a section like this:
```
config wifi-iface
option device 'radio0'
option ifname 'cli0'
option network 'cwan'
option encryption 'psk2'
option key 'my-password'
option mode 'sta'
option ssid 'my-ssid'
```
and set `ssid` to the SSID of the AP you want to use for internet and `key` to the password for that AP. If you're connecting to an AP with no password then set `encryption` to `'none'`.
For the `device` option use `radio0` if you want to use the 2.4 GHz to connect to the AP or use `radio1` if you want to use 5 GHz.
# change the radio's channel
Now find the section called either `config wifi-device 'radio0'` or `config wifi-device 'radio1'` depending on which radio you used. In that section change the channel to the channel used by the AP you want to use for internet, e.g:
```
option channel `11`
```
You can test this immediately. Run the command `wifi` then use the command `ip dev cli0 link` to check if your home node is successfully associating to the AP. It might take up to maybe 20 seconds before it connects.
# tell the new wifi interface to use dhcp
Now edit `/etc/config/network` changing the section:
```
config interface 'cwan'
option ifname 'cli0'
option proto 'dhcp'
```
# tell dnsmasq not to run on the interface
Edit `/etc/dnsmasq.conf` adding the line:
```
except-interface=cli0
```
Now you can reload the network configuration using:
```
/etc/init.d/network reload
```
After maybe 20 seconds your `cli0` interface should have gotten an IP from the DHCP server via the AP. You can check if it has an ip using:
```
ip addr show dev cli0
```
# tell tunneldigger to use the wifi interface
Edit `/etc/config/tunneldigger` changing the line:
```
option bind_to_interface 'eth1'
```
to:
```
option bind_to_interface 'cli0'
```
You will not be able to test this until after completing this guide and rebooting.
# tell the mesh routing scripts to use `cli0` as the WAN interface
Edit `/etc/sudomesh/mynet_n` changing the line:
```
WAN=eth1
```
to:
```
WAN=cli0
```
That should be it. Now reboot and see if it works.
You can test it the tunnel comes up checking if the `l2tp0` interface appears:
```
ip link show l2tp0
```
This can take up to a minute after rebooting the router.
You can check that the `l2tp0` interface has an IP using:
```
ip addr show dev l2tp0
```
If you use `ping` to test if stuff works then remember that the routers use two routing tables. You can show the table used for private network routing using:
```
ip route show
```
and the table used for public network routing using:
```
ip route show table public
```
The `ping` command will default to the private table. If you want to know if there is internet on the public network you can use:
```
ping -I br-open <ip>
```
If you want to see if `babel` (the mesh routing protocol) is working then use the command:
```
babeld -i
```
and you should see a bunch of other mesh IPs.
@jhpoelen
Copy link

@Juul - thanks for writing this. I am now getting a node connected via calyx hotspot

@jhpoelen
Copy link

would be cool to include this in makenode some day . . .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment