Assigning static IP address

busster8

Active Member
#1
I use my Lenovo twist for work. From time to time I have to assign a static IP address to my network card based on the customer premise. What I have found is that if I do a ipconfig from the command line, these static ip addresses are not released.
If I assign ip1, then customer site ip2, customer site ip3, all three ip addresses will show up doing an ipconfig from the command line. From time to time, this also plays havoc with my wireless network card.
The only way I have been able to resolve the issue is to remove the device(s) and reboot.
Upon reboot, both devices are back to dhcp and normal.
 


Saltgrass

Excellent Member
Microsoft Community Contributor
#2
I am not the network aware poster on this forum, but I was wondering what process you are using to set the IP addresses?

Have you looked into using Powershell to change the addresses and possibly there would be a way to script the actions you need?

I know you can start the Powershell Admin window by using Winkey and typing Powershell then CTRL+Shift+Enter. Or you could just attach it to the Taskbar or Start. I have found some references to changing IP Addresses using Powershell and will give you one that might be a good place to start.

Someone else on the forum might be able to give you an efficient way to do what you need.

How to Change Your IP Address Using PowerShell
 


busster8

Active Member
#3
I have just been going through the control panel to change IP settings.
 


Saltgrass

Excellent Member
Microsoft Community Contributor
#4
I haven't tried this either, but could you set up 3 or 4 network connections in the Network Connections panel? It appears, each name would have different configurations so you could enable or disable the ones you needed?
 


busster8

Active Member
#5
But the "name" of my network adapter is always "local area network". I just open control panel > Network > right click on "local area network" > Properties > ipv4 and set a static IP address. I didn't even know the ip addresses were "sticking" until I plugged into a clients network, thinking I was DHCP to get a IP conflict message. Doing a ipconfig from the command line let me know I the adapter still had about 4 ip addresses from previous customer sites.
 


patcooke

Microsoft MVP
Staff member
Premium Supporter
Microsoft MVP
#6
Static assigned IP addresses are not allocated on a "lease" basis as are DHCP allocations - they are assigned manually and remain so until "released" manually. You can do this from a command prompt using the ipconfig command. Once released setting DHCP allocation will allow the adapter to obtain a new address automatically. The release command may or may not be optionally supplied with further parameters - this basic from will release all IP addresses from all adapters

ipconfig /release

To release the address from a specific adapter you can add the name of the adapter, eg:

ipconfig /release Local Area Connection 1

You may also use "wildcards" to release a group of addresses, eg:


ipconfig /release Local*

will release addresses from all adapters starting with the word local.
 


Last edited by a moderator:

busster8

Active Member
#7
I understand all of the above. ipconfig /release has no effect. Reboots, both warm or cold have no effect. The only way I have found to clear the old ip addresses is to remove the device and reboot. Upon reboot, the device is back and in dhcp mode.
 


patcooke

Microsoft MVP
Staff member
Premium Supporter
Microsoft MVP
#8
Just to check - you have tried executing a release for specific named adapters as well as for all?
 


patcooke

Microsoft MVP
Staff member
Premium Supporter
Microsoft MVP
#9
Just realised, we have not mentioned setting the "obtain an IP address automatically" on the adapter properties - it this a case of missing the obvious - have you in fact done that to go from static to dhcp?
 


#10
Yes, you can change from static to dhcp. The adapter will get an ip address from the server. When you do an ipconfig, you will see the acquired ip address, AND the static ip addresses still listed. If you go to another site, get another ip address via dhcp, you will see the newly assigned ip address, the old ip assigned via dhcp is gone, but any staticly assigned ip addresses remain. The only way to remove them is to remove the device and reboot. DHCP assigned ip addresses work as expected. Only statically assigned ip addresses are troublesome.
 


Trouble

