LinuxQuestions.org
Go Job Hunting at the LQ Job Marketplace
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices

Reply
 
Search this Thread
Old 11-21-2001, 02:31 PM   #1
ccpirate
LQ Newbie
 
Registered: Nov 2001
Location: Portland, OR
Distribution: Red Hat
Posts: 8

Rep: Reputation: 0
Router DHCP and Linux Hostname


Ok, I apologize if this has been covered somewhere, but I swear I have been up one side of the Net and down the other looking for the answer to this question.

I have a Netgear314 router that works great for Windows and Linux. It is doing NAT for my home network and basic firewalling. It gets a static IP from my @Home provider, and then generates DHCP addresses for my internal network. These addresses are of the form 192.168.0.x

When I installed RH7.2, I specified the correct ethx device and selected DHCP. Since I have network connectivity on the linux box, it appears that it is indeed getting a DHCP lease from the router and that is working ok. However, the issue is that the hostname is somehow default assigned as DHCCP2 or somesuch. How do I change this hostname and still have everything work? (Incidentally lpd complains about this hostname when I shutdown, which may have something to do with why I can't get my USB printer to work, but I digress).

From others posts, it seems as if I should be able to name this thing "monster.mynetwork" or whatever I want and have it work, but I can't seem to get it to work. If I name it, then it loses network connectivity. If I don't name it, then I get this stupid hostname and lpd complains.

Anyone know what I need to do to fix this?

Thanks in advance.

Chris
 
Old 11-25-2001, 02:42 PM   #2
ccpirate
LQ Newbie
 
Registered: Nov 2001
Location: Portland, OR
Distribution: Red Hat
Posts: 8

Original Poster
Rep: Reputation: 0
No help huh? Come on, someone has to know something! Someone has this same or similar setup! At least tell me to RTFM!!!!
 
Old 11-25-2001, 03:05 PM   #3
finegan
Guru
 
Registered: Aug 2001
Location: Dublin, Ireland
Distribution: Slackware
Posts: 5,700

Rep: Reputation: 57
Redhat's netconfig basically creates a cute little gui-esque frontend for either changing an rc file (if you're running statics), or invoking dhcpcd if you're using dhcp.

Unfortunately, netconfig keeps you from being able to pass arguments to dhcpcd if you're indeed using that.

Check the man page on dhcpcd. I think you want to use the -R or -D option, but I'm not entirely sure from your post... and well, I have to run to lunch.

You can invoke dhcpcd on startup by sticking the line in /etc/rc.d/rc.local btw.

Luck,

Finegan
 
Old 11-26-2001, 02:09 PM   #4
krquinby
LQ Newbie
 
Registered: Sep 2001
Location: Portland, OR
Posts: 13

Rep: Reputation: 1
In the /etc/sysconfig/network-scripts directory there is a file for each interface called ifcfg-eth0 (or what ever interface you have). For an interface that recieves its network information via dhcp, there will be a line that looks like this:

BOOTPROTO=dhcp

Put the following lines in to see if it fixes your problem:

DHCP_HOSTNAME=yourhostname
DHCP_DOMAINNAME=youdomainname

Obviously, if you don't have an DNS domain you are using on your internal netowrk the domainname line is not required.

Kris
 
Old 11-27-2001, 07:45 AM   #5
ccpirate
LQ Newbie
 
Registered: Nov 2001
Location: Portland, OR
Distribution: Red Hat
Posts: 8

Original Poster
Rep: Reputation: 0
Ok, this last suggestion didn't work. I changed etc/sysconfig/network-scripts/ifcfg-eth1 to include DHCP_HOSTNAME = myhostname and nothing happened after rebooting (eth1 is where my card is at, I don't use the built in card at eth0). My machine is still named dhcppc2.

Any other suggestions?
 
Old 11-27-2001, 11:46 AM   #6
finegan
Guru
 
Registered: Aug 2001
Location: Dublin, Ireland
Distribution: Slackware
Posts: 5,700

Rep: Reputation: 57
eth1 is using dhcpcd to get its lease from the router. Under normal operation dhcpcd is built to not over-write the hostname with one sent by the router. This means that either:
A) Redhat's script is annoying. or,
B) Your router is really grouchy.

To find out which, boot the machine like normal, log in as root, and then bring down the eth1 interface and kill the dhcpcd lease with:

dhcpcd -k (-k is for kill the connection and clear all the dhcp cache)

The lease created by the Redhat init script is now dead.

change the name of the machine back to what its supposed to be. (This is assuming that the name stuck when the dhcp cache was killed. Hopefully it will revert.)

Open another terminal and try: tail -f /var/log/syslog
(this will give you a running log of what is happening)

In the first terminal try:

dhcpcd -d eth1 (-d is for it to log everything to syslog, and if the device isn't eth0, you have to give the device as an argument.)

try ifconfig to see if you have an IP.

If the hostname of your box is what it should be, then it was RedHat's init script. If it got re-named... look at that running log and see what the router forced it to do. If it force-fed dhcpcd a hostname, you'll probably have to poke around the config settings of the router.

Hope that helps,


Finegan
 
Old 11-27-2001, 12:13 PM   #7
mcleodnine
Senior Member
 
Registered: May 2001
Location: Left Coast - Canada
Distribution: s l a c k w a r e
Posts: 2,731

Rep: Reputation: 45
Try to find RedHat's script for dhcpcd (in my SuSE box it's /etc/init.d/dhclient) and look for the line that starts the client up. Make sure that there is no '-H' option when starting the client as that will force the client to use the hostname supplied by the dhcp server. You can get more info with 'man dhcpcd'
 
Old 11-28-2001, 08:48 AM   #8
ccpirate
LQ Newbie
 
Registered: Nov 2001
Location: Portland, OR
Distribution: Red Hat
Posts: 8

Original Poster
Rep: Reputation: 0
Well, when I run /sbin/dhcpcd -k I get:

**** /sbin/dhcpcd: not running

hence /sbin/dhcpcd -d doesn't do much either.

Incidentally, I don't have a file called /var/log/syslog
Is this bad?

I can't seem to find RedHat's init file unless it is: /etc/sysconfig/network-scripts/ifup

I did find a dhcpcd -H in there. I removed that and ran /sbin/ifup eth1, but nothing seemed to happen.

I'll try to reboot and see what happens.... sigh.
 
Old 11-28-2001, 11:52 AM   #9
finegan
Guru
 
Registered: Aug 2001
Location: Dublin, Ireland
Distribution: Slackware
Posts: 5,700

Rep: Reputation: 57
Quote:
Incidentally, I don't have a file called /var/log/syslog. Is this bad?
Yeah, it means that its been so long since I played with a Redhat machine that I forgot where they stick their version of syslog. That seemed right...

RedHat's init file is going to be somewhere in /etc/rc.d/ probably in init.d, or xinet.d (sp?) if its new... somewhere around run level 5 is my guess.

Sorry that's vague. I moved mostly to Slackware a while ago and they use a BSD-ish init, while RedHat (and most of the rest of the world) use SysV.

Okay... I guess the way to make sure that everything isn't demented is to try to get a lease from the ground up. Make sure that eth1 is down with ifconfig. Also make sure the machine's hostname is set to what you want it to. Then try:

dhcpcd eth1

That should ask the router for an IP, a pair of nameservers, a gateway address and nothing else.

when you cut dhcpcd -H out of /etc/sysconfig/network-scripts/ifup, did you cut out dhcpcd -H, or just the -H? Also, when you say that this didn't work... could you get a connection at all after changing ifup, or do you mean the router still shafted you with a crap hostname?

-Finegan
 
Old 11-28-2001, 02:27 PM   #10
ccpirate
LQ Newbie
 
Registered: Nov 2001
Location: Portland, OR
Distribution: Red Hat
Posts: 8

Original Poster
Rep: Reputation: 0
When I cut dhcpcd -H out of /etc/sysconfig/network-scripts/ifup, I just cut out the -H and changed it to -h "monster"

I got a connection when I brought up ifup, but it was still dhccp2 the crap hostname. At least, I couldn't ping monster and the command line still said username@dhccp2

I'll try the rest of your suggestions tonight.

Is it just me, or should this not be easier?
 
Old 11-28-2001, 04:37 PM   #11
mcleodnine
Senior Member
 
Registered: May 2001
Location: Left Coast - Canada
Distribution: s l a c k w a r e
Posts: 2,731

Rep: Reputation: 45
Have a look at /var/state/dhcp/dhcp-eth1.info or /var/lib/dhcpcd/dhcpcd-eth0.info (not too sure where RH keeps that stuff. It should contain the data recieved from the dhcp server after the lease negotiation.
 
Old 11-29-2001, 08:37 AM   #12
ccpirate
LQ Newbie
 
Registered: Nov 2001
Location: Portland, OR
Distribution: Red Hat
Posts: 8

Original Poster
Rep: Reputation: 0
Ok, I took the interface down with ifdown eth1. Confirmed it was down by making sure I couldn't ping. ran hostname monster

Then I tried /sbin/dhcpcd and got the below from /etc/dhcpc/dhcpcd-eth1.info (slightly modified to avoid hackers).

As you can see my hostname for dhcp is still dhcppc2

Tried it also as /sbin/dhcpcd -h monster eth1 and /sbin/dhcpcd eth1 -h monster and still got the same thing below. Any thoughts?

IPADDR=192.168.0.3
NETMASK=255.255.255.0
NETWORK=192.168.0.0
BROADCAST=192.168.0.255
GATEWAY=192.168.0.1
HOSTNAME=dhcppc2
DOMAIN=potlnd1.or.home.com
DNS=24.0.48.33,24.0.48.34
DHCPSID=192.168.0.1
DHCPGIADDR=0.0.0.0
DHCPSIADDR=192.168.0.1
DHCPCHADDR=00:01:02:4B:E6:13
DHCPSHADDR=00:30:AB:04:5D:0B
DHCPSNAME=c119XXXX-X
LEASETIME=4294967295
RENEWALTIME=2147483647
REBINDTIME=3758096377
 
Old 11-29-2001, 03:05 PM   #13
mcleodnine
Senior Member
 
Registered: May 2001
Location: Left Coast - Canada
Distribution: s l a c k w a r e
Posts: 2,731

Rep: Reputation: 45
OK. When sending a request for a DHCP address to most cable ISPs, you usually need to send the client-identifier (given to you when you signed up for the service). That is what the '-h' directive is used for. Sending '-h monster' won't do much for you as I doubt their server will see that as a valid client-id. If the '-H' is used, your dhcp client will set the hostname sent from the dhcp server. Use the client-id supplied by your ISP (dhcpcd eth1 -h your_client_id) Don't use the '-H' and all should be well.

...

carp!

I re-read the thread from the beginning. Your netgear router is giving out the IP address. Better read up on the netgear setup. The above applies for the negtiation between the router and your ISP. dhcpcd with no options should give you the correct results unless the router is forcing the hostname (doubt it).

Last edited by mcleodnine; 11-29-2001 at 03:11 PM.
 
Old 11-29-2001, 04:19 PM   #14
mjakob
Member
 
Registered: Feb 2001
Posts: 69

Rep: Reputation: 15
How's about just setting up the linux box with a static IP? Is it just a matter of pride to get the DHCP leases working or is there some other reason?

-Mark
 
Old 11-29-2001, 04:56 PM   #15
finegan
Guru
 
Registered: Aug 2001
Location: Dublin, Ireland
Distribution: Slackware
Posts: 5,700

Rep: Reputation: 57
You could try a static, although it probably won't work because these home routers typically won't forward unless you've gotten a lease from them.

Yeah, I'm with mcleodnine, your router is force-feeding your box that hostname. There has to be a way to disable that.

-cheers,

Finegan
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
DHCP hostname not set with a linux client tnine9 Linux - Networking 0 08-09-2005 08:48 AM
Forwarding dhcp requests through a Linux router fr_laz Linux - Networking 1 05-19-2005 08:14 AM
Linux router (DHCP, DNS) + Win XP homa2001 Linux - Networking 5 02-22-2005 10:23 PM
ADSL router / DHCP / Linux / Windows XP LAN shazam75 Linux - Networking 0 02-17-2005 05:17 AM
Questions around a home webserver DHCP and using Linux as Router hiplainsdrifter Linux - Networking 23 03-25-2004 03:29 PM


All times are GMT -5. The time now is 09:15 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration