Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add note about persist: false to cookbook #243

Merged
merged 2 commits into from
Jul 8, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 21 additions & 4 deletions docs/cookbook.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ To use, make sure that you're either using
`:vintage_net_ethernet` in your deps:

```elixir
{:vintage_net_ethernet, "~> 0.7"}
{:vintage_net_ethernet, "~> 0.8"}
```

### Wired Ethernet with DHCP
Expand Down Expand Up @@ -100,10 +100,9 @@ To use, make sure that you're either using
`:vintage_net_wifi` in your deps:

```elixir
{:vintage_net_wifi, "~> 0.7"}
{:vintage_net_wifi, "~> 0.8"}
```


### Normal password-protected WiFi (WPA2 PSK)

Most password-protected home networks use WPA2 authentication and pre-shared
Expand Down Expand Up @@ -191,7 +190,10 @@ configuration.

### Share WAN with other networks

For sharing your WANs connection (e.g. internet access) with other networks `iptables` must be installed. Currently this means building a [custom nerves system](https://hexdocs.pm/nerves/customizing-systems.html). Once this is done the following commands need to be called on each boot:
For sharing your WAN connection (e.g. internet access) with other networks
`iptables` must be installed. Currently this means building a [custom nerves
system](https://hexdocs.pm/nerves/customizing-systems.html). Once this is done
the following commands need to be called on each boot:

```elixir
wan = "eth0"
Expand All @@ -200,3 +202,18 @@ cmd "iptables -t nat -A POSTROUTING -o #{wan} -j MASQUERADE"
# Only needed if the connection is blocked otherwise (like a default policy of DROP)
cmd "iptables -A INPUT -i #{wan} -m state --state RELATED,ESTABLISHED -j ACCEPT"
```

## Common tasks

### Temporarily disable WiFi

`VintageNet` persists configurations by default. Sometimes you just want to
disable a network temporarily and then if the device reboots, it reboots to the
old configuration. The `:persist` option let's you do this:

```elixir
VintageNet.deconfigure("wlan0", persist: false)
```

To get the old configuration back, you have to call `VintageNet.configure/3`
with it again (or restart `VintageNet` or reboot).