Problem with DHCP, /etc/hosts and GNOME

Julien Olivier julo at altern.org
Thu Apr 8 16:19:19 UTC 2004


> Because some daemons are running and they need a working name scheme.
> 

OK that makes sense.

> Your hostname changes when connecting the internet through ADSL?

Yes it does. It changes from "localhost.localdomain" to
"rfc1918.space.should.not.be.used.on.publicips".

[julien at rfc1918 julien]$ hostname
rfc1918.space.should.not.be.used.on.publicips

>  I would
> understand that you establish the internet connection through your ADSL
> modem which acts as modem and router with DHCPD functionality.

That's right.

>  So only
> the external address of the modem/router should change and the internal
> address of the modem/router stays as it is (often 192.168.0.1 or from
> 10.0.0.0/8 net). You Fedora machine should not always get a new dynamich
> DHCP address from the router.

Here is what I get running ifconfig:

[julien at rfc1918 julien]$ /sbin/ifconfig
eth0      Link encap:Ethernet  HWaddr 00:00:E2:6F:C4:C1
          inet addr:192.168.196.9  Bcast:192.168.196.255 
Mask:255.255.255.0
          inet6 addr: fe80::200:e2ff:fe6f:c4c1/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:92905 errors:0 dropped:0 overruns:0 frame:0
          TX packets:64990 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:111199564 (106.0 Mb)  TX bytes:5752170 (5.4 Mb)
          Interrupt:10 Base address:0x7000
 
lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:2423 errors:0 dropped:0 overruns:0 frame:0
          TX packets:2423 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:1873932 (1.7 Mb)  TX bytes:1873932 (1.7 Mb)

But the problem is the IP address, but the fact that the hostname
changes, and that GNOME has no way to know which IP address matches it,
if I understand correctly.

>  Check your settings and define a DHCP
> hostname to be used (-> /etc/sysconfig/network-scripts/ifcfg-eth0).
> 

Here is what I have in /etc/sysconfig/network-scripts/ifcfg-eth0

[julien at rfc1918 julien]$ cat /etc/sysconfig/network-scripts/ifcfg-eth0
# Realtek|RTL-8139/8139C/8139C+
DEVICE=eth0
BOOTPROTO=dhcp
HWADDR=00:00:E2:6F:C4:C1
ONBOOT=yes
TYPE=Ethernet

Should I add something to force the hostname to localhost.localdomain ?

> If your situation is different please correct me with better
> information.
> 

No, you were all right.

> >  - Or, alternativeley, is there a way to ignore the hostname provided by
> > the DHCP connection and just stick to localhost.localdomain ? I found a
> > similar option in Anaconda but it doesn't seem to work.
> 
> localhost.localdomain or in short localhost is only for loopback
> purposes. Having a network connection you alsways have to have a proper
> hostname set and a relating entry (in addition to the localhost entry!)
> in /etc/hosts file, i.e.
> 
> 192.168.0.2  fedora.home.lan  fedora
> 

I'm not sure I understand it, because I made a script some time ago that
would reset my hostname to localhost.localdomain each time eth0 was
started. And I never had any network problem... Am I missing something
here ?

And in your case, who defined the fedora.home.lan ? Is it your DHCP
server, or did you set it yourself ?

Sorry... I'm a bit confused...

-- 
Julien Olivier <julo at altern.org>





More information about the fedora-list mailing list