Changing IP addresses?

Started by John Waalkes, November 10, 2011, 07:48:56 PM

Previous topic - Next topic

John Waalkes

Anyone know, or, better yet, have sample code for changing the IP address on a PC?


Thanks!

David Kenny

Normally, nothing on the PC changes the IP address.
Does your PC have a static IP address?  Because, in most cases, DHCP is used.  Your PC requests an IP address from the DHCP server on your network.  You can use the dos command "ipconfig /release" to release the IP address and then "ipconfig /renew" to request one.  But, usually, the DHCP server will give you the same one you had.

It's done that way to ensure that no two machines/devices end up with the same IP address. Why would you want to change it?
Sorry, more questions than answers. :(

David

Haakon Birkeland

There are plenty of occasions where a static IP is desirable â€" and necessary, and not only for printers and such.

It might be for a simple reason that one have a special application hosting some service on a port being forwarded
by the router â€" which then need to know the IP to forward the requests to. Then a dynamic IP from a DHCP host is no good at all, and that's why one often only lets the DHCP server distribute a part of the IP range available.

There are a couple of threads at the PowerBasic forum touching the subject of reading the IP and assosiated settings, but it's lacking the part in need here. If I'm not mistaken, there have been some talk there about components that might address this part of communicating through the net, unless you want to knock toyrself out on the subject at MSDN; http://msdn.microsoft.com/en-us/library/windows/desktop/aa365801%28v=vs.85%29.aspx â€" should be a relevant starting point ...
Haakon 8o)

John Waalkes

We have to change our IP address on the host PC while commissioning equipment all-day-looonnggg.  And since it's usually not one, but two different pieces of equipment, we end up making a half dozen IP address changes per startup.

So a utility to do this would be nice. The ones that I have found are always lacking in something, so I figured that I could do better. Besides, I've gotten very rusty in my FF & PB skills.

That, and it's either this or take safety training. :)


I can always shell out to the NETSH command, but I was hoping for something more elegant.


Thanks guys! :)