mirror of
https://github.com/home-assistant/operating-system.git
synced 2025-07-28 15:36:29 +00:00
Update style and static IPv4 address section (#667)
This commit is contained in:
parent
6c62029a74
commit
613604ea74
@ -1,15 +1,18 @@
|
||||
# Network
|
||||
|
||||
## Configure Network
|
||||
HassOS uses NetworkManager to control the host network. In future releases, you will be able to set up the configuration using the API/UI. Currently only a manual configuration using NetworkManager connection files is supported. Without a configuration file, the device will use DHCP by default. These network connection files can be placed on a USB drive and imported to the host as described in [Configuration][configuration-usb].
|
||||
HassOS uses NetworkManager to control the host network.
|
||||
|
||||
## Configuration Examples
|
||||
## Configure network
|
||||
|
||||
You can read the [Official Manual][keyfile] or find many configuration examples across the internet. The system is read-only, if you don't want the IP address to change on every boot, you should set the UUID property with a generic [UUID4][uuid]. Inside `\CONFIG\network\` on the USB or SD, create a file called `my-network` and add the appropriate contents below:
|
||||
Only a manual configuration using NetworkManager connection files is supported. Without a configuration file, the device will use DHCP by default. These network connection files can be placed on a USB drive and imported to the host as described in [Configuration][configuration-usb].
|
||||
|
||||
## Configuration examples
|
||||
|
||||
You can read the [NetworkManager manual][nm-manual] or find many configuration examples across the internet. Keep in mind that the system is read-only. If you don't want the IP address to change on every boot, you should modify the UUID property to a generic [UUID4][uuid]. Inside the `\CONFIG\network\` directory on the USB drive or SD card, create a file called `my-network` and add the appropriate contents below:
|
||||
|
||||
### Default
|
||||
|
||||
We have a preinstalled connection profile:
|
||||
A preinstalled connection profile is provided by default:
|
||||
|
||||
```ini
|
||||
[connection]
|
||||
@ -25,7 +28,7 @@ addr-gen-mode=stable-privacy
|
||||
method=auto
|
||||
```
|
||||
|
||||
### LAN
|
||||
### Wired connection to the LAN
|
||||
|
||||
```ini
|
||||
[connection]
|
||||
@ -41,7 +44,7 @@ addr-gen-mode=stable-privacy
|
||||
method=auto
|
||||
```
|
||||
|
||||
### Wireless WPA/PSK
|
||||
### Wireless LAN WPA/PSK
|
||||
|
||||
```ini
|
||||
[connection]
|
||||
@ -78,7 +81,8 @@ method=manual
|
||||
address=192.168.1.111/24;192.168.1.1
|
||||
dns=8.8.8.8;8.8.4.4;
|
||||
```
|
||||
For address, the value before the semicolon is the IP address and subnet prefix bitlength; the second value is the IP address of the gateway.
|
||||
|
||||
For `address`, the value before the semicolon is the IP address and subnet prefix bitlength. The second value (after the semicolon) is the IP address of the local gateway.
|
||||
|
||||
## Tips
|
||||
|
||||
@ -87,59 +91,63 @@ For address, the value before the semicolon is the IP address and subnet prefix
|
||||
If you want to reset the network configuration back to the default DHCP settings, use the following commands on the host:
|
||||
|
||||
```bash
|
||||
$ rm /etc/NetworkManager/system-connections/*
|
||||
$ cp /usr/share/system-connections/* /etc/NetworkManager/system-connections/
|
||||
$ nmcli con reload
|
||||
# rm /etc/NetworkManager/system-connections/*
|
||||
# cp /usr/share/system-connections/* /etc/NetworkManager/system-connections/
|
||||
# nmcli con reload
|
||||
```
|
||||
|
||||
### Powersave
|
||||
|
||||
If you have trouble with powersave you can do following:
|
||||
If you have trouble with powersave then apply the following changes:
|
||||
|
||||
```ini
|
||||
[wifi]
|
||||
# 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:
|
||||
## Using `nmcli` to set a static IPv4 address
|
||||
|
||||
```
|
||||
Log into the the HassOS base system via a console:
|
||||
|
||||
```bash
|
||||
Welcome to Home Assistant
|
||||
homeassistant login:
|
||||
```
|
||||
Login as `root` (no password needed)
|
||||
|
||||
At the `ha >` prompt, type `login` (as instructed).
|
||||
- Login as `root` (no password needed). At the `ha >` prompt, type `login` (as instructed).
|
||||
|
||||
From here you will use the `nmcli` configuration tool.
|
||||
From there you use the `nmcli` configuration tool.
|
||||
|
||||
`# nmcli connection show` will list the “HassOS default” connection in use.
|
||||
- `# nmcli con show` will list the "HassOS default" connection in use.
|
||||
- `# nmcli con show "HassOS default"` will list all the properties of the connection.
|
||||
|
||||
`# nmcli con show "HassOS default"` will list all the properties of the connection.
|
||||
To start editing the configuration setting for "HassOS default":
|
||||
|
||||
`# 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.
|
||||
```bash
|
||||
# nmcli con edit "HassOS default"
|
||||
```
|
||||
|
||||
To add your static IP address (select 'yes' for manual method);
|
||||
```
|
||||
|
||||
```bash
|
||||
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.
|
||||
```
|
||||
|
||||
In addition, it's recommended to set the DNS server and the local gateway. For most home routers the DNS server will have the same IP address as the router itself. If you are using Pi-Hole or a third-party DNS system then you can set the DNS server to that.
|
||||
|
||||
```bash
|
||||
nmcli> set ipv4.dns 192.168.100.1
|
||||
nmcli> set ipv4.gateway 192.168.100.1
|
||||
nmcli> save
|
||||
nmcli> quit
|
||||
```
|
||||
|
||||
`nmcli> print ipv4` will show you the IPv4 properties of this connection. With `nmcli> save` you will save the changes afterwards.
|
||||
|
||||
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.
|
||||
Doing a `nmcli con reload` does not always work, so restart the virtual machine or the physical system.
|
||||
|
||||
[keyfile]: https://developer.gnome.org/NetworkManager/stable/nm-settings.html
|
||||
[nm-manual]: https://developer.gnome.org/NetworkManager/stable/nm-settings.html
|
||||
[configuration-usb]: configuration.md
|
||||
[uuid]: https://www.uuidgenerator.net/
|
||||
|
Loading…
x
Reference in New Issue
Block a user