3
$\begingroup$

When you release your IP address using the ipconfig/release command and then renew with ipconfig/renew, the computer will request and receive the same address you had previously. Why is this so?

How would you (what commands would you use) so that your computer will not request the same address?

$\endgroup$
9
  • 1
    $\begingroup$ Most of the time, getting the same IP address every time is desirable. WHY do you want to get a different address? $\endgroup$
    – Neil
    Oct 28, 2021 at 13:22
  • $\begingroup$ Release/renew of course assumes DHCP (dynamically assigned) addresses. $\endgroup$
    – MSalters
    Oct 28, 2021 at 14:06
  • 1
    $\begingroup$ @Neil A common reason is to get around an IP ban at a gaming site. I'm not sure if there are any "good" reasons. $\endgroup$
    – Barmar
    Oct 28, 2021 at 14:48
  • $\begingroup$ I think the original poster is a bit confused on how a DHCP server allocates addresses. As I understand it, the requesting computer just asks for a valid IP address, and it's the DHCP server that assigns the address. If the user wants to force a different IP address, they should look into setting a static IP address, which will allow them to explicitly set whatever address they want. However, setting a static address within their DHCP range can (and usually will) eventually cause problems with address collisions, as the DHCP server only knows what it's allocated, not what's actually in use. $\endgroup$
    – Milwrdfan
    Oct 28, 2021 at 18:24
  • $\begingroup$ @Neil I don't actually want a new Ip address, I am just trying to find the answer to a question that my teacher asked at the end of class the other day(basically a food for thought question). I honestly do not know what the answer is, so I thought I could ask on this site in hopes of finding it out, as I am just trying to learn about this kind of stuff in hopes it will help me with a course I am currently taking. $\endgroup$ Oct 28, 2021 at 20:51

2 Answers 2

5
$\begingroup$

The DHCP protocol spec, RFC 2131, encourages a DHCP server to remember client configuration parameters when an IP address is released in the hope that the parameters can be reused when the same client requests a new address. So a conforming DHCP server implementation will typically offer the same IP address to a returning client if that address is still available. This is generally desirable to avoid having to (for example) update DNS records.

$\endgroup$
2
  • $\begingroup$ It looks like OP wants to somehow get a different address. Is there a way to request that in the DHCP protocol? Or is it completely out of the control of the client machine? $\endgroup$
    – DMGregory
    Oct 28, 2021 at 12:45
  • 3
    $\begingroup$ @DMGregory: In theory: Yes, the client machine could send a different "client ID" (which is usually 0x01 + the client's MAC address, but could also be a different MAC address, or 0x00 + arbitrary text label, or 0xFF + vendor-specific data – e.g. a hash-based ID used by systemd-networkd on Linux). However, as OP is using Windows, I don't think it allows changing the client ID at all. (Also, not all DHCP servers honor the client ID, some always look at the "real" MAC address. If you're talking to an ISP's DHCP server, they might even bind the lease to your physical line via "option 82".) $\endgroup$
    – user1686
    Oct 28, 2021 at 13:04
1
$\begingroup$

Although this doesn't answer the question directly, I think it may be relevant for some readers.

Because DHCP is optional, you can set whatever IP address you want for your device. Beware it's up to you to choose an address not already in use, also DHCP servers don't usually notice if a device is using an address in their pool and may assign the address you choose to some other device later on.

note I'm mostly talking about IPv4 since that's mostly where DHCP is relevant, v6 is somewhat different.

In some situations, you are locked into using an automatic address because you don't really control the device (ISP controlled devices, mobile networks).

In others (Corporate/School networks, LANs) you typically can configure the device to use a specific IP address (*nix: ifconfig [devname] 10.11.12.13, windows: Adapter settings gui > TCP/IP???).

Devices find each other by IP address independent of the DHCP server assigning an address. See Address Resolution Protocol.

If you manually set an IP address, it may at first seem like you have no access to the internet because DHCP can also provide your device with 'gateway' and DNS settings.

The gateway is the IP address to send traffic bound for addresses not in the local network. Without this your device will report that any IP outside your LAN is unreachable, even if name resolution (DNS) works. Default Gateway

The DNS server setting is the IP address that the device will query when attempting to turn domain names into ip addresses (name resolution). Without this (but with a good gateway, or directly on the internet) you will be able to connect to the ip address of public hosts (if you know the IP address) but won't be able to use names like 'www.google.com' to connect to another machine. DNS

If you just need to set your device IP address without using DHCP, you can copy the gateway and DNS settings from the DHCP assigned configuration to your manual configuration and set the IP address to anything within the same subnet as your gateway.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.