Nicolas Kovacs
2020-Feb-18 15:37 UTC
[CentOS] From network-scripts to NetworkManager on a router : questions
Le 18/02/2020 ? 12:28, Anand Buddhdev a ?crit?:> Neither. The DNS configuration should not normally be bound to a > specific interface, so don't configure it with any interface. If you do, > and that interface goes down, your DNS config also disappears.I would like to do that very much, only NetworkManager makes you jump through burning loops to do so. With network-scripts, it was just a matter of editing resolv.conf with nameserver and search domain directives. I can't do that anymore, because /etc/resolv.conf gets squashed by NetworkManager. If I don't fill in DNS information for the interfaces, then all I get is an empty "#Generated by NetworkManager" line. On the other hand, using nmtui, the only place where I can actually fill in DNS information is in the interface-specific dialogs. After googling around for this problem, it looks like I'm not the only one scratching my head. Any suggestions ? Niki -- Microlinux - Solutions informatiques durables 7, place de l'?glise - 30730 Montpezat Site : https://www.microlinux.fr Mail : info at microlinux.fr T?l. : 04 66 63 10 32 Mob. : 06 51 80 12 12
Anand Buddhdev
2020-Feb-18 15:51 UTC
[CentOS] From network-scripts to NetworkManager on a router : questions
On 18/02/2020 16:37, Nicolas Kovacs wrote:> I can't do that anymore, because /etc/resolv.conf gets squashed by > NetworkManager. If I don't fill in DNS information for the interfaces, > then all I get is an empty "#Generated by NetworkManager" line.Oh yes. Are you still sure you want to use NetworkManager? It's a pain!> On the other hand, using nmtui, the only place where I can actually fill > in DNS information is in the interface-specific dialogs. > > After googling around for this problem, it looks like I'm not the only > one scratching my head. > > Any suggestions ?Yes. Do this: # cat >/etc/NetworkManager/conf.d/dns.conf <<EOF [main] rc-manager=unmanaged EOF # systemctl reload NetworkManager This tells NetworkManager to leave /etc/resolv.conf alone. Now you can put whatever you like in /etc/resolv.conf, and it will be left untouched. Regards, Anand
Johnny Hughes
2020-Feb-18 15:52 UTC
[CentOS] From network-scripts to NetworkManager on a router : questions
On 2/18/20 9:37 AM, Nicolas Kovacs wrote:> Le 18/02/2020 ? 12:28, Anand Buddhdev a ?crit?: >> Neither. The DNS configuration should not normally be bound to a >> specific interface, so don't configure it with any interface. If you do, >> and that interface goes down, your DNS config also disappears. > > I would like to do that very much, only NetworkManager makes you jump > through burning loops to do so. > > With network-scripts, it was just a matter of editing resolv.conf with > nameserver and search domain directives. > > I can't do that anymore, because /etc/resolv.conf gets squashed by > NetworkManager. If I don't fill in DNS information for the interfaces, > then all I get is an empty "#Generated by NetworkManager" line. > > On the other hand, using nmtui, the only place where I can actually fill > in DNS information is in the interface-specific dialogs.Or use 'nmcli con mod <interface_name> ipv4.dns "8.8.8.8"' or edit: /etc/sysconfig/network-scripts/ifcfg-<interface-name>> > After googling around for this problem, it looks like I'm not the only > one scratching my head. > > Any suggestions ? > > Niki >-------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 198 bytes Desc: OpenPGP digital signature URL: <http://lists.centos.org/pipermail/centos/attachments/20200218/c2cb57dc/attachment.sig>
Nicolas Kovacs
2020-Feb-18 16:37 UTC
[CentOS] From network-scripts to NetworkManager on a router : questions
Le 18/02/2020 ? 16:51, Anand Buddhdev a ?crit?:> This tells NetworkManager to leave /etc/resolv.conf alone. Now you can > put whatever you like in /etc/resolv.conf, and it will be left untouched.I just found the answer after some more experimenting. 1. If you put some DNS information in any of your ifcfg-* interfaces, then NetworkManager will overwrite /etc/resolv.conf with whatever it find in there. BUT... 2. If there is no DNS information in any of the ifcfg-* files, then NetworkManager will leave your manually edited /etc/resolv.conf configuration untouched. And this is the default behavior, no need to configure it specifically. Problem solved. :o) Thanks very much to everybody in this thread for your contribution. Niki -- Microlinux - Solutions informatiques durables 7, place de l'?glise - 30730 Montpezat Site : https://www.microlinux.fr Mail : info at microlinux.fr T?l. : 04 66 63 10 32 Mob. : 06 51 80 12 12
Jonathan Billings
2020-Feb-18 16:43 UTC
[CentOS] From network-scripts to NetworkManager on a router : questions
On Tue, Feb 18, 2020 at 04:37:29PM +0100, Nicolas Kovacs wrote:> > Le 18/02/2020 ? 12:28, Anand Buddhdev a ?crit?: > > Neither. The DNS configuration should not normally be bound to a > > specific interface, so don't configure it with any interface. If you do, > > and that interface goes down, your DNS config also disappears. > > I would like to do that very much, only NetworkManager makes you jump > through burning loops to do so. > > With network-scripts, it was just a matter of editing resolv.conf with > nameserver and search domain directives. > > I can't do that anymore, because /etc/resolv.conf gets squashed by > NetworkManager. If I don't fill in DNS information for the interfaces, then > all I get is an empty "#Generated by NetworkManager" line. > > On the other hand, using nmtui, the only place where I can actually fill in > DNS information is in the interface-specific dialogs. > > After googling around for this problem, it looks like I'm not the only one > scratching my head.According to 'man nm-settings-ifcfg-rh', PEERDNS=no is the old network-services services mechanism for not changing /etc/resolv.conf, while in NM it just means never add automatic nameservers to resolv.conf from DHCP, PPP, VPN, etc. Turning off all DNS updates means adding: [main] dns=none ... to the NetworkManager.conf (or preferably in an /etc/NetworkManager/conf.d/ file) is probably going to be the most effective way. I've seen PEERDNS=no make NetworkManager not overwrite my resolv.conf but maybe I should be extra careful and drop in a config file that turns off all dns updating features of NetworkManager. -- Jonathan Billings <billings at negate.org>
Nicolas Kovacs
2020-Feb-18 16:45 UTC
[CentOS] From network-scripts to NetworkManager on a router : questions
Le 18/02/2020 ? 16:51, Anand Buddhdev a ?crit?:> Oh yes. Are you still sure you want to use NetworkManager? It's a pain!As much as I'm a firm believer in the KISS principle, I don't like to "swim against the current". As someone on this list said it earlier, Red Hat provides a certain set of tools meant to be used. And since the official guide "Considerations in adopting RHEL 8" explicitly states that network scripts are considered obsolete, I thought I'd do my best to wrap my head around this new way of doing things, like I did before with systemd. Cheers, Niki -- Microlinux - Solutions informatiques durables 7, place de l'?glise - 30730 Montpezat Site : https://www.microlinux.fr Mail : info at microlinux.fr T?l. : 04 66 63 10 32 Mob. : 06 51 80 12 12
Nicolas Kovacs
2020-Feb-18 16:56 UTC
[CentOS] From network-scripts to NetworkManager on a router : questions
Le 18/02/2020 ? 17:43, Jonathan Billings a ?crit?:> According to 'man nm-settings-ifcfg-rh', PEERDNS=no is the old > network-services services mechanism for not changing /etc/resolv.conf, > while in NM it just means never add automatic nameservers to > resolv.conf from DHCP, PPP, VPN, etc. Turning off all DNS > updates means adding: > > [main] > dns=none > > ... to the NetworkManager.conf (or preferably in an > /etc/NetworkManager/conf.d/ file) is probably going to be the most > effective way. I've seen PEERDNS=no make NetworkManager not overwrite > my resolv.conf but maybe I should be extra careful and drop in a > config file that turns off all dns updating features of > NetworkManager.See my previous mail on that subject. tl;dr : as long as you don't provide any DNS information for any of the interfaces, /etc/resolv.conf does *not* get overwritten. -- Microlinux - Solutions informatiques durables 7, place de l'?glise - 30730 Montpezat Site : https://www.microlinux.fr Mail : info at microlinux.fr T?l. : 04 66 63 10 32 Mob. : 06 51 80 12 12
Seemingly Similar Threads
- From network-scripts to NetworkManager on a router : questions
- From network-scripts to NetworkManager on a router : questions
- From network-scripts to NetworkManager on a router : questions
- From network-scripts to NetworkManager on a router : questions
- NetworkManager / wireless on latest Centos7 installs