Solved

Get_Local_Host problem

Posted on 2002-03-15
5
200 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
Comment Utility
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
Comment Utility
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
Comment Utility
One more thing. When rc.sysinit executes, it echoes 'Setting hostname localhost'
0
 
LVL 40

Accepted Solution

by:
jlevie earned 100 total points
Comment Utility
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
Comment Utility
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

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Daily system administration tasks often require administrators to connect remote systems. But allowing these remote systems to accept passwords makes these systems vulnerable to the risk of brute-force password guessing attacks. Furthermore there ar…
This is the error message I got (CODE) Error caused by incompatible libmp3lame 3.98-2 with ffmpeg I've googled this error message and found out sometimes it attaches this note "can be treated with downgrade libmp3lame to version 3.97 or 3.98" …
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

743 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now