Getting the Linux NetworkManager process to respect custom DNS server settings


I recently switched my work Desktop from Ubuntu to Fedora 11, and noticed that there are some new configuration options now that network intefaces are managed by the NetworkManager process. Two useful options are the ability to specify the DNS servers and search domains in the network-scripts files, and have those applied when a DHCP lease is acquired (this assumes you override the values provided by your DHCP server). To override the DNS servers and search domains, you can set the DNS1, DNS2 and DOMAIN variables in your favorite ifcfg-eth[0-9]+ script:

$ egrep '(DNS1|DNS2|DOMAIN)' /etc/sysconfig/network-scripts/ifcfg-eth0

DNS1=192.168.1.1
DNS2=192.168.1.2
DOMAIN="prefetch.net ops.prefetch.net"

Hopefully the NetworkManager is all it’s cracked up to be. Only time will tell of course. :)

This article was posted by Matty on 2009-09-14 20:36:00 -0400 -0400