Can netplan configured nameservers supersede (not merge with) the DHCP nameservers?
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}
I would like to use DHCP to assign an IP address to my server, but specify the DNS servers manually. I tried the following simple configuration:
network:
version: 2
renderer: networkd
ethernets:
enp0s3:
dhcp4: yes
nameservers: [8.8.8.8,8.8.4.4]
After running netplan apply
I check the nameservers with systemd-resolve --status
and it shows:
DNS Servers: 8.8.8.8
8.8.4.4
192.168.1.1
The last is the DNS server provided by DHCP, which I do not want to be in the list.
Does netplan have a way to accomplish this?
networking 17.10 dns dhcp netplan
add a comment |
I would like to use DHCP to assign an IP address to my server, but specify the DNS servers manually. I tried the following simple configuration:
network:
version: 2
renderer: networkd
ethernets:
enp0s3:
dhcp4: yes
nameservers: [8.8.8.8,8.8.4.4]
After running netplan apply
I check the nameservers with systemd-resolve --status
and it shows:
DNS Servers: 8.8.8.8
8.8.4.4
192.168.1.1
The last is the DNS server provided by DHCP, which I do not want to be in the list.
Does netplan have a way to accomplish this?
networking 17.10 dns dhcp netplan
You may find the answer here helpful unix.stackexchange.com/questions/136117/…
– nucc1
May 5 '18 at 12:35
I appreciate the attempt to help, but dhclient.conf does not appear to affect netplan configured DHCP at all. In fact, on Ubuntu 17.10 I found that you could delete the dhclient binary and netplan would still configure everything with DHCP.
– alanwj
May 7 '18 at 7:18
I found the bug (you?) filed on netplan for this: bugs.launchpad.net/netplan/+bug/1759014 I skimmed the netplan code and it doesn't support any way to specify DHCP options. It is hardcoded to write two options "UseMTU" and "RouteMetric". The only way I can think of for "hacking" what you want is to manually (or using a script) edit the files in /run/systemd/network/10-netplan-* which is where networkd reads definitions from. YOu can append the dhcp options you want there . doesn't look too complex to support this, so maybe we will see a patch in our lifetimes.
– nucc1
May 7 '18 at 11:36
of course, as you know, the files will be overwritten every time you call netplan apply... also, my comments are based on Ubuntu 18.04 and the current Master of netplan.
– nucc1
May 7 '18 at 11:45
add a comment |
I would like to use DHCP to assign an IP address to my server, but specify the DNS servers manually. I tried the following simple configuration:
network:
version: 2
renderer: networkd
ethernets:
enp0s3:
dhcp4: yes
nameservers: [8.8.8.8,8.8.4.4]
After running netplan apply
I check the nameservers with systemd-resolve --status
and it shows:
DNS Servers: 8.8.8.8
8.8.4.4
192.168.1.1
The last is the DNS server provided by DHCP, which I do not want to be in the list.
Does netplan have a way to accomplish this?
networking 17.10 dns dhcp netplan
I would like to use DHCP to assign an IP address to my server, but specify the DNS servers manually. I tried the following simple configuration:
network:
version: 2
renderer: networkd
ethernets:
enp0s3:
dhcp4: yes
nameservers: [8.8.8.8,8.8.4.4]
After running netplan apply
I check the nameservers with systemd-resolve --status
and it shows:
DNS Servers: 8.8.8.8
8.8.4.4
192.168.1.1
The last is the DNS server provided by DHCP, which I do not want to be in the list.
Does netplan have a way to accomplish this?
networking 17.10 dns dhcp netplan
networking 17.10 dns dhcp netplan
edited Apr 2 at 3:10
timbo
179111
179111
asked Jan 30 '18 at 7:01
alanwjalanwj
14115
14115
You may find the answer here helpful unix.stackexchange.com/questions/136117/…
– nucc1
May 5 '18 at 12:35
I appreciate the attempt to help, but dhclient.conf does not appear to affect netplan configured DHCP at all. In fact, on Ubuntu 17.10 I found that you could delete the dhclient binary and netplan would still configure everything with DHCP.
– alanwj
May 7 '18 at 7:18
I found the bug (you?) filed on netplan for this: bugs.launchpad.net/netplan/+bug/1759014 I skimmed the netplan code and it doesn't support any way to specify DHCP options. It is hardcoded to write two options "UseMTU" and "RouteMetric". The only way I can think of for "hacking" what you want is to manually (or using a script) edit the files in /run/systemd/network/10-netplan-* which is where networkd reads definitions from. YOu can append the dhcp options you want there . doesn't look too complex to support this, so maybe we will see a patch in our lifetimes.
– nucc1
May 7 '18 at 11:36
of course, as you know, the files will be overwritten every time you call netplan apply... also, my comments are based on Ubuntu 18.04 and the current Master of netplan.
– nucc1
May 7 '18 at 11:45
add a comment |
You may find the answer here helpful unix.stackexchange.com/questions/136117/…
– nucc1
May 5 '18 at 12:35
I appreciate the attempt to help, but dhclient.conf does not appear to affect netplan configured DHCP at all. In fact, on Ubuntu 17.10 I found that you could delete the dhclient binary and netplan would still configure everything with DHCP.
– alanwj
May 7 '18 at 7:18
I found the bug (you?) filed on netplan for this: bugs.launchpad.net/netplan/+bug/1759014 I skimmed the netplan code and it doesn't support any way to specify DHCP options. It is hardcoded to write two options "UseMTU" and "RouteMetric". The only way I can think of for "hacking" what you want is to manually (or using a script) edit the files in /run/systemd/network/10-netplan-* which is where networkd reads definitions from. YOu can append the dhcp options you want there . doesn't look too complex to support this, so maybe we will see a patch in our lifetimes.
– nucc1
May 7 '18 at 11:36
of course, as you know, the files will be overwritten every time you call netplan apply... also, my comments are based on Ubuntu 18.04 and the current Master of netplan.
– nucc1
May 7 '18 at 11:45
You may find the answer here helpful unix.stackexchange.com/questions/136117/…
– nucc1
May 5 '18 at 12:35
You may find the answer here helpful unix.stackexchange.com/questions/136117/…
– nucc1
May 5 '18 at 12:35
I appreciate the attempt to help, but dhclient.conf does not appear to affect netplan configured DHCP at all. In fact, on Ubuntu 17.10 I found that you could delete the dhclient binary and netplan would still configure everything with DHCP.
– alanwj
May 7 '18 at 7:18
I appreciate the attempt to help, but dhclient.conf does not appear to affect netplan configured DHCP at all. In fact, on Ubuntu 17.10 I found that you could delete the dhclient binary and netplan would still configure everything with DHCP.
– alanwj
May 7 '18 at 7:18
I found the bug (you?) filed on netplan for this: bugs.launchpad.net/netplan/+bug/1759014 I skimmed the netplan code and it doesn't support any way to specify DHCP options. It is hardcoded to write two options "UseMTU" and "RouteMetric". The only way I can think of for "hacking" what you want is to manually (or using a script) edit the files in /run/systemd/network/10-netplan-* which is where networkd reads definitions from. YOu can append the dhcp options you want there . doesn't look too complex to support this, so maybe we will see a patch in our lifetimes.
– nucc1
May 7 '18 at 11:36
I found the bug (you?) filed on netplan for this: bugs.launchpad.net/netplan/+bug/1759014 I skimmed the netplan code and it doesn't support any way to specify DHCP options. It is hardcoded to write two options "UseMTU" and "RouteMetric". The only way I can think of for "hacking" what you want is to manually (or using a script) edit the files in /run/systemd/network/10-netplan-* which is where networkd reads definitions from. YOu can append the dhcp options you want there . doesn't look too complex to support this, so maybe we will see a patch in our lifetimes.
– nucc1
May 7 '18 at 11:36
of course, as you know, the files will be overwritten every time you call netplan apply... also, my comments are based on Ubuntu 18.04 and the current Master of netplan.
– nucc1
May 7 '18 at 11:45
of course, as you know, the files will be overwritten every time you call netplan apply... also, my comments are based on Ubuntu 18.04 and the current Master of netplan.
– nucc1
May 7 '18 at 11:45
add a comment |
3 Answers
3
active
oldest
votes
This is a really common setup that's totally borked in Ubuntu 18.04,
Netplan needs to support the NetworkManager options when using DHCP:
nmcli connection modify ${ID} ipv4.ignore-auto-dns yes
nmcli connection modify ${ID} ipv4.dns 'xx.xx.xx.10 xx.xx.xx.20'
nmcli connection modify ${ID} ipv4.dns-search 'abc01.domain.com. abc02.domain.com.'
add a comment |
This has been fixed in the netplan repository on github, and will presumably make its way into Ubuntu at some point.
Two new options have been added, dhcp4-overrides
and dhcp6-overrides
. To ignore DNS servers from DHCP you would do something like:
dhcp4: yes
dhcp4-overrides:
use-dns: no
1
I agree this is the best fix. However, if you don't have the latest netplan (for example, you're on 18.04 like me), you can instead append "UseDNS=false" to /run/systemd/network/10-netplan-*.network, then execute systemctl restart systemd-networkd. Note that a future netplan apply will clobber this. (Info from bugs.launchpad.net/netplan/+bug/1759014/comments/5)
– Chris
Jan 22 at 15:19
add a comment |
There is unfortunately no changelog in the netplan github repo to ascertain when the newer features came in. However there was a big jump in release versions in
https://github.com/CanonicalLtd/netplan/releases from 0.40 to 0.90 in November 2018
On Ubuntu 18.10, netplan is presently at version 0.40.2.2
With that netplan version, trying a wireless config to do DHCP but with the Cloudflare anonymous DNS servers:
network:
version: 2
renderer: NetworkManager
ethernets:
wlp4s0:
dhcp4: yes
dhcp4-overrides:
use-dns: no
nameservers:
addresses: [1.1.1.1,1.0.0.1]
produces an Unknown key dhcp4-overrides
error:
There are no backports to cosmic according to ubuntu.packages.org
On Ubuntu 19.04 beta, netplan version 0.96 is installed and the dhcp4-overrides
can be used:
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "89"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1001241%2fcan-netplan-configured-nameservers-supersede-not-merge-with-the-dhcp-nameserve%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
This is a really common setup that's totally borked in Ubuntu 18.04,
Netplan needs to support the NetworkManager options when using DHCP:
nmcli connection modify ${ID} ipv4.ignore-auto-dns yes
nmcli connection modify ${ID} ipv4.dns 'xx.xx.xx.10 xx.xx.xx.20'
nmcli connection modify ${ID} ipv4.dns-search 'abc01.domain.com. abc02.domain.com.'
add a comment |
This is a really common setup that's totally borked in Ubuntu 18.04,
Netplan needs to support the NetworkManager options when using DHCP:
nmcli connection modify ${ID} ipv4.ignore-auto-dns yes
nmcli connection modify ${ID} ipv4.dns 'xx.xx.xx.10 xx.xx.xx.20'
nmcli connection modify ${ID} ipv4.dns-search 'abc01.domain.com. abc02.domain.com.'
add a comment |
This is a really common setup that's totally borked in Ubuntu 18.04,
Netplan needs to support the NetworkManager options when using DHCP:
nmcli connection modify ${ID} ipv4.ignore-auto-dns yes
nmcli connection modify ${ID} ipv4.dns 'xx.xx.xx.10 xx.xx.xx.20'
nmcli connection modify ${ID} ipv4.dns-search 'abc01.domain.com. abc02.domain.com.'
This is a really common setup that's totally borked in Ubuntu 18.04,
Netplan needs to support the NetworkManager options when using DHCP:
nmcli connection modify ${ID} ipv4.ignore-auto-dns yes
nmcli connection modify ${ID} ipv4.dns 'xx.xx.xx.10 xx.xx.xx.20'
nmcli connection modify ${ID} ipv4.dns-search 'abc01.domain.com. abc02.domain.com.'
edited May 7 '18 at 19:20
Zoe
11524
11524
answered May 7 '18 at 19:06
WildstalkerWildstalker
314
314
add a comment |
add a comment |
This has been fixed in the netplan repository on github, and will presumably make its way into Ubuntu at some point.
Two new options have been added, dhcp4-overrides
and dhcp6-overrides
. To ignore DNS servers from DHCP you would do something like:
dhcp4: yes
dhcp4-overrides:
use-dns: no
1
I agree this is the best fix. However, if you don't have the latest netplan (for example, you're on 18.04 like me), you can instead append "UseDNS=false" to /run/systemd/network/10-netplan-*.network, then execute systemctl restart systemd-networkd. Note that a future netplan apply will clobber this. (Info from bugs.launchpad.net/netplan/+bug/1759014/comments/5)
– Chris
Jan 22 at 15:19
add a comment |
This has been fixed in the netplan repository on github, and will presumably make its way into Ubuntu at some point.
Two new options have been added, dhcp4-overrides
and dhcp6-overrides
. To ignore DNS servers from DHCP you would do something like:
dhcp4: yes
dhcp4-overrides:
use-dns: no
1
I agree this is the best fix. However, if you don't have the latest netplan (for example, you're on 18.04 like me), you can instead append "UseDNS=false" to /run/systemd/network/10-netplan-*.network, then execute systemctl restart systemd-networkd. Note that a future netplan apply will clobber this. (Info from bugs.launchpad.net/netplan/+bug/1759014/comments/5)
– Chris
Jan 22 at 15:19
add a comment |
This has been fixed in the netplan repository on github, and will presumably make its way into Ubuntu at some point.
Two new options have been added, dhcp4-overrides
and dhcp6-overrides
. To ignore DNS servers from DHCP you would do something like:
dhcp4: yes
dhcp4-overrides:
use-dns: no
This has been fixed in the netplan repository on github, and will presumably make its way into Ubuntu at some point.
Two new options have been added, dhcp4-overrides
and dhcp6-overrides
. To ignore DNS servers from DHCP you would do something like:
dhcp4: yes
dhcp4-overrides:
use-dns: no
answered Oct 18 '18 at 2:48
alanwjalanwj
14115
14115
1
I agree this is the best fix. However, if you don't have the latest netplan (for example, you're on 18.04 like me), you can instead append "UseDNS=false" to /run/systemd/network/10-netplan-*.network, then execute systemctl restart systemd-networkd. Note that a future netplan apply will clobber this. (Info from bugs.launchpad.net/netplan/+bug/1759014/comments/5)
– Chris
Jan 22 at 15:19
add a comment |
1
I agree this is the best fix. However, if you don't have the latest netplan (for example, you're on 18.04 like me), you can instead append "UseDNS=false" to /run/systemd/network/10-netplan-*.network, then execute systemctl restart systemd-networkd. Note that a future netplan apply will clobber this. (Info from bugs.launchpad.net/netplan/+bug/1759014/comments/5)
– Chris
Jan 22 at 15:19
1
1
I agree this is the best fix. However, if you don't have the latest netplan (for example, you're on 18.04 like me), you can instead append "UseDNS=false" to /run/systemd/network/10-netplan-*.network, then execute systemctl restart systemd-networkd. Note that a future netplan apply will clobber this. (Info from bugs.launchpad.net/netplan/+bug/1759014/comments/5)
– Chris
Jan 22 at 15:19
I agree this is the best fix. However, if you don't have the latest netplan (for example, you're on 18.04 like me), you can instead append "UseDNS=false" to /run/systemd/network/10-netplan-*.network, then execute systemctl restart systemd-networkd. Note that a future netplan apply will clobber this. (Info from bugs.launchpad.net/netplan/+bug/1759014/comments/5)
– Chris
Jan 22 at 15:19
add a comment |
There is unfortunately no changelog in the netplan github repo to ascertain when the newer features came in. However there was a big jump in release versions in
https://github.com/CanonicalLtd/netplan/releases from 0.40 to 0.90 in November 2018
On Ubuntu 18.10, netplan is presently at version 0.40.2.2
With that netplan version, trying a wireless config to do DHCP but with the Cloudflare anonymous DNS servers:
network:
version: 2
renderer: NetworkManager
ethernets:
wlp4s0:
dhcp4: yes
dhcp4-overrides:
use-dns: no
nameservers:
addresses: [1.1.1.1,1.0.0.1]
produces an Unknown key dhcp4-overrides
error:
There are no backports to cosmic according to ubuntu.packages.org
On Ubuntu 19.04 beta, netplan version 0.96 is installed and the dhcp4-overrides
can be used:
add a comment |
There is unfortunately no changelog in the netplan github repo to ascertain when the newer features came in. However there was a big jump in release versions in
https://github.com/CanonicalLtd/netplan/releases from 0.40 to 0.90 in November 2018
On Ubuntu 18.10, netplan is presently at version 0.40.2.2
With that netplan version, trying a wireless config to do DHCP but with the Cloudflare anonymous DNS servers:
network:
version: 2
renderer: NetworkManager
ethernets:
wlp4s0:
dhcp4: yes
dhcp4-overrides:
use-dns: no
nameservers:
addresses: [1.1.1.1,1.0.0.1]
produces an Unknown key dhcp4-overrides
error:
There are no backports to cosmic according to ubuntu.packages.org
On Ubuntu 19.04 beta, netplan version 0.96 is installed and the dhcp4-overrides
can be used:
add a comment |
There is unfortunately no changelog in the netplan github repo to ascertain when the newer features came in. However there was a big jump in release versions in
https://github.com/CanonicalLtd/netplan/releases from 0.40 to 0.90 in November 2018
On Ubuntu 18.10, netplan is presently at version 0.40.2.2
With that netplan version, trying a wireless config to do DHCP but with the Cloudflare anonymous DNS servers:
network:
version: 2
renderer: NetworkManager
ethernets:
wlp4s0:
dhcp4: yes
dhcp4-overrides:
use-dns: no
nameservers:
addresses: [1.1.1.1,1.0.0.1]
produces an Unknown key dhcp4-overrides
error:
There are no backports to cosmic according to ubuntu.packages.org
On Ubuntu 19.04 beta, netplan version 0.96 is installed and the dhcp4-overrides
can be used:
There is unfortunately no changelog in the netplan github repo to ascertain when the newer features came in. However there was a big jump in release versions in
https://github.com/CanonicalLtd/netplan/releases from 0.40 to 0.90 in November 2018
On Ubuntu 18.10, netplan is presently at version 0.40.2.2
With that netplan version, trying a wireless config to do DHCP but with the Cloudflare anonymous DNS servers:
network:
version: 2
renderer: NetworkManager
ethernets:
wlp4s0:
dhcp4: yes
dhcp4-overrides:
use-dns: no
nameservers:
addresses: [1.1.1.1,1.0.0.1]
produces an Unknown key dhcp4-overrides
error:
There are no backports to cosmic according to ubuntu.packages.org
On Ubuntu 19.04 beta, netplan version 0.96 is installed and the dhcp4-overrides
can be used:
edited Apr 2 at 3:09
answered Apr 1 at 23:11
timbotimbo
179111
179111
add a comment |
add a comment |
Thanks for contributing an answer to Ask Ubuntu!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1001241%2fcan-netplan-configured-nameservers-supersede-not-merge-with-the-dhcp-nameserve%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
You may find the answer here helpful unix.stackexchange.com/questions/136117/…
– nucc1
May 5 '18 at 12:35
I appreciate the attempt to help, but dhclient.conf does not appear to affect netplan configured DHCP at all. In fact, on Ubuntu 17.10 I found that you could delete the dhclient binary and netplan would still configure everything with DHCP.
– alanwj
May 7 '18 at 7:18
I found the bug (you?) filed on netplan for this: bugs.launchpad.net/netplan/+bug/1759014 I skimmed the netplan code and it doesn't support any way to specify DHCP options. It is hardcoded to write two options "UseMTU" and "RouteMetric". The only way I can think of for "hacking" what you want is to manually (or using a script) edit the files in /run/systemd/network/10-netplan-* which is where networkd reads definitions from. YOu can append the dhcp options you want there . doesn't look too complex to support this, so maybe we will see a patch in our lifetimes.
– nucc1
May 7 '18 at 11:36
of course, as you know, the files will be overwritten every time you call netplan apply... also, my comments are based on Ubuntu 18.04 and the current Master of netplan.
– nucc1
May 7 '18 at 11:45