Monday, July 30, 2012

Internal DNS resolution in a Windows Network for Ubuntu or OSX

It is common for developers to use Ubuntu or other Linux/Unix flavors in Corporate environments where Windows Servers perform different Network fundamental operations like Domain Name System (DNS) and Dynamic Host Configuration Protocol (DHCP) Services.

For some reason I keep on finding that DHCP Servers are not configured to pass the domain to be used for searches. If that is your case you should wake your administrator up so they properly configure their DHCP Server but while you wait if you are running OSX (you probably know this) just change Network Preferences "Search Domain" option. If you are running Ubuntu Desktop AFAICS you will not be able to force a "Search domain" using the "Network Settings" applet while using DHCP. You will have to use command line (despites the warnings about not editing /etc/resolv.conf this trick does work still in version 12.04:
#!/bin/bash -e


USAGE="Usage: `basename $0` <domain>"

if [ $# -ne "1" ] 
 echo $USAGE
  exit 1 


sed "/search/d" $filePath  > tmp && echo >> tmp && echo "search $domain" >> tmp && mv tmp $filePath
service resolvconf restart
Of course this can be run locally, but also remotely through Remoto-IT.

No comments: