3

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?

2 Answers2

5

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.

Kyle Jones
  • 8,207
  • 2
  • 30
  • 52
1

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.

M Virts
  • 111
  • 1