# Unable to use local DNS.  From my firewall out it's fine??

## carlos123

How can I set the DNS IP that Gentoo will use to resolve domain names?  Through the command prompt?  

I want to bypass the hardware firewall that I have set up for my local network and use my ISP's DNS directly but I don't know how to set that up.  

I used ifconfig to set up my IP address, the broadcast and the netmask addresses.  Is there another utility that tells Genoo where to resolve DNS queries?  That I can set?  Or a configuration file that I can edit? 

I don't have a clue as to how I was able to use DNS since I installed Gentoo.  I never really indicated where the DNS server was at.  At least I don't remember doing so.  And things have worked okay since until yesterday.  

Yesterday I applied some patches to my Smoothwall firewall and DNS started to get real flaky until it failed completely a couple of hours ago.  At least within my local network.  I'm communicating with the forum by including the forum IP in my hosts file  :Smile: .  

From my firewall out it's fine.  

I can ping to IP addresses from my Gentoo box but not to domain names.  From my firewall I can ping to both IP's and domain names out to the Internet (through an SSH tunnel to my firewall). 

Any suggestions or ideas as to how I can resolve this?  

Also if it's advisable to post some output from things like ipconfig can someone tell me if it's a big no no to post my actual IP addresses in terms of being a great big security risk?  I don't want to advertise the IP's I am using so as to invite snoopers but on the other hand I want to resolve things quickly.  

Thanks.  

Carlos

----------

## psp

Add an entry to your /etc/resolv.conf file.

e.g.

```
nameserver <ip_of_your_dns_server>

nameserver <ip_of_second_name_server>

nameserver <ip_of_third_nameserver>
```

Without the '<' & '>' obviously...

Hope this helps...

----------

## easykill

do you use dhcp on your local network?

if so, make sure the /etc/resolv.conf of the machine that is the dhcp server has the external nameservers in it somewhere, because the /etc/resolv.conf on the dhcp client computers will be overwritten every time the dhcp client runs, i believe....

i could be wrong on that, honestly.

there may be a better way to make that work.

----------

## carlos123

I don't use DHCP on my local network.  I have in the past but no longer do so as it is not neccessary.  

I have two computers hooked up through a hub to a third computer dedicated to the operation of the Smoothwall firewall.  The Smoothwall CPU is set up to use DHCP between it and my ISP.  

One NIC on the Smoothwall connects to an ADSL modem out to the Internet.  The other NIC connects to my hub.  

My two internal computers have their own static addresses that I have assigned to them.  

I previously tried changing the entries in my /etc/resolv.conf file to no avail.  By putting in a "nameserver <ip_of_my_dns_server_at_my_isp>" entry.  I only put in one such entry.  

My Windows computer uses the same exact settings as my Gentoo one does in terms of netmask and DNS IP's.  It has it's own unique IP of course just like my Gentoo box.  

Ironically my Windows computer is working just fine in terms of connecting to the Internet and surfing about.  All I am now getting through my Gentoo box when I try a ping now is "Network is unreachable".  

I can HTTP out to my Smoothwall just fine.  I can start an HTTP Java SSH session through my browser out to my Smoothwall just fine.  But I simply cannot surf to the Internet through my Linux box.  

Despite having valid IP to domain name pairs in my /etc/hosts file I can't even browse to the domains I have listed.  It's as if the /etc/hosts file is not even being used!  For example inside my /etc/hosts file I have the following:

216.239.57.100  www.google.com

When I do a "ping www.google.com" from a terminal window of my Gentoo box I get the same "Network is unreachable".  I can't browse to it either. 

I don't think it's the hardware for if it was I wouldn't even be able to hook up to the Smoothwall through my Gentoo box NIC to use SSH or to access it through HTTP.  For the same reason I don't think it's the hub.  It's a 16 port hub and I have tried different ports.  Same problem keeps resurfacing.  

I guess I am completely stumped!!  

I know it's not the Smoothwall settings either for it was that then my Windows computer would not be able to access the Internet either.  Just like my Gentoo box can't.  

Anybody got any other suggestions or tests that I could run?  I've tried everything I know how and still no go.  

Thanks.  

Carlos

----------

## carlos123

I am happy to report that I was able to get hooked up to the Net again through my Gentoo box.  

I redid my /etc/resolv.conf file and unlike the last time I did that I also rebooted.  On rebooting it must have gotten picked up because my ISP name servers are now operational and allowing me to surf the net once again.  The nameservers themselves were definitely working based on my Windows box getting through.  

So I guess it was the /etc/resolv.conf file after all.  

How does one normally activate changes to /etc/resolv.conf other than by rebooting?

The last time I just tried "/sbin/ifconfig eth0 down" followed by a "/sbin/ifconfg eth0 up" but that didn't work.  

Thanks for any further insight.  

Carlos

----------

## yngwin

probably by 

```
/etc/init.d/net.eth0 stop

/etc/init.d/net.eth0 start
```

----------

## rtn

