Linux - NetworkingThis forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Introduction to Linux - A Hands on Guide
This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.
Click Here to receive this Complete Guide absolutely free.
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.
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:
Put the following lines in to see if it fixes your problem:
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.
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.
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'
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:
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?
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.
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.
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 04:11 PM.