Saturday, January 3, 2015

Retaining IP address when doing VM network adapter changes

In my one of the blog written long time back Changing network adapter type in VMware some of the users reported after doing VM network adapter type they are not able to retain, below dos command on the windows will be helpful, if you want to retain IPs and apply it through scripting.

 netsh interface ip dump > c:\ipaddress.txt  

If you open ipaddress.txt file, you will find below information.
 # ----------------------------------  
 # IPv4 Configuration  
 # ----------------------------------  
 pushd interface ipv4  
 set global icmpredirects=enabled  
 add route prefix= interface="Local Area Connection 2" nexthop= publish=Yes  
 add address name="Local Area Connection 2" address= mask=  
 # End of IPv4 configuration  

you just need to be sure changed new added or modified Network adapter interface name should match.

for restoring IP address information use below command.

 netsh -c interface -f c:\temp\ipaddress.txt  

No comments: