Setting static IP based on current dhcp for lan

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
julesverne
Posts: 81
Joined: 19 Nov 2013 00:41

Setting static IP based on current dhcp for lan

#1 Post by julesverne » 16 Feb 2016 21:48

Hi all, this seems to be something I have to do a lot, manually. Basically I have a cmd window open, I run ipconfig, and then go into the network configuration UI (win 7) to set it as static IP. The process is an annoying amount of steps. Before I go down the rabbit hole and reinvent the wheel..anyone figured this out already via bat?

foxidrive
Expert
Posts: 6031
Joined: 10 Feb 2012 02:20

Re: Setting static IP based on current dhcp for lan

#2 Post by foxidrive » 17 Feb 2016 00:40

Does this give you one or two solutions?

https://www.google.com.au/search?hl=en& ... mmand+line

Squashman
Expert
Posts: 4465
Joined: 23 Dec 2011 13:59

Re: Setting static IP based on current dhcp for lan

#3 Post by Squashman » 17 Feb 2016 19:27

You do not want to set a static ip address that is part of a DHCP servers address pool.

julesverne
Posts: 81
Joined: 19 Nov 2013 00:41

Re: Setting static IP based on current dhcp for lan

#4 Post by julesverne » 17 Feb 2016 20:13

Squashman wrote:You do not want to set a static ip address that is part of a DHCP servers address pool.

why? Is it because the server may assign that address to another computer on the network and cause conflicts?

Squashman
Expert
Posts: 4465
Joined: 23 Dec 2011 13:59

Re: Setting static IP based on current dhcp for lan

#5 Post by Squashman » 17 Feb 2016 20:47

julesverne wrote:
Squashman wrote:You do not want to set a static ip address that is part of a DHCP servers address pool.

why? Is it because the server may assign that address to another computer on the network and cause conflicts?

That is the whole point of a DHCP server. It knows what addresses it has allocated. It does not know you set a static IP address within the range of IP address of the pool.

julesverne
Posts: 81
Joined: 19 Nov 2013 00:41

Re: Setting static IP based on current dhcp for lan

#6 Post by julesverne » 18 Feb 2016 12:15

Squashman wrote:That is the whole point of a DHCP server. It knows what addresses it has allocated. It does not know you set a static IP address within the range of IP address of the pool.


Thank you @Squashman as ignorant as it sounds.. I had no idea. I hadn't really thought about it but I guess I probably figured the dhcp server would just detect that an IP was in use and pick another. I've been doing it for a long time and never had issues. I wasn't aware that it isn't good practice. Changing my habits now. Thanks again.

Post Reply