File Types (33)
Internet Explorer (6)
Determine the DNS server address when connected through dialup
216 comments. Current rating: (210 votes). Leave comments and/ or rate it.
Question:I get the DNS server address assigned by my ISP dynamically and need to (programmatically) read the DNS server addresses.
Answer:Under Windows 2000 and newer, use the command line tool ipconfig with parameter /all:
This will return among other information all DNS server ip addresses. If you're writing code in a high-level language, span this program, redirect the output to a text file and afterwards read the lines preceeded by the keyword DNS-Server. (Valid for XP, the actual keyword may be different in other Windows versions.)
Under Windows 95 and Windows 98 there is no tool ipconfig. Instead you can use WinIPcfg (which is a graphical tool; cannot be read from your own application if that was desired.)
Under Linux the command is ifconfig.