26 July, 2009

Configure Win XP TCP/IP settings from a limited account

I have occasional problems with my Internet provider when theirs DNS sever is down or does not respond for whatever reason. I have found recently that I can use different DNS server to overcome the situation. The remaining inconvenience is that one cannot change the TCP/IP from a limited account... unless one uses a command line shell with administrative rights.

Here I have found all I needed to change the parameters on the fly: Configure TCP/IP from the Command Prompt. First I have set the new DNS setting for my wifi connection the usual way, then I have dumped the setting to get the correct syntax.
netsh -c interface dump > filename.txt
The LAN connection still had the DNS set to the DHCP server, so from those two configurations I have created these two scripts to alter the settings:

to set up static DNS:
netsh interface ip set dns name="Wireless Network Connection" source=static addr=xxx.xxx.xxx register=PRIMARY
netsh interface ip add dns name="Wireless Network Connection" addr=xxx.xxx.xxx index=2
and to set up DNS from the DHCP server:
netsh interface ip set dns name="Wireless Network Connection" source=dhcp register=PRIMARY
- Change "Wireless Network Connection" with the network connection you want to configure.
- Replace xxx.xxx.xxx with your primary and secondary DNS addresses.

Another alternative is to use a graphical interface to change between different connection profiles: NetSetMan. It looks quite good but I use VirtualBox and that one has its own subnet address and configurations. I got the impression that the setting are applied to one of the network adapters but it is not clear to me what happens to the others... Using the netsh.exe I know for sure which adapter I am messing with. Also on some places I use the LAN most of the time then for a while the wifi with several different profiles (whatever is the local wifi access), then back to LAN. It starts to get messy. Usually I need the static DNS only in cases when the ISP's DNS does not work.
Update: From the support forum of the program it is clear that the setting in each profile are affecting only the selected network driver: NetSetMan & VMWare. This means that one can create a "static DNS" profile and select an adapter to which the settings should apply.

No comments: