Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Gets different IP every day [UNSOLVED]
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
peter_poulsen
Guru
Guru


Joined: 12 Feb 2003
Posts: 387
Location: Denmark

PostPosted: Fri Apr 08, 2005 12:06 pm    Post subject: Gets different IP every day [UNSOLVED] Reply with quote

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
View user's profile Send private message
rutski89
Guru
Guru


Joined: 14 Mar 2005
Posts: 468
Location: United States N.Y.

PostPosted: Fri Apr 08, 2005 1:16 pm    Post subject: Reply with quote

Are you referring to WAN or LAN IPs?
_________________
<< ^ | ~ >>
Back to top
View user's profile Send private message
nielchiano
Veteran
Veteran


Joined: 11 Nov 2003
Posts: 1287
Location: 50N 3E

PostPosted: Fri Apr 08, 2005 1:19 pm    Post subject: Reply with quote

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
View user's profile Send private message
nevynxxx
Veteran
Veteran


Joined: 12 Nov 2003
Posts: 1123
Location: Manchester - UK

PostPosted: Fri Apr 08, 2005 1:21 pm    Post subject: Reply with quote

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
View user's profile Send private message
Splink
Apprentice
Apprentice


Joined: 09 Feb 2005
Posts: 295

PostPosted: Fri Apr 08, 2005 1:28 pm    Post subject: Reply with quote

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
View user's profile Send private message
nielchiano
Veteran
Veteran


Joined: 11 Nov 2003
Posts: 1287
Location: 50N 3E

PostPosted: Fri Apr 08, 2005 1:32 pm    Post subject: Reply with quote

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
View user's profile Send private message
peter_poulsen
Guru
Guru


Joined: 12 Feb 2003
Posts: 387
Location: Denmark

PostPosted: Sun Apr 10, 2005 7:12 am    Post subject: Reply with quote

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
View user's profile Send private message
nielchiano
Veteran
Veteran


Joined: 11 Nov 2003
Posts: 1287
Location: 50N 3E

PostPosted: Sun Apr 10, 2005 7:30 am    Post subject: Reply with quote

that should do
Back to top
View user's profile Send private message
peter_poulsen
Guru
Guru


Joined: 12 Feb 2003
Posts: 387
Location: Denmark

PostPosted: Sun Apr 10, 2005 7:47 am    Post subject: Reply with quote

Unfortunately it doesn't :-( I still a get a new IP every day.
Back to top
View user's profile Send private message
FloppyMaster0
n00b
n00b


Joined: 07 May 2004
Posts: 62
Location: Detroit, MI, USA

PostPosted: Sun Apr 10, 2005 8:13 am    Post subject: Reply with quote

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
View user's profile Send private message
peter_poulsen
Guru
Guru


Joined: 12 Feb 2003
Posts: 387
Location: Denmark

PostPosted: Sun Apr 10, 2005 8:24 am    Post subject: Reply with quote

I'll give that a try.
Back to top
View user's profile Send private message
peter_poulsen
Guru
Guru


Joined: 12 Feb 2003
Posts: 387
Location: Denmark

PostPosted: Mon Apr 11, 2005 6:40 am    Post subject: Reply with quote

It seems to be working! Awesome! thanks
Back to top
View user's profile Send private message
peter_poulsen
Guru
Guru


Joined: 12 Feb 2003
Posts: 387
Location: Denmark

PostPosted: Tue Apr 26, 2005 6:55 am    Post subject: Reply with quote

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
View user's profile Send private message
c4
Guru
Guru


Joined: 21 Feb 2004
Posts: 312
Location: Sweden

PostPosted: Tue Apr 26, 2005 9:33 am    Post subject: Reply with quote

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
View user's profile Send private message
peter_poulsen
Guru
Guru


Joined: 12 Feb 2003
Posts: 387
Location: Denmark

PostPosted: Thu Apr 28, 2005 6:29 am    Post subject: Reply with quote

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
View user's profile Send private message
nielchiano
Veteran
Veteran


Joined: 11 Nov 2003
Posts: 1287
Location: 50N 3E

PostPosted: Thu Apr 28, 2005 2:09 pm    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum