Where could I get the networks domain name

airportdnsdomainethernetNetwork

I am trying to determine domain name of my network.
I tried some programming methods, commands but i could not
get domain name of my network.I got ip address using cat /etc/resolv.conf

I was doing program to get domain name but i dont know even
where it is actually stored?

Can you tell me location where domain name is stored?

Best Answer

Macs don't store configuration information in flat files like most historical UNIX systems do and instead rely on various directory services.

Depending on how you configure the services (and which version of OS you run), the actual storage mechanism and location varies.

What will work is simply making a shell script to dump all the network information you care to document.

 domain name # will dump NIS domain if set
 grep ^search /private/etc/resolv.conf # will list DNS search domains
 grep ^nameserver /private/etc/resolv.conf # will list DNS servers by IP or name

As you see, even though the DNS information is stored in a directory, the OS will automatically generate a flat file in some cases since most programs look for and parse that file.

Should you need a primer on every command likely to be of use in tracking networking, you should run this command and then poke over the tar.gz report that gets saved to your desktop. It is a wealth of diagnostic data and shows how to dump mDNS information better than the manual pages and most written manuals.

  /System/Library/Frameworks/SystemConfiguration.framework/Resources/get-mobility-info