You don't have to do anything for changes to an /etc/resolv.conf to take effect.

It is read every time the resolver is called.

Take these examples:

Given this /etc/resolv.conf:

```
nameserver 192.168.1.1
```

```
$ strace host gentoo.org

[snip]

open("/etc/resolv.conf", O_RDONLY)      = 3

fstat64(3, {st_mode=S_IFREG|0644, st_size=23, ...}) = 0

mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x15

56a000

read(3, "nameserver 192.168.1.1\n", 4096) = 23

[snip]

```

```
$ strace host gentoo.org > foo 2>&1

$ grep nameserver foo

read(3, "nameserver 192.168.1.1\n", 4096) = 23

```

Change the nameserver entry in /etc/resolv.conf to something else and run

the same commands:

```

grep nameserver out

read(3, "nameserver 10.1.1.1\nnameserver 1"..., 4096) = 43

```

Changes to the /etc/resolv.conf were picked up.  No other changes were

made to the system.

--rtn

----------

## carlos123

Thanks rtn.  Excellent example and explanation!  

I think I have something just weird going on in my Gentoo system.  

Today I rebooted into Gentoo (just to be sure I got a clean start on everything - from my Windows days you understand  :Smile: ), logged in as root, and given that my KDE 3.1 had finished emerging previously, I then typed "kdm" (at the root prompt) and logged in as Carlos to KDE 3.1.  

Well as a result of all kinds of errors, I logged out (of KDE not the underlying root), and logged back in to use KDE 3.0..as carlos again.  

My Internet connection wasn't working.  

I opened a terminal window in KDE and did a "/sbin/ifconfig -a".  Sure enough eth0 was there and it looked good.  Right IP's and everything.  

Still no connection so....I tried "/etc/init.d/net.eth0 status" to see what was going on.  Said it was stopped.  

So...I figured I would just do a restart by "/etc/init.d/eth0 restart".  Instead of restarting I was greeted by a prompt saying something to the effect that it could not be restarted.  

What did I do?  Well I resorted to my good old tried and true technique for getting out of such scrapes from my Windows days.  I ...you guessed it...rebooted.  And it worked beautifully!  I now have full Internet connectivity once again.  

Of course, I don't want to be doing this too much more since I want to be able to honestly say that one does not have to reboot hardly at all in Linux so I want to solve all this lest I find myself lying through my teeth.  

Anybody got any ideas or testing methodologies as to how I could find out what is going on?  Could a KDE 3.1 emerge that went on in a terminal window of KDE 3.0 for close to a week (on and off) have screwed something up?  

If feel bad continuing to ask about my Internet connectivity and I sure don't want to take up anybody's time getting help but if you have any little tips you could throw my way I would very much appreciate it.  

Carlos

----------

## easykill

first of all, i don't recommend starting kdm as root and then logging in as a user

if you want kdm to start automatically edit your /etc/rc.conf file to have kdm as the manager of choice, and then as root

rc-update add xdm default

also, i don't think you can /etc/init.d/net.eth0 restart as a user, you didn't specify if you did it as root or as the user...?

----------

## carlos123

Thanks easykill.  Good suggestions. 

I will get to work on implementing them.  

What is interesting about my present setup is that I can surf just fine even when /etc/init.d/net.eth0 status reports that my network is in a stopped state.  Go figure.  Here is some output....

```

carlos@pine [~]

$ /etc/init.d/net.eth0 restart

cat: /mnt/.init.d/softlevel: Permission denied

/sbin/runscript.sh: line 354: /mnt/.init.d/foo.sh: Permission denied

rm: cannot remove `/mnt/.init.d/foo.sh': Permission denied

 * ERROR:  "/etc/init.d/net.eth0" has syntax errors in it; not

executing...

```

Valid enough given what you said easykill.  I can still surf at this point.  Continuing on...

```

carlos@pine [~]

$ su

Password:

root@pine [/home/carlos]

# /etc/init.d/net.eth0 status

 * status:  stopped

```

What is very odd or seemingly so is that I can still surf and access the Internet.  As proof...

```

root@pine [/home/carlos]

# ping www.google.com

PING www.google.com (216.239.57.100): 56 octets data

64 octets from 216.239.57.100: icmp_seq=0 ttl=49 time=130.9 ms

64 octets from 216.239.57.100: icmp_seq=1 ttl=49 time=131.3 ms

64 octets from 216.239.57.100: icmp_seq=2 ttl=49 time=132.9 ms

--- www.google.com ping statistics ---

3 packets transmitted, 3 packets received, 0% packet loss

round-trip min/avg/max = 130.9/131.7/132.9 ms

root@pine [/home/carlos]

# ping www.yahoo.com

PING www.yahoo.akadns.net (66.218.71.90): 56 octets data

64 octets from 66.218.71.90: icmp_seq=0 ttl=53 time=71.3 ms

64 octets from 66.218.71.90: icmp_seq=1 ttl=53 time=71.6 ms

64 octets from 66.218.71.90: icmp_seq=2 ttl=53 time=71.1 ms

