Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Get_Local_Host problem

Posted on 2002-03-15
5
203 Views
Last Modified: 2013-12-15
Hi guys,
My computer is connected to the internet through a cable model. When I first installed Red Hat 7.2, booting used to complain about not finding 'home'. So I added this to etc/hosts and was able to print with no problems. Suddenly, the booting sequence started to look for 'dhcp-85-291'! I added this to the etc/hosts and rebooted. 'Get_Local_Host' didn't return any problem and the printer was successfully restarted. However, 'sendmail' now takes ages before I can see the 'OK' and it doesn't seem to improve with subsequence rebooting. What I can't understand is why the kernel started looking for 'dhcp-85-291' instead of 'home' although nothing changed in my hardware or internet connection. And I hate the idea that for my printer to work I need to be connected to the internet (to get that dhcp-85-291' name from the ISP).
Is there any way I get my machine to realize 'home' again and forget about dhcp-85-291?
Thanks
0
Comment
Question by:hsaqallah
  • 3
  • 2
5 Comments
 
LVL 40

Expert Comment

by:jlevie
ID: 6867892
Does you hosts file have an entry for localhost. like:

127.0.0.1   localhost.localdomain localhost

For a system with a dialup connection you normally want the hostname command to return localhost, or if you have a local network the hostname for that network.

What does /etc/sysconfig/network contain and what is the output of 'ifconfig -a'?
0
 

Author Comment

by:hsaqallah
ID: 6870658
Hi,
1- My hosts file contains 127.0.0.1 localhost.localdomain localhost
2- Currently, the command 'hostname' returns 'dhcp-85-298' (yesterday it was returning dhcp-85-291)
3- The contents of /etc/sysconfig/network *surprisingly*:
     NETWORKING=yes
     HOSTNAME=localhost

The output of 'ifconfig -a' is: (please read my comment afterwards)
------------------------------------------------
dummy0    Link encap:Ethernet  HWaddr 00:00:00:00:00:00  
          BROADCAST NOARP  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)

eth0      Link encap:Ethernet  HWaddr 00:50:DA:08:7F:7C  
          inet addr:24.54.246.167  Bcast:255.255.255.255  Mask:255.255.254.0
          UP BROADCAST NOTRAILERS RUNNING  MTU:1500  Metric:1
          RX packets:6099 errors:0 dropped:0 overruns:1 frame:0
          TX packets:1077 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:100
          RX bytes:1081678 (1.0 Mb)  TX bytes:126791 (123.8 Kb)
          Interrupt:11 Base address:0x1800

eth1      Link encap:Ethernet  HWaddr 00:C0:F0:5C:AE:1D  
          inet addr:192.168.0.1  Bcast:192.168.0.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:4 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:100
          RX bytes:0 (0.0 b)  TX bytes:168 (168.0 b)
          Interrupt:3 Base address:0x1400

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:152 errors:0 dropped:0 overruns:0 frame:0
          TX packets:152 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:9988 (9.7 Kb)  TX bytes:9988 (9.7 Kb)
----------------------------------------------
Note that I have two ethernet cards. eth0 is the one connected to the cable-modem. eth1 has the address 192.168.0.1.

4- I tried to restart the machine while the cable-modem is disconnected (i.e. no internet). it looks liked 'Get_Local_Host' had no problem because the printer (lpd) was initialized successfully. However, 'sendmail' failed to initialize and Linux couldn't continue booting. This is strange because it means that if I don't have an internet connection at the time of booting then I'm screwed (unless I use the interactive mode and bypass sendmail.

Any ideas?
Husam
0
 

Author Comment

by:hsaqallah
ID: 6870667
One more thing. When rc.sysinit executes, it echoes 'Setting hostname localhost'
0
 
LVL 40

Accepted Solution

by:
jlevie earned 100 total points
ID: 6871337
Okay, I understand what's happening now and there is a trivial solution to both of your problems.

The trivial solution is to swap the use of your NIC's, making eth0 be the connection to the local network and eth1 being the connection to the cable modem. Also you'll need to make the systems hostname be that associated with the IP on the local network. /etc/sysconfig/network would then look something like:

NETWORKING=yes
HOSTNAME=home.localdomain

And /etc/hosts would contain:

127.0.0.1   localhost.localdomain localhost
192.168.0.1 home.localdomain home

Since eth0 is the first interface and since it will the IP associated with the hostname in /etc/hosts, sendmail should then be happy at boot and find the name of the system.

Look at /etc/sysconfig/network-scripts/ifcfg-eth1 and make sure that is doesn't contain a line like NEEDHOSTNAME=yes.
Since your cable modem isn't connected all of the time include ONBOOT=no to avoid hangs while the system is booting. When the cable modem is connected you can bring up the interface with '/sbin/ifup eth1'

0
 

Author Comment

by:hsaqallah
ID: 6881921
Sorry for being late :)
It worked perfectly. Just a quick note to anyone who will find this helpful. What 'jlevie' means by swapping is not 'physical' swapping of the cables (so the cable modem is connected to eth1), but rather it's a logical swap from the network configuration under Red Hat 7.2

Thanks,
h
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

rdate is a Linux command and the network time protocol for immediate date and time setup from another machine. The clocks are synchronized by entering rdate with the -s switch (command without switch just checks the time but does not set anything). …
How many times have you wanted to quickly do the same thing to a list but found yourself typing it again and again? I first figured out a small time saver with the up arrow to recall the last command but that can only get you so far if you have a bi…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.

861 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question