Noob Whisperer
#11
I'm not sure why this seems to be happening to you but you should be able to add, remove and or edit any IP address assigned to your NIC by using the advanced button -> IP Settings tab, in the properties of IPv4 within the properties of your Network Interface Card.
WinLogo Key + R and type
ncpa.cpl
hit enter
Select then right click your NIC (usually "Local Area Connection") and choose properties.
In the box / frame labeled "This connection uses the following items:" scroll as needed and select "Internet Protocol Version 4 (TCP/IPv4)" and click the properties button.
On the resultant dialog box click the "Advanced" button and under the IP Settings tab you should find any and all stored IP addresses for that particular NIC.
Any NIC can have and actually use multiple IP addresses as well as Gateways if you're very clever at writing complex route tables. Otherwise it's best to stick with a single address per interface. We used to play with this a lot when studying for RRaS.
Anyway you should be able to clean things up without removing the device and rebooting. If not there may be a more complicated underlying issue which might need a bigger hammer.
You may want to look into rebuilding the IP stack
netsh int ip reset resetlog.txt
and or the Winsock Catalog
netsh Winsock reset
Regards
Randy
 


Saltgrass

Excellent Member
Microsoft Community Contributor
#12
Randy, could the Alternate Configuration tab also be used to set up a static configuration. Then just select Private IP address, or User configured? Sometimes I find it useful to disable and then re-enable the Network adapter to resync.

I don't know how many configurations the OP might need, but these options might make it a little easier.

I took from the first post he has to assign a Static IP Addresse, for whatever reason. Hopefully that was a correct assumption.

I am also a little confused when he mentions the Static IP address continues to show in ipconfig with DHCP in place. Perhaps he is reading the wireless adapter also?

Edit: I found the following link, which seems to say if the computer cannot find a DHCP server on another network, it will automatically switch to the Alternate configuration.

http://technet.microsoft.com/en-us/library/cc779231(v=ws.10).aspx
 


Last edited by a moderator:

Trouble

