Cannot set custom DNS servers and use DHCP in 20.04 Kubuntu
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Netplan |
New
|
Undecided
|
Unassigned |
Bug Description
I am only able to set custom DNS servers using the /etc/netplan/
d@a:~$ more /etc/netplan/
# Let NetworkManager manage all devices on this system
network:
version: 2
renderer: NetworkManager
wifis:
wlp3s0:
dhcp4: false
addresses: [10.0.0.49/24]
gateway4: 10.0.0.1
access-
password: passwordgoeshere
nameservers:
addresses: [8.8.4.
The configuration above works, Network Manager restarts after issuing sudo netplan --debug apply, there is a new connection that is created with the same name as my original access point but prepended with netplan-wlp3s0.
I would like not to use a static IP address. When i try the below configuration to set custom DNS servers and have DHCP enabled. No new connection is created and the original one has the service providers DNS servers.
d@a:~$ more /etc/netplan/
# Let NetworkManager manage all devices on this system
network:
version: 2
renderer: NetworkManager
wifis:
wlp3s0:
dhcp4-
use-dns: no
access-
password: passwordgoeshere
nameservers:
addresses: [8.8.4.
d@a:~$ sudo netplan --debug apply
** (generate:11280): DEBUG: 22:03:24.251: Processing input file /etc/netplan/
** (generate:11280): DEBUG: 22:03:24.251: starting new processing pass
** (generate:11280): DEBUG: 22:03:24.251: wlp3s0: adding wifi AP 'accesspointname'
** (generate:11280): DEBUG: 22:03:24.252: We have some netdefs, pass them through a final round of validation
** (generate:11280): DEBUG: 22:03:24.252: wlp3s0: setting default backend to 2
** (generate:11280): DEBUG: 22:03:24.252: Configuration is valid
** (generate:11280): DEBUG: 22:03:24.252: Generating output files..
** (generate:11280): DEBUG: 22:03:24.252: networkd: definition wlp3s0 is not for us (backend 2)
(generate:11280): GLib-DEBUG: 22:03:24.252: posix_spawn avoided (fd close requested)
DEBUG:no netplan generated networkd configuration exists
DEBUG:netplan generated NM configuration changed, restarting NM
DEBUG:wlp3s0 not found in {}
DEBUG:Merged config:
network:
bonds: {}
bridges: {}
ethernets: {}
vlans: {}
wifis:
wlp3s0:
access-
password: passwordgoeshere
dhcp4-
use-dns: false
nameservers:
addresses:
- 8.8.4.4
- 8.8.8.8
- 1.1.0.0
- 1.1.1.1
DEBUG:Skipping non-physical interface: lo
DEBUG:Skipping non-physical interface: enp0s25
DEBUG:{}
DEBUG:netplan triggering .link rules for lo
DEBUG:netplan triggering .link rules for enp0s25
DEBUG:netplan triggering .link rules for wlp3s0
How can i keep DHCP on and use custom DNS servers?
Thanks
Someone on a different forum suggested i use this configuration:
network: points:
accesspointgoe shere: 4,8.8.8. 8,1.1.0. 0,1.1.1. 1]
version: 2
renderer: NetworkManager
wifis:
wlp3s0:
dhcp4: true
access-
password: passwordgoeshere
nameservers:
addresses: [8.8.4.
However then when i run: nmcli dev show | grep DNS
The service providers DNS servers are before the custom ones i have defined:
IP4.DNS[1]: 75.75.75.75
IP4.DNS[2]: 75.75.76.76
IP4.DNS[3]: 8.8.4.4
IP4.DNS[4]: 8.8.8.8
IP4.DNS[5]: 1.1.0.0
IP4.DNS[6]: 1.1.1.1
I could do it all in Network Manager, i am however looking for a config file solution so that i can script it.
Does netplan support this configuration?
Thanks