View previous topic :: View next topic |
Author |
Message |
peter_poulsen Guru


Joined: 12 Feb 2003 Posts: 387 Location: Denmark
|
Posted: Fri Apr 08, 2005 12:06 pm Post subject: Gets different IP every day [UNSOLVED] |
|
|
At home where, I have a Gentoo box running a dhcp server, I get the same IP address on my laptop everytime I connect. However, at my University I get a different IP address every day. I have noticed that other Gentoo users have the same problem, whereas Mandrake users don't. Does anybody know why this happens?
PS. The university's servers are running some version of Solaris.
Last edited by peter_poulsen on Tue Apr 26, 2005 6:54 am; edited 2 times in total |
|
Back to top |
|
 |
rutski89 Guru


Joined: 14 Mar 2005 Posts: 468 Location: United States N.Y.
|
Posted: Fri Apr 08, 2005 1:16 pm Post subject: |
|
|
Are you referring to WAN or LAN IPs? _________________ << ^ | ~ >> |
|
Back to top |
|
 |
nielchiano Veteran

Joined: 11 Nov 2003 Posts: 1287 Location: 50N 3E
|
Posted: Fri Apr 08, 2005 1:19 pm Post subject: |
|
|
Just an idea:
gentoo, by default just asks for an IP.
Windows (and maybe Mandrake) ask for an IP and tell the DHCP server their hostname.
You can make gentoo send the hostname too by changing this line in the /etc/conf.d/net. It should read: Code: | dhcpcd_eth0="-h ${HOSTNAME%%.*}" |
(probebvely it's commented out or empty.
not sure if this will do; but it certainly doesn't hurt |
|
Back to top |
|
 |
nevynxxx Veteran

Joined: 12 Nov 2003 Posts: 1123 Location: Manchester - UK
|
Posted: Fri Apr 08, 2005 1:21 pm Post subject: |
|
|
Does DHCP not give th first available IP in the range out? That would be the sensable way to do it.
The fact that the uni will have more computers connecting/disconnecting everyday, means it will cycle through available IP's a lot quicker? _________________ My Public Key
Wanted: Instructor in the art of Bowyery |
|
Back to top |
|
 |
Splink Apprentice

Joined: 09 Feb 2005 Posts: 295
|
Posted: Fri Apr 08, 2005 1:28 pm Post subject: |
|
|
I think the "default" setting for the RFC for dhcp is that it maintains an 8 day lease time, no matter how many times you refresh your ip. This of course is configurable from dhcp sever to dhcp server. Gentoo on all machines I have used, have indeed picked up the same IP all the time.
Its different on the windows flavour of dhcp, where I can get anyone in a subnet. Gentoo appears to start at the the end of the octet and decreses by one each time as it allocates: 192.168.1.253, 192.168.1.252, 251, 250 etc I dont know if this is a behaviour within dhcp on gentoo, or whether its just designed to do it by cache mac addresses or something? |
|
Back to top |
|
 |
nielchiano Veteran

Joined: 11 Nov 2003 Posts: 1287 Location: 50N 3E
|
Posted: Fri Apr 08, 2005 1:32 pm Post subject: |
|
|
nevynxxx wrote: | Does DHCP not give th first available IP in the range out? That would be the sensable way to do it.
The fact that the uni will have more computers connecting/disconnecting everyday, means it will cycle through available IP's a lot quicker? |
It should give out the first availible one; but if you already HAD an IP, it sould give you that AGAIN.
But indead, if you have 254IP's and 300 clients rotating daily, the DHCP server will run out of IP's and recycle them, so you will end up with NEW ip's every time.
This is not the case here: Quote: | whereas Mandrake users don't |
|
|
Back to top |
|
 |
peter_poulsen Guru


Joined: 12 Feb 2003 Posts: 387 Location: Denmark
|
Posted: Sun Apr 10, 2005 7:12 am Post subject: |
|
|
nielchiano wrote: |
Just an idea:
gentoo, by default just asks for an IP.
Windows (and maybe Mandrake) ask for an IP and tell the DHCP server their hostname.
You can make gentoo send the hostname too by changing this line in the /etc/conf.d/net. It should read: Code: | dhcpcd_eth0="-h ${HOSTNAME%%.*}" |
(probebvely it's commented out or empty.
not sure if this will do; but it certainly doesn't hurt
|
This is my line from /etc/conf.d/net
dhcpcd_eth0="-t 10 -h ${HOSTNAME} -HD" |
|
Back to top |
|
 |
nielchiano Veteran

Joined: 11 Nov 2003 Posts: 1287 Location: 50N 3E
|
Posted: Sun Apr 10, 2005 7:30 am Post subject: |
|
|
that should do |
|
Back to top |
|
 |
peter_poulsen Guru


Joined: 12 Feb 2003 Posts: 387 Location: Denmark
|
Posted: Sun Apr 10, 2005 7:47 am Post subject: |
|
|
Unfortunately it doesn't I still a get a new IP every day. |
|
Back to top |
|
 |
FloppyMaster0 n00b

Joined: 07 May 2004 Posts: 62 Location: Detroit, MI, USA
|
Posted: Sun Apr 10, 2005 8:13 am Post subject: |
|
|
I think it might be an issue with the way Gentoo shuts down. I suspect that Mandrake and Windows don't release their lease when they shutdown. Gentoo does. You can disable this by tweaking the following section of /etc/init.d/net.eth0:
Code: | # Stop DHCP (should be N/A for aliases)
# Don't trust current configuration... investigate ourselves
if /sbin/dhcpcd -z ${i} &>${devnull}; then
ebegin " Releasing DHCP lease for ${IFACE}"
for ((count = 0; count < 9; count = count + 1)); do
/sbin/dhcpcd -z ${i} &>${devnull} || break
sleep 1
done
[[ ${count} -lt 9 ]]
eend $? "Timed out"
fi
|
Commenting out the entire section should do the trick. |
|
Back to top |
|
 |
peter_poulsen Guru


Joined: 12 Feb 2003 Posts: 387 Location: Denmark
|
Posted: Sun Apr 10, 2005 8:24 am Post subject: |
|
|
I'll give that a try. |
|
Back to top |
|
 |
peter_poulsen Guru


Joined: 12 Feb 2003 Posts: 387 Location: Denmark
|
Posted: Mon Apr 11, 2005 6:40 am Post subject: |
|
|
It seems to be working! Awesome! thanks |
|
Back to top |
|
 |
peter_poulsen Guru


Joined: 12 Feb 2003 Posts: 387 Location: Denmark
|
Posted: Tue Apr 26, 2005 6:55 am Post subject: |
|
|
Damm! It did not work anyway. I just happen to get the same IP for a couple of days in row
Any suggestions? |
|
Back to top |
|
 |
c4 Guru

Joined: 21 Feb 2004 Posts: 312 Location: Sweden
|
Posted: Tue Apr 26, 2005 9:33 am Post subject: |
|
|
There is an alternative aproach. I've set up dns clients for some friends, and they can access their boxes regardless of what ip they might have, as long as their dns is up to date.
You could get a free account here (dyndns.org) and use ddclient in portage to have it adjusted every 10 minutes or so. Might be worth a try if your ip doesn't stop changing. _________________ AMD64 Gentoo Hardened server
AMD64 Xubuntu Desktop
X86 Dreamlinux Vaio laptop |
|
Back to top |
|
 |
peter_poulsen Guru


Joined: 12 Feb 2003 Posts: 387 Location: Denmark
|
Posted: Thu Apr 28, 2005 6:29 am Post subject: |
|
|
Hmmm... I have been looking into the shutdown scripts of a Mandrake machine. It seems like they simply kill the dhcp client deamon (pid=`get_dhcp_pid()`; kill $pid). Can anybody tell me what bad consequences that may have? |
|
Back to top |
|
 |
nielchiano Veteran

Joined: 11 Nov 2003 Posts: 1287 Location: 50N 3E
|
Posted: Thu Apr 28, 2005 2:09 pm Post subject: |
|
|
not sure, but I thought that just killing dhcpcd doesn't do anything; it just kills the program. (Windows behaviour)
If you terminate it the "clean" way, it will release the lease and tell the DHCP-server it has stopped using it. |
|
Back to top |
|
 |
|