View previous topic :: View next topic |
Author |
Message |
andreaseternach n00b

Joined: 26 May 2005 Posts: 29
|
Posted: Thu Sep 22, 2005 8:37 am Post subject: dhicpcd & /etc/hosts |
|
|
Hi guys,
i am quiete new to gentoo and have a question, which can be answers very fast by more experienced users (at least i hope):
When starting gnome i get an error message, similar like this:
Code: |
Can not resolve internet address for host tripol.
|
When trying to ping to tripol i get:
Code: |
tripol ~ # ping tripol
ping: unknown host tripol
|
I have one eth0 interface on my host, which is starting up with dhcpcd at boot time automatically. Ifconfig says:
Code: | tripol ~ # ifconfig
eth0 Link encap:Ethernet HWaddr 00:0A:E4:E0:7A:2F
inet addr:192.168.0.173 Bcast:192.168.0.255 Mask:255.255.255.0
inet6 addr: fe80::20a:e4ff:fee0:7a2f/64 Scope:Link
UP BROADCAST NOTRAILERS RUNNING MULTICAST MTU:1500 Metric:1
RX packets:1919 errors:0 dropped:0 overruns:0 frame:0
TX packets:1802 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:1521702 (1.4 Mb) TX bytes:285962 (279.2 Kb)
Interrupt:209 Base address:0x2400
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:130 errors:0 dropped:0 overruns:0 frame:0
TX packets:130 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:6500 (6.3 Kb) TX bytes:6500 (6.3 Kb)
|
The content of /etc/conf.d/net is:
Code: | tripol conf.d # cat net
# This blank configuration will automatically use DHCP for any net.*
# scripts in /etc/init.d. To create a more complete configuration,
# please review /etc/conf.d/net.example and save your configuration
# in /etc/conf.d/net (this file :]!).
config_eth0=( "dhcp" )
dhcp_eth0="nodns nontp nonis"
|
Any help would be gracefully appreciated.
Thanks in advance, Andreas |
|
Back to top |
|
 |
entemoehre n00b


Joined: 22 Jul 2003 Posts: 64
|
Posted: Thu Sep 22, 2005 8:54 am Post subject: |
|
|
As you already suggested in the title of your post, you need to make an entry for your host in /etc/hosts. I don't rmember the details of the entry format, but something like
should do the trick. Of course, you need to replace 192.168.0.3 with your hosts IP. Also have a look at the manpage (man hosts) and the comments in /etc/hosts to see whether I forgot something.
Hope that helps.
Regards,
soenke |
|
Back to top |
|
 |
andreaseternach n00b

Joined: 26 May 2005 Posts: 29
|
Posted: Thu Sep 22, 2005 10:16 am Post subject: proposal not working |
|
|
thanks for your reply.
I tried your proposal, but it does not work for my configuration.
The ip-address of my machine is not fixed to 192.168.0.3.
This address is dynamically assigned by the dhcp-server.
I need some mechanism to get the /etc/hosts aligned by dhcp to
the current configuration.
Unfortunately I have no idea how this can be done.
Maybe it is just an option of dhcpcd, but i dont know what and how to assign.
Regards,
Andreas |
|
Back to top |
|
 |
m_sqrd Guru

Joined: 18 Jul 2005 Posts: 367
|
Posted: Fri Sep 23, 2005 4:15 pm Post subject: |
|
|
try something like this in you /etc/conf.d/net file
Code: |
config_eth0=( "dhcp" )
postup() {
#!/bin/bash
if [ -e /etc/hosts ]
then
mv /etc/hosts /etc/hosts.sv
fi
source /etc/conf.d/hostname
source /etc/conf.d/domainname
IP=`grep IPADDR= /var/lib/dhcpc/dhcpcd-eth0.info |cut -f2 -d\=`
echo -e 127.0.0.1 '\t' localhost '\n'$IP '\t ' $HOSTNAME.$DNSDOMAIN '\t' $HOSTNAME >> /etc/hosts
# echo -e Setting Up Host file with our info . $IP '\t ' $HOSTNAME.$DNSDOMAIN '\t' $HOSTNAME
cat << EOF >> /etc/hosts
# IPV6 versions of localhost and co
::1 ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
ff02::3 ip6-allhosts
EOF
return 0
}
|
|
|
Back to top |
|
 |
andreaseternach n00b

Joined: 26 May 2005 Posts: 29
|
Posted: Thu Sep 29, 2005 12:51 pm Post subject: problem solved -> was a domain problem |
|
|
Hi guys,
in the meantime i solved the problem and want to share solution:
Problem was, that the dhcp server is an xp professional box.
This box uses for all distributed hosts the domain mshome.net.
But my linux box is in domain eternach.de !!!
This mismatch can be solved by updating the domain information by dhcpcd:
Code: |
config_eth0=( "dhcp" )
# nodns must be omitted to let dhcpcd update the domain information of localhost
#dhcp_eth0="nodns nontp nonis"
|
Regards,
Andreas |
|
Back to top |
|
 |
|