DHCP assigning IP to others.

Discussion in 'NZ Computing' started by cowboyz, Jan 4, 2004.

  1. cowboyz

    cowboyz Guest

    How does a host computer decide who gets what IP.


    I ask because of the following.

    For about a month or more I have had an Xbox hooked into my PC. The PC is
    host and Xbox set to obtain IP automatically. Sometimes the Xbox is off,
    sometimes the PC is off. Doesn't matter which order you turn them on the IP
    of the Xbox is always 192.168.0.38

    That was until I wrote an automatic script to fetch my saved games off the
    xbox. Next reboot the xbox was on 192.168.0.12

    No big deal to get around it I set the Xbox to static IP but I was wondering
    how XP decides who gets what IP. If the Xbox had a different IP every day
    I could understand it. But then again, why isn't the Xbox allocated
    192.168.0.2? I would think that when assigning IP address's it would ping
    the next in queue and if no reply then give out that one.

    Is this a reasonable question or just one of those things we accept and move
    on?
     
    cowboyz, Jan 4, 2004
    #1
    1. Advertisements

  2. cowboyz

    Dave Taylor Guest

    It is microsoft, move along, nothing to see....

    The IP address was assigned using DHCP. If you do an ipconfig /all in a
    command window, (start, run, cmd, enter, ipconfig /all, enter) you will
    see a line listing the lease time. This is the amount of time that the
    DHCP server (your router, ISP whatever) has allocated for the MAC address
    of the XP machine. Windows does strange things, like randomize the next
    IP assigned, in its DHCP server.( A psuedo-security feature) In you
    situation you are better off with a staticly assigned IP for the Xbox.
    Never ever write scripts based on IP addresses in a DHCP environment if
    at all possible, as you have noticed.
    Ciao, Dave
     
    Dave Taylor, Jan 4, 2004
    #2
    1. Advertisements

  3. cowboyz

    Enkidu Guest

    It can't do that because the PC that is currently leased that address
    might be off, but may come on again before the lease expires. If it
    just pinged and gave out the address, then when the PC came on line
    there would be an IP address conflict. So it must give out an unleased
    address. Again it doesn't ping becuse it knows that there should be no
    machine likely to come on with that address.

    Sorry, I don't know the algorithm that is used!
    There may be something on it on the Internet I guess. Tried a Google?

    Cheers,

    Cliff
     
    Enkidu, Jan 4, 2004
    #3
  4. cowboyz

    T.N.O. Guest

    Also, if your machine is set not to reply to echo requests(pings) then
    it wont respond to pings(obviously) and the dhcp server would try to
    hand out that IP, and that aint gonna work.
     
    T.N.O., Jan 4, 2004
    #4
  5. cowboyz

    XPD Guest

    XPD, Jan 4, 2004
    #5
  6. cowboyz

    Enkidu Guest

    Yeah, but there's no good reason not to respond to pings on a network.

    Cheers,

    Cliff
     
    Enkidu, Jan 4, 2004
    #6
  7. cowboyz

    cowboyz Guest


    Oh. That makes sense.
    Not a particularly good security feature but .....
    I came to that conclusion too.
     
    cowboyz, Jan 4, 2004
    #7
  8. cowboyz

    cowboyz Guest


    Why is that? If PC1 was hosting at x.x.x.1 and PC2 was on and got assigned
    x.x.x.2 and PC3 was x.x.x.3 and then pc2 and pc3 were turned off and pc 3
    was turned on pc1 would ping x.x.x.2 to find it doesn't exist and allocate
    x.x.x.2 to pc3. When pc2 gets turned on pc1 would ping x.x.x.2 to get a
    reply so ping x.x.x.3 to get no reply so pc2 would become x.x.x.3.

    Seems logical.
    The only thing holding up this theroy is leases. But if there were no
    leases it would work fine.
     
    cowboyz, Jan 4, 2004
    #8
  9. cowboyz

    cowboyz Guest

    I didn't think that machines firewalled would respond in dhcp environment
    anyway (excluding host). Completely untested but I didn't think it would
    work.
     
    cowboyz, Jan 4, 2004
    #9
  10. cowboyz

    cowboyz Guest

    cowboyz, Jan 4, 2004
    #10
  11. heh, true, but it could happen if someone is a security freak.
    "gotta firewall everything"
    "Im being attacked by my ISP's DNS servers on port 53, mail servers on
    25 and 110, ring the admin and make them stop."
    It happens.
     
    T.N.O. - Dave.net.nz, Jan 4, 2004
    #11
  12. Depends on how it is setup.
    also I was meaning more along the lines of filtering rather than
    firewalling.
     
    T.N.O. - Dave.net.nz, Jan 4, 2004
    #12
  13. cowboyz

    Enkidu Guest

    That's a thought. If the fw stops broadcasts then DHCP will not work.

    Cheers,

    Cliff
     
    Enkidu, Jan 5, 2004
    #13
  14. cowboyz

    Enkidu Guest

    Well, yes, but the reason for leases is to cut down on all this
    pinging! Actually you've missed a step or three. When the machine
    starts up it either has a leased address or it doesn't. If it doesn't
    have a leased address, it doesn't know *anything* about the network,
    ie where the DHCP server is. So it broadcasts "Anyone give me an
    address"? The DHCP servers on the network respond "How about this
    one?" The client then broadcasts "OK, I'll take the one from server
    X". Server X says "Gotcha" and registers the lease. All other DHCP
    servers give up. The client receives the ACK from server X and starts
    using the DHCP info. If the lease is for a reasonable length of time
    (eg 2 days) the the client doesn't need to check for an address when
    it comes up, as it already has the lease information. Actually it will
    renew after half the lease time, generally about a day.

    And the IP addresses therefore tend to "stick" over a much longer
    period.

    Cheers,

    Cliff
     
    Enkidu, Jan 5, 2004
    #14
  15. cowboyz

    Enkidu Guest

    The benefits of DHCP are mostly for larger networks. Just plug a
    machine in and it works. Also DHCP supplies a lot more info, such as
    DNS servers and default gateway. Imagine having to visit several
    thousand machines to change the DNS gateway info with static
    configurations!

    Cheers,

    Cliff
     
    Enkidu, Jan 5, 2004
    #15
  16. cowboyz

    AD. Guest

    I seem to remember that it also happens at 75% as well.
    (From memory - corrections welcome) This is usually because the the 50%
    and 75% events aren't full renewals, more like a reconfirmation of the
    existing lease. The 100% check/renewal will normally just dish out the
    same address, unless further time had already passed and the lease
    had since expired - then you might end up with a new one.

    Although different DHCP implementations are bound to have slight
    differences.

    Cheers
    Anton
     
    AD., Jan 5, 2004
    #16
  17. cowboyz

    Enkidu Guest

    Pretty much. You can set it up to dish out a new IP address each time
    if you wish.

    Cheers,

    Cliff
     
    Enkidu, Jan 5, 2004
    #17
  18. cowboyz

    cowboyz Guest

    I think I am thinking too small.
     
    cowboyz, Jan 5, 2004
    #18
  19. cowboyz

    Enkidu Guest

    DHCP often causes problems in small setups. There are still advantages
    - resetting the DNS servers and default gateway for example, and the
    user doesn't need to know any networking. Just plug and go.

    Cheers,

    Cliff
     
    Enkidu, Jan 5, 2004
    #19
  20. cowboyz

    jerm Guest

    I have a laptop which moves between 2 DHCP networks, both assign the same
    address. (xxx.xxx.xxx.153)

    This was explained to me as ARP "binding" the IP address to the MAC address,
    and giving prior address priority in each case. Make sense?
     
    jerm, Jan 5, 2004
    #20
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.