Fix #1069 install: check static ip
Squashed commit of the following: commit57466233cbMerge:2df5f281867bf545Author: Andrey Meshkov <am@adguard.com> Date: Thu Feb 13 18:39:15 2020 +0300 Merge branch 'master' into 1069-install-static-ip commit2df5f281c4Author: Andrey Meshkov <am@adguard.com> Date: Thu Feb 13 18:35:54 2020 +0300 *: lang fix commitb4649a6b27Merge:c2785253f61d5f0fAuthor: Andrey Meshkov <am@adguard.com> Date: Thu Feb 13 16:47:30 2020 +0300 *(home): fixed issues with setting static IP on Mac commitc27852537dAuthor: Andrey Meshkov <am@adguard.com> Date: Thu Feb 13 14:14:30 2020 +0300 +(dhcpd): added static IP for MacOS commitf61d5f0f85Author: Ildar Kamalov <i.kamalov@adguard.com> Date: Thu Feb 13 14:13:35 2020 +0300 + client: show confirm before setting static IP commit7afa16fbe7Author: Ildar Kamalov <i.kamalov@adguard.com> Date: Thu Feb 13 13:51:52 2020 +0300 - client: fix text commit019bff0851Author: Ildar Kamalov <i.kamalov@adguard.com> Date: Thu Feb 13 13:49:16 2020 +0300 - client: pass all params to the check_config request commit194bed72f5Author: Andrey Meshkov <am@adguard.com> Date: Wed Feb 12 17:12:16 2020 +0300 *: fix home_test commit9359f6b55fMerge:ae299058c5ca2a77Author: Andrey Meshkov <am@adguard.com> Date: Wed Feb 12 15:54:54 2020 +0300 Merge with master commitae2990582dAuthor: Andrey Meshkov <am@adguard.com> Date: Wed Feb 12 15:53:36 2020 +0300 *(global): refactoring - moved runtime properties to Context commitd8d48c5386Author: Andrey Meshkov <am@adguard.com> Date: Wed Feb 12 15:04:25 2020 +0300 *(dhcpd): refactoring, use dhcpd/network_utils where possible commit8d039c572fAuthor: Ildar Kamalov <i.kamalov@adguard.com> Date: Fri Feb 7 18:37:39 2020 +0300 - client: fix button position commit26c47e59ddAuthor: Ildar Kamalov <i.kamalov@adguard.com> Date: Fri Feb 7 18:08:56 2020 +0300 - client: fix static ip description commitcb12babc46Author: Andrey Meshkov <am@adguard.com> Date: Fri Feb 7 17:08:39 2020 +0300 *: lower log level for some commands commitd9001ff848Author: Andrey Meshkov <am@adguard.com> Date: Fri Feb 7 16:17:59 2020 +0300 *(documentation): updated openapi commit1d213d53c8Merge:8406d7d280861860Author: Andrey Meshkov <am@adguard.com> Date: Fri Feb 7 15:16:46 2020 +0300 *: merge with master commit8406d7d288Author: Ildar Kamalov <i.kamalov@adguard.com> Date: Fri Jan 31 16:52:22 2020 +0300 - client: fix locales commitfb476b0117Author: Simon Zolin <s.zolin@adguard.com> Date: Fri Jan 31 13:29:03 2020 +0300 linter commit84b5708e71Author: Simon Zolin <s.zolin@adguard.com> Date: Fri Jan 31 13:27:53 2020 +0300 linter commit143a86a28aAuthor: Simon Zolin <s.zolin@adguard.com> Date: Fri Jan 31 13:26:47 2020 +0300 linter ... and 7 more commits
This commit is contained in:
@@ -138,10 +138,13 @@ Request:
|
||||
{
|
||||
"web":{"port":80,"ip":"192.168.11.33"},
|
||||
"dns":{"port":53,"ip":"127.0.0.1","autofix":false},
|
||||
"set_static_ip": true | false
|
||||
}
|
||||
|
||||
Server should check whether a port is available only in case it itself isn't already listening on that port.
|
||||
|
||||
If `set_static_ip` is `true`, Server attempts to set a static IP for the network interface chosen by `dns.ip` setting. If the operation is successful, `static_ip.static` setting will be `yes`. If it fails, `static_ip.static` setting will be set to `error` and `static_ip.error` will contain the error message.
|
||||
|
||||
Server replies on success:
|
||||
|
||||
200 OK
|
||||
@@ -149,7 +152,14 @@ Server replies on success:
|
||||
{
|
||||
"web":{"status":""},
|
||||
"dns":{"status":""},
|
||||
"static_ip": {
|
||||
"static": "yes|no|error",
|
||||
"ip": "<Current dynamic IP address>", // set if static=no
|
||||
"error": "..." // set if static=error
|
||||
}
|
||||
}
|
||||
|
||||
If `static_ip.static` is `no`, Server has detected that the system uses a dynamic address and it can automatically set a static address if `set_static_ip` in request is `true`. See section `Static IP check/set` for detailed process.
|
||||
|
||||
Server replies on error:
|
||||
|
||||
@@ -172,7 +182,11 @@ Request:
|
||||
POST /control/install/check_config
|
||||
|
||||
{
|
||||
"dns":{"port":53,"ip":"127.0.0.1","autofix":false}
|
||||
"dns":{
|
||||
"port":53,
|
||||
"ip":"127.0.0.1",
|
||||
"autofix":false
|
||||
}
|
||||
}
|
||||
|
||||
Check if DNSStubListener is enabled:
|
||||
@@ -499,13 +513,7 @@ which will print:
|
||||
default via 192.168.0.1 proto dhcp metric 100
|
||||
|
||||
|
||||
#### Phase 2
|
||||
|
||||
This method only works on Raspbian.
|
||||
|
||||
On Ubuntu DHCP for a network interface can't be disabled via `dhcpcd.conf`. This must be configured in `/etc/netplan/01-netcfg.yaml`.
|
||||
|
||||
Fedora doesn't use `dhcpcd.conf` configuration at all.
|
||||
#### Phase 2 (Raspbian)
|
||||
|
||||
Step 1.
|
||||
|
||||
@@ -526,6 +534,44 @@ If we would set a different IP address, we'd need to replace the IP address for
|
||||
ip addr replace dev eth0 192.168.0.1/24
|
||||
|
||||
|
||||
#### Phase 2 (Ubuntu)
|
||||
|
||||
`/etc/netplan/01-netcfg.yaml` or `/etc/netplan/01-network-manager-all.yaml`
|
||||
|
||||
This configuration example has a static IP set for `enp0s3` interface:
|
||||
|
||||
network:
|
||||
version: 2
|
||||
renderer: networkd
|
||||
ethernets:
|
||||
enp0s3:
|
||||
dhcp4: no
|
||||
addresses: [192.168.0.2/24]
|
||||
gateway: 192.168.0.1
|
||||
nameservers:
|
||||
addresses: [192.168.0.1,8.8.8.8]
|
||||
|
||||
For dynamic configuration `dhcp4: yes` is set.
|
||||
|
||||
Make a backup copy to `/etc/netplan/01-netcfg.yaml.backup`.
|
||||
|
||||
Apply:
|
||||
|
||||
netplan apply
|
||||
|
||||
Restart network:
|
||||
|
||||
systemctl restart networking
|
||||
|
||||
or:
|
||||
|
||||
systemctl restart network-manager
|
||||
|
||||
or:
|
||||
|
||||
systemctl restart system-networkd
|
||||
|
||||
|
||||
### Add a static lease
|
||||
|
||||
Request:
|
||||
|
||||
Reference in New Issue
Block a user