Update documentation for a static IPV4 address via nmcli (#199)

* Update documentation for a static IPV4 address via nmcli

This update documents a method to change to a Static IPV4 address using the NetworkManager CLI (nmcli).

Happy for the formatting to be modified to suit local convention.

I cannot be more specific about how to get into the base OS as I don't know!

* Additional nmcli commands for dns and gateway

I found that there is a need to add in the dns and gateway IP addresses otherwise there was no route out.  I note there are a number of issues alive re this routing problem e.g. https://github.com/home-assistant/home-assistant/issues/15221

* Update network.md
This commit is contained in:
borpin 2018-09-20 10:48:57 +01:00 committed by Pascal Vizeli
parent 55cc60fc8e
commit ad9f21fdfb

View File

@ -97,6 +97,44 @@ If you have trouble with powersave you can do following:
# Values are 0 (use default), 1 (ignore/don't touch), 2 (disable) or 3 (enable).
powersave=0
```
## Using nmcli to set a static IPV4 address
Log into the HASSOS base system via a console:
```
Welcome to HassOS
Hassio login:
```
Login as `root` (no password needed)
At the `hassio >` prompt, type `login` (as instructed).
From here you will use the `nmcli` configuration tool.
`# nmcli connection show` will list the “HassOS default” connection in use.
`# nmcli con show "HassOS default"` will list all the properties of the connection.
`# nmcli con edit “HassOS default”` will put you in a position to edit the connection.
`nmcli> print ipv4` will show you the ipv4 properties of this connection.
To add your static IP address (select 'yes' for manual method);
```
nmcli> set ipv4.addresses 192.168.100.10/24
Do you also want to set 'ipv4.method' to 'manual'? [yes]:
```
In addition I have found it is wise to set the dns server and the local gateway. For most home routers these will be the same address. If you are using Pi-Hole you can set the dns to that.
```
nmcli> set ipv4.dns 192.168.100.1
nmcli> set ipv4.gateway 192.168.100.1
nmcli> save
nmcli> exit
```
If you now view the default connection `cat /etc/NetworkManager/system_connections/default` you should see the method is manual and the address is set.
Doing a `nmcli con reload` does not always work so restart the VM.
[keyfile]: https://developer.gnome.org/NetworkManager/stable/nm-settings.html
[configuration-usb]: configuration.md