Noob Whisperer
#13
I am guessing you are correct. When he walks into a particular environment (client's office or whatever) he for some reason is unable to receive proper IP addressing from whatever is present on the network providing DHCP. So as a work around he determines what the proper schema should be and assigns it manually as static values.
I have tried over and over again to duplicate his issues and have been unable to preserve any historic IP addressing data, excepting when I use the method I described above for assigning multiple IP address to the same interface.

The only issues with using the Alternate Tab resolution is;
1. If you have a static ip address assigned then the alternate tab is no longer available. So he would have to leave it as DHCP to begin with.
2. Some people have informed me that because of APIPA the NIC will always resolve to something in the 169.254.xxx.xxx range and as a result will sometime maybe even often not failover to the Alternate Tab settings.

I don't know as I seldom if ever use DHCP anymore. I guess I could experiment. If it works it might be a reasonably good approach, although it would likely still involve his having to adjust that addressing scheme to fit the alternate environment..
 


Trouble

Noob Whisperer
#14
OK, tested.
Disabled my other NIC.
Set the primary to DHCP and used the Alternate Tab to manually assign proper static values for my network.
Disabled DHCP on my Router and rebooted.
Initially it came up as "Identifying" took a minute or two and then decided that it was an "Unidentified" "Public Network" APIPA address 169.254.xxx.xxx and no default gateway.
Then after another minute or two it automatically went through a second round of "Identifying" and after about a minute it failed over to the IP addressing scheme that I had configured under the alternate tab.
Same thing happened after a second reboot.
So as an option, it's viable if you are patient enough.
Regards
Randy
 


#15
As a technician working on specifically Avaya phone equipment, you often have to assign a specific static ip address to your PC in order to connect to the equipment. i.e. 192.11.13.5 / 255.255.255.252 and connect to 192.168.13.6. You have no choice, these are the ip addresses. Alternately, if you work on Avaya IP office, you have to assign an IP address in the 192.168.42.x range. Direct connection to the equipment without any sort of dhcp service, you have no choice but to manually assign. Once ANY ip address is statically assigned, removal and reboot is the only way to remove the IP.

I am familiar with setting multiple ip addresses and gateways through the GUI, but usually, once you change your network settings to DHCP, static ip addresses/gateways are gone. From what I see, gateways are gone, but the ip addresses stay.
 


Trouble

Noob Whisperer
#16
Are you per chance using any third party software to configure or otherwise manage these particular network connections that might be causing the interface ip addressing to persist?
I cannot manage to create nor duplicate your problem, but......
If I am understanding you correctly, you are saying that a single interface has multiple and persistent IP addresses that you have configured over time and they will not go away unless you remove the card and reboot.
removal and reboot is the only way to remove the IP.
So..... all information regarding the IP addressing of all interfaces is contained in the registry here.....HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\Interfaces
If you are reasonably comfortable taking a peek under the hood, you'll notice (depending on the number of interfaces) a couple sub-keys under that location. Select each in turn until you see the one you are looking for. It should be reasonably evident as the data value for "IPAdress" will contain multiple IP addresses if my understanding of what you have explained is accurate.

You can edit this information simply by double clicking the "IPAdress" data value and editing as you wish. You should be able to remove any extraneous IP addresses as well as alter the one you are working with to reflect the value you wish. Not exactly an ideal solution I know, but it should save you a removal and a reboot.
NOTE: This has real time impact on your interface and does not require a reboot to take effect.
And my boiler plate registry editor warning:
Using the Windows Registry Editor can cause serious, system-wide problems that may require you to re-install Windows to correct them. It cannot be guaranteed that any problems resulting from the use of the Windows Registry Editor can be solved. If you choose to edit the Windows Registry please understand that you do so at your own risk so unless you feel fairly comfortable and confident you should probably not use the Editor. Changes made to the Windows Registry can take effect immediately and those that do not will take effect following the next reboot of your computer, and a current backup is not automatically made for you....So manually create a system restore point, backup the registry and export the key you are editing for safe keeping before doing so.
 


plirr

New Member
#17
I'm seeing this same problem, on a Dell Inspiron 15R with a Realtek NIC on Windows 8 and 8.1. Had it mostly stable changing IPs in 8 using netsh commands, but after fresh install and update to 8.1 problem has resumed. I change IPs very regularly as field tech for and ISP, when it corrupts with multiple IPs it often doesn't connect to the network even like it would if it was set up for multihoming. Further sympton is that even after static is set, the control panel shows DHCP, and can't be set to DHCP without netsh or powershell.
 


#18
I've experienced this as well. Namely with a Lenovo USB Ethernet 2.0 adapter. I can remove the ip's using:

netsh int ipv4 delete address name="Ethernet 3" addr=192.168.2.5

replace name and addr with the excess entries.

This is not an ideal solution as it still continues to keep the old ip addresses once you add more.

I haven't gone through this yet, but I think there might be some help here: http://social.technet.microsoft.com...indows-server-2008-sp2-x86?forum=winservergen

I'm also wondering whether any vm software is causing this? Do any of you have vmware player / workstation installed?
 


#19
I'm seeing this same problem, on a Dell Inspiron 15R with a Realtek NIC on Windows 8 and 8.1. Had it mostly stable changing IPs in 8 using netsh commands, but after fresh install and update to 8.1 problem has resumed. I change IPs very regularly as field tech for and ISP, when it corrupts with multiple IPs it often doesn't connect to the network even like it would if it was set up for multihoming. Further sympton is that even after static is set, the control panel shows DHCP, and can't be set to DHCP without netsh or powershell.
I am having pretty much the exact same issue on an Asus S400CA laptop. It just started happening randomly, as I have been on 8.1 for 6 months+. When I set a static and go back into the IPv4 properties, it shows that it's on DHCP. If I hit ok it does switch over to DHCP, but ipconfig shows the old IP address and gateway. Did anyone ever find a solution for this?
 


This website is not affiliated, owned, or endorsed by Microsoft Corporation. It is a member of the Microsoft Partner Program.