Tuesday, June 25, 2013

Useful netsh

Recently I was using Oracle on a virtual machine, and I found that I needed to switch between static IP and DHCP frequently. The little knowledge on netsh helped me a lot on releasing me from doing manual configurations.

1. Set it to static IP, as well as restarting oracle services.
net stop OracleServiceORADB1
net stop OracleOraDb11g_home1TNSListener
netsh interface ip set address "Local Area Connection" static 192.168.154.130 255.255.255.0
net start OracleServiceORADB1
net start OracleOraDb11g_home1TNSListener

2. Switch back to DHCP
netsh interface ip set address "Local Area Connection" dhcp

3. Store the current network setting
netsh -c interface dump > c:\netcfg.txt

4. Load the network configurations
netsh -f c:\netcfg.txt