--- www.yahoo.akadns.net ping statistics ---

3 packets transmitted, 3 packets received, 0% packet loss

round-trip min/avg/max = 71.1/71.3/71.6 ms

```

Now just to be smart and to see if I can get net.eth0 to report what is actually the case I try to restart it.  Like so...

```

root@pine [/home/carlos]

# /etc/init.d/net.eth0 restart

 * Bringing eth0 up...

 * Failed to bring eth0 up

[ !! ]

```

At this point my network is truly down and I am no longer able to surf.  No matter what I do.  So I reboot and come back to write this.  As you can see I was root when I tried to restart and no go.  

Here are some other interesting tidbits that immediately follow the above code...

```

root@pine [/home/carlos]

# ping www.google.com

PING www.google.com (216.239.57.100): 56 octets data

sendto: Network is unreachable

ping: sent 64 octets to www.google.com, ret=-1

sendto: Network is unreachable

ping: sent 64 octets to www.google.com, ret=-1

sendto: Network is unreachable

ping: sent 64 octets to www.google.com, ret=-1

--- www.google.com ping statistics ---

3 packets transmitted, 0 packets received, 100% packet loss

root@pine [/home/carlos]

# /sbin/ifconfig eth0

eth0      Link encap:Ethernet  HWaddr xx:xx:xx:xx:xx:xx

          BROADCAST MULTICAST  MTU:1500  Metric:1

          RX packets:266 errors:0 dropped:0 overruns:0 frame:0

          TX packets:246 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:100

          RX bytes:172424 (168.3 Kb)  TX bytes:28175 (27.5 Kb)

          Interrupt:11 Base address:0xb000

root@pine [/home/carlos]

# /sbin/ifconfig eth0 up

root@pine [/home/carlos]

# /sbin/ifconfig eth0

eth0      Link encap:Ethernet  HWaddr xx:xx:xx:xx:xx:xx

          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1

          RX packets:266 errors:0 dropped:0 overruns:0 frame:0

          TX packets:246 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:100

          RX bytes:172424 (168.3 Kb)  TX bytes:28175 (27.5 Kb)

          Interrupt:11 Base address:0xb000

root@pine [/home/carlos]

# /etc/init.d/net.eth0 status

 * status:  stopped

root@pine [/home/carlos]

# www.google.com

bash: www.google.com: command not found

root@pine [/home/carlos]

# ping www.google.com

PING www.google.com (216.239.57.100): 56 octets data

sendto: Network is unreachable

ping: sent 64 octets to www.google.com, ret=-1

sendto: Network is unreachable

ping: sent 64 octets to www.google.com, ret=-1

--- www.google.com ping statistics ---

2 packets transmitted, 0 packets received, 100% packet loss

root@pine [/home/carlos]

#

```

I xx.xx.xx.xx.xx'ed out the NIC MAC addresses fromt he code above by the way.  

Anyway I will try what you said easykill and see if things improve upon this.  Oh I neglected to mention that ALL the code sections above were done one after another.  With the exception of a failure to log in to root due to a typo in the password (which I left out). 

Thanks again.  

Carlos

----------

## netster

possible, that your dhcp-server isnt propper? normally the dns-

nameservers should be brought via dhcp too. so the dhcp-server

seams to have the wrong nameservers in the config, that the clients

get. 

to the second thing, that net.eth0 faild after restarting the device,

i would say your dhcp-server isnt propper too. try your windows box

with command "ipconfig /renew" to get a new ip-address of the dhcp.

if this fails also, i would see it as confirmed, that the (static?) ip's are 

not checked via the dhcp,so it's not giving them back again.

(i personally use a dynamic dhcp with 3 clients static config, lease-time

5minutes).

cheers

----------

## carlos123

Hi nester.  Thanks for your input.  

However I don't use DHCP to assign IP's internally to my two networked computers.  I have assigned static IP's to them.  

My hardware firewall (third computer) does use DHCP but it uses it to get it's own IP assigned to it by my ISP.  The two internal computers are hooked up to a hub which in turn is hooked up to my firewall (at one NIC) which in turn (through a second NIC on the firewall) is hooked up to an external ADSL modem out to the Internet.  

It doesn't matter whether the nameserver IP's in the /etc/resolv.conf are from my internal network or those of my ISP.  

The fact is that the Internet was indeed accessible yesterday but now is not (I am writing this through Redhat).  I can ping to my firewall just fine from Gentoo, I can ping out to the the Internet through an HTTP java SSH tunnel to my firewall, I can connect to the Internet through Redhat (on my first hard drive of my Linux computer), and through my second Windows computer just fine.  

The only problem here is my Gentoo installation and I am completely stumped about it.  

I started a new thread on this with a subject more in line with my lack of network connectivity than a lack of DNS.  Here is the new thread with much more info...

https://forums.gentoo.org/viewtopic.php?t=41071

Please post any further responses on that thread.  Thanks. 

Carlos

----------

