Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
SOLVED: Very strange hostname / DHCP issue
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
James Wells
n00b
n00b


Joined: 10 Sep 2004
Posts: 57

PostPosted: Wed Aug 16, 2006 2:31 am    Post subject: SOLVED: Very strange hostname / DHCP issue Reply with quote

Greetings,

I have recently begun having a strange problem on my laptop, when my system loses it's hostname entries after I start the wireless network.

To test this, I have run various combinations of hostname -a, hostname -f, etc. Before I bring up my wireless network, they all show the correct hostname and domainname combinations, however, after dhcp completes for my wireless device, all hostname entries fail. This causes various other things to fail my syslog-ng, kdeinit, sendmail, and a few others.

If I run /etc/init.d/hostname restart after dhcp completes for my wireless, everything works correctly, assuming that I haven't yet started any of the affected processes.

EDIT: I got around the issue by commenting out lines 135 - 146 in dhcp-3.0.5_beta1's /sbin/dhclient-script.


Last edited by James Wells on Sat Aug 19, 2006 2:33 am; edited 1 time in total
Back to top
View user's profile Send private message
magic919
Advocate
Advocate


Joined: 17 Jun 2005
Posts: 2182
Location: Berkshire, UK

PostPosted: Wed Aug 16, 2006 7:47 am    Post subject: Reply with quote

It's worth sticking your FQDN in the hosts file if you haven't already.
Back to top
View user's profile Send private message
James Wells
n00b
n00b


Joined: 10 Sep 2004
Posts: 57

PostPosted: Thu Aug 17, 2006 12:36 am    Post subject: Reply with quote

Yup. In my /etc/hosts file I have;
127.0.0.1 <MyLaptop FQDN> <MyLaptop> localhost.localdomain localhost

Something else I just noticed is that when I run DHCP at home, I get the same host as I have configured in my /etc/hosts so I have not issues there. Is there a way to tell dhcp not to set the hostname? I can see there is an option not to send the hostname, but I see nothing about not setting the hostname.
Back to top
View user's profile Send private message
UberLord
Retired Dev
Retired Dev


Joined: 18 Sep 2003
Posts: 6835
Location: Blighty

PostPosted: Thu Aug 17, 2006 6:32 am    Post subject: Reply with quote

Depends on which dhcp client you use. So which one is it?
_________________
Use dhcpcd for all your automated network configuration needs
Use dhcpcd-ui (GTK+/Qt) as your System Tray Network tool
Back to top
View user's profile Send private message
OldTango
l33t
l33t


Joined: 21 Feb 2004
Posts: 718

PostPosted: Thu Aug 17, 2006 2:56 pm    Post subject: Reply with quote

I need some assistance getting my network working properly again after a world update.

I am using dhcpcd for eth0 on the server to get an IP form my ISP and using DHCP (via eth1) to assign IP's automatically to the machines on the lan which are using dhcpcd to get their IP's

When I reboot the server I get a message telling me I need to update my /etc/conf.d/net file because I am using old style syntax. After reading the net.example file and changing some settings I can get eth0 to come up and get and IP but still get this errror message. Eth0 now comes up and gets an IP (via DHCP). DHCP fails to run (no error message) and eth1 comes up but dosen't get an IP.

Before my clients on the lan can use the internet or connect to the server I have to manually run
Code:
 ifconfig eth1 192.168.0.1 broadcast 192.168.0.255 netmask 255.255.255.0 up
every time.

I followed this little how-to http://www.gentoo.org/doc/en/home-router-howto.xml a couple of years ago to help set up my server but never used the built-in dhcp server in dnsmasq because I had installed DHCP and it was working just fine untill recently.

However things in gentoo have changed recently and now I need to deal with these error messages and get my server working correctly again.

TIA
Back to top
View user's profile Send private message
UberLord
Retired Dev
Retired Dev


Joined: 18 Sep 2003
Posts: 6835
Location: Blighty

PostPosted: Thu Aug 17, 2006 3:01 pm    Post subject: Reply with quote

Alas my crystal ball has broken, but I suspect you are getting that message as you're still trying to use an old var such as gateway or iface_eth0
_________________
Use dhcpcd for all your automated network configuration needs
Use dhcpcd-ui (GTK+/Qt) as your System Tray Network tool
Back to top
View user's profile Send private message
magic919
Advocate
Advocate


Joined: 17 Jun 2005
Posts: 2182
Location: Berkshire, UK

PostPosted: Thu Aug 17, 2006 3:02 pm    Post subject: Reply with quote

Did someone remove the New Topic button??
Back to top
View user's profile Send private message
James Wells
n00b
n00b


Joined: 10 Sep 2004
Posts: 57

PostPosted: Sat Aug 19, 2006 2:30 am    Post subject: Reply with quote

UberLord wrote:
Depends on which dhcp client you use. So which one is it?

Using dhcp-3.0.5_beta1.

Anyway, I found what was causing the issue, though I am unsure whether this is intentional or accidental. In /sbin/dhclient-script, around line 135, the client script checks to see if the current hostname is different from the dhcp assigned name. If they are different, then it sets the hostname to the dhcp assigned name. While I can see where this would be valuable, I think it would be even better if there was a way to disable this, short of commenting the offending lines out as I have done to get around the issue.
Back to top
View user's profile Send private message
lbrtuk
l33t
l33t


Joined: 08 May 2003
Posts: 910

PostPosted: Sat Aug 19, 2006 3:29 am    Post subject: Reply with quote

From /etc/conf.d/net.example:
Code:
# GENERIC DHCP OPTIONS
# Set generic DHCP options like so
#dhcp_eth0="release nodns nontp nonis nogateway nosendhost"

# This tells the dhcp client to release it's lease when it stops, not to
# overwrite dns, ntp and nis settings, not to set a default route and not to
# send the current hostname to the dhcp server and when it starts.
# You can use any combination of the above options - the default is not to
# use any of them.
Back to top
View user's profile Send private message
James Wells
n00b
n00b


Joined: 10 Sep 2004
Posts: 57

PostPosted: Sat Aug 19, 2006 4:11 am    Post subject: Reply with quote

The option you are showing, says to send or not to send the hostname to the DHCP server. As I understand it, that option has no effect if the dhcp server sends a pre-generated name. I should also point out that I already had the nosendhost option set and still had my hostname changed on me when I recieved a DHCP option host-name entry from the DHCP server. The only time it doesn't change is when I am at home where my DHCP server sends the hostname that my laptop uses ayway. ;)
Back to top
View user's profile Send private message
lbrtuk
l33t
l33t


Joined: 08 May 2003
Posts: 910

PostPosted: Sun Aug 20, 2006 1:35 am    Post subject: Reply with quote

I was more looking at the nodns entry. If the host settings your DHCP is sending you are breaking your connection, set nodns.
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