You are not logged in.

#1 2009-07-21 10:05:30

onguarde
Member
Registered: 2008-09-14
Posts: 144

Static IP Host Name Resolution Stopped working - Dhcp works

Peace all!

Recently, my internet connection went bogus. I traced it to a problem with host name resolution. Pinging my directly by ip seems fine but "ping www.google.com" gives unknown host error.

The command below magically fixes the problem suggesting the problem is with static ip and not hardware.

# dhcpcd eth0
dhcpcd: version 5.0.4 starting
dhcpcd: eth0: rebinding lease of 192.168.1.103
dhcpcd: eth0: acknowledged 192.168.1.103 from 192.168.1.1
dhcpcd: eth0: checking for 192.168.1.103
dhcpcd: eth0: leased 192.168.1.103 for 172800 seconds
dhcpcd: forking to background

When I killall dhcpd-eth0, ping www.google.com gives the unknown host error again.

Another weird thing is; the output of ifconfig, before and after the dhcpd command, is equivalent. Shouldn't dhcpd grab a new ip address?

# ifconfig
eth0      Link encap:Ethernet  HWaddr 00:0C:41:25:BE:64
          inet addr:192.168.1.4  Bcast:192.168.1.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:1168 errors:0 dropped:0 overruns:0 frame:0
          TX packets:1389 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:676797 (660.9 Kb)  TX bytes:153832 (150.2 Kb)
          Interrupt:19 Base address:0xc800

Here's the relevant static ip sections of my rc.conf,

lo="lo 127.0.0.1"
eth0="eth0 192.168.1.4 netmask 255.255.255.0 broadcast 192.168.1.255"
INTERFACES=(eth0 lo)

gateway="default gw 192.168.1.1"
ROUTES=(gateway)

Here's my resolv.conf

# Generated by dhcpcd from eth0
# /etc/resolv.conf.head can replace this line
nameserver 202.156.1.78
nameserver 202.156.1.68
nameserver 218.186.1.88
# /etc/resolv.conf.tail can replace this line

It seems to have been replaced by dhcpd but why doesn't it work when the same resolv.conf is used during static ip??

I'm stumped.

Last edited by onguarde (2009-07-21 10:15:17)

Offline

#2 2009-07-21 10:16:49

onguarde
Member
Registered: 2008-09-14
Posts: 144

Re: Static IP Host Name Resolution Stopped working - Dhcp works

http://bbs.archlinux.org/viewtopic.php?id=9497

Also, I tried the route add fix suggested above to no avail.

Any ideas?

Offline

#3 2009-07-21 11:18:56

fukawi2
Ex-Administratorino
From: .vic.au
Registered: 2007-09-28
Posts: 6,224
Website

Re: Static IP Host Name Resolution Stopped working - Dhcp works

Compare the output from the following commands, both when using dhcp and when using static. Let us know what the differences are:

ifconfig
route -n
cat /etc/resolv.conf
host archlinux.org
ping 66.211.213.17

Offline

#4 2009-07-22 00:01:02

onguarde
Member
Registered: 2008-09-14
Posts: 144

Re: Static IP Host Name Resolution Stopped working - Dhcp works

Ah, my bad.

I managed to solved it by reconfiguring pdnsd DNS config. Apparently, you are supposed to point resolv.conf back to your computer and specify the DNS servers in the pdnsd config files.

System setup

Now it's time to point your system toward your brand-new DNS server.

If you use DHCP to configure your network settings, you need to take a brief detour into the /etc/conf.d/dhcpcd config file. Add -C resolv.conf to the string of options. This prevents it from overwriting /etc/resolv.conf. It should look something like this:

DHCPCD_ARGS="-t 10 -h $HOSTNAME -C resolv.conf"

Now just edit /etc/resolv.conf and replace the contents with this:

nameserver 127.0.0.1

All that's left is adding pdnsd to your daemons array in /etc/rc.conf. It should be immediately after network, as it depends on the network to run, and some daemons that use the network rely on working DNS

Not sure what I did to screw it up. Probably dhcp overwrote it.

Thanks!

Offline

Board footer

Powered by FluxBB