There are many variations on how to set up name servers in Ubuntu (Debian) systems. Depending on what packages are installed, you might use
- configuration lines in /etc/resolv.conf
- configuration lines in /etc/network/interfaces
- configuration line appended to /etc/dhclient.conf
- the Ubuntu NetworkManager tool
These methods are generally mutually-exclusive and should not be "mixed & matched".
Setup of "/etc/resolv.conf"
A complete /etc/resolv.conf file for non-CS-TEACHING systems:sudo wget https://cs.uwaterloo.ca/cscf/internal/infrastructure/setups/services/dns/etc/resolv.conf -O /etc/resolv.conf
A complete /etc/resolv.conf file for CS-TEACHING systems:sudo wget https://cs.uwaterloo.ca/cscf/internal/infrastructure/setups/services/dns/etc/resolv.conf-CS-TEACHING -O /etc/resolv.conf
You may wish to add more domains to the "search" config line that are particular to your usage (e.g. a research-group domain). However if you do, make sure you update the "ndots" option to be the maximum number of dots contained by a domain name with in the "search" line.
Setup of "/etc/network/interfaces"
In /etc/network/interfaces, if the Canonical Inc "resolvconf" package is installed, the name servers are specified on a single line within the associated interface stanza:
iface eth0 inet static
dns-nameservers 172.19.32.5 126.96.36.199 172.19.47.5 188.8.131.52
dns-search uwaterloo.ca cs.uwaterloo.ca student.cs.uwaterloo.ca
Enhance "/etc/dhcp/dhclient.conf" to Accept Full Search List
unfortunately by default, the dhclient.conf will only pick up the first domainname of the domain-search string supplied by the dhcp server. To have it use the entire string of names, append "option domain-search code 119 = string;" to the /etc/dhcp/dhclient.conf" file.
echo "option domain-search code 119 = string;" >> /etc/dhcp/dhclient.conf
Setup Networking via NetworkManager
With the NetworkManager GUI management tool, edit the associated connection (e.g. "Auto eth0") and select the "IPv4" tab. Fill in the "DNS servers" and "Search domains" boxes for the appropriate building. Each name or address should be comma-separated, e.g.:
DNS servers: 172.19.32.5, 184.108.40.206, 172.19.47.5, 220.127.116.11
Search domains: cs.uwaterloo.ca, uwaterloo.ca
Via the Apple—System Preferences menu, click "Network". Then, show "Ethernet" (the one at the top of the list).
The preferred configuration is Using DHCP: click "Apply" and you're done.
For manual configuration:
- Configure IPv4: Manually
- IP address: aa.bb.cc.dd
- Subnet mask: usually 255.255.255.0. If you're not sure, consult an expert.
- Router: generally the ".1" address in your network, e.g. aa.bb.cc.1, but can vary. Consult an expert if uncertain.
- DNS server: comma separated list with the building appropriate servers, e.g. 172.19.32.5,18.104.22.168,172.19.47.5,22.214.171.124
- Search domains: cs.uwaterloo.ca,uwaterloo.ca
- Click "Apply"
Via the Control Panel—Network and Internet—Network Connections page:
Select the associated network interface (usually "Local Area Connection"),
Right-click and select "Properties".
On that properties page, select "Internet Protocol Version 4" and click the "Properties" button:
Fill in the two DNS server addresses from above (e.g. 172.19.32.5,126.96.36.199,172.19.37.5,188.8.131.52) and then click the "Advanced" button.
Select the "DNS" tab and add DNS server addresses as required.
You can also add more domains to your search list.