# can ping router but not internet

## zambizzi

Hey all,

I just finished a fresh install on an AMD box I had sitting around and I'm having some kooky problems w/ the ethernet card.

It's a Linksys card (no idea what model) that's about 2-3 yrs. old...the only driver that works for it is the "tulip" driver (as a module, won't work compiled into the kernel.)

Now, I can run the live CD and lsmod shows me "tulip" for the driver...and I can ping anything I want on the net from the live CD...no problems at all.

When booting normally after compiling/installing the kernel I get green lights all the way....eth0 gets an IP from my router and everything seems fine...however...I can only ping on my local network.  I can ping the router, any other machine...but nothing on the internet.  :Confused: 

There aren't any issues w/ either my router or the ISP I'm using...as I've been able to connect any number of PCs I want (wireless or not) and connect to the internet, no probs.  I just checked the dhcp clients table and the gentoo box is in there.

Any ideas?  I'd *really* like to get my X compile running before I hit the sack...it'd sure be nice to have a full system up by tomorrow afternoon, if possible...and this is the only thing holding me back.  :Rolling Eyes: 

Thanks!

----------

## eelke

Try setting the ip-address of the router as gateway. You can do so in /etc/conf.d/net.

----------

## keyson

Hi.

Check that you have a default route to your router.

```
route
```

should present something like this

 *Quote:*   

> Kernel IP routing table
> 
> Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
> 
> 192.168.1.0     *               255.255.255.0   U     0      0        0 eth0
> ...

 

If you don't have the default route, you may add it on comandline like this.

```
route add default gw 192.169.1.1
```

(change the ip to your lan router ip)

Now if you ping any external ip, it should know that it should send it via the

router. Don't forget to set your dns servers ip in /etc/resolv.conf otherwise

it would not resolv any names. And you can only use ip-numbers to connect.

----------

## zambizzi

Keyson,

The output from "route" is exactly as you described, down to the very last number.  I tried issuing the command "route add default gw 192.168.1.1" (that is the IP of my router) but I get this as a feedback:

 *Quote:*   

> 
> 
> SIOCADDRT: File exists
> 
> 

 

A ping to google.com afterwards yields the same result as before...no progress.

I checked my resolv.conf...it has the correct dns servers that were set during the gentoo install.

Any other ideas?

eelke - more details?  *where* is this done in /etc/conf.d/net?

Thanks!

EDIT:

I just pinged google.com by using the IP address instead of the domain name and it returns!  Obviously this means something is wrong w/ my resolv.conf...but what?  What should I set the DNS servers to if the ones that were used during my install are not correct?

----------

## zambizzi

OK, I went back into my windows box on the same network and did an ipconfig /all....the DNS servers didn't match up in  my /etc/resolv.conf on the gentoo box.

So, I made sure they matched up and Voila!  Now, this isn't really a solution...how can I keep from having to manually edit my resolv.conf every time my ISP decides to change something?  Could this be happening when I reboot my router (which I did earlier tonight)??

How can I set my DNS's to be dynamic!?  :Laughing: 

----------

## robdd

I guess you've got an ADSL or cable modem/router, that NATs your local net ?  If that's your seup then the router almost certainly got a configuration option to automatically do DNS for you. I have a D-Link DSL-504, and the setup page is titled Proxy DNS.  If your router has a similar feature you can turn on the DNS proxy facility, and just give the router's local net address as your DNS server.

But I can't imagine that your ISP will change the IP addresses of their name servers very often - if they do then it must be a real flaky low-budget outfit !!  You should be able to find out the IP addresses of their main and backup DNS servers, and put them into resolv.conf after your local router.  Try (with DNS working) to ping ns1.<your ISP's domain name>, ns2.-- and ns.--. They will almost certainly resolve, since system admins don't have much imagination when it comes to naming DNS servers.  :Smile: 

----------

## zambizzi

Well, it's Cable One which is a huge (and only) cable company here in Boise (which has a pop of around 350,000, including the burbs) but they're quite a hack organization.  My only other option was QWest (phone company, DSL)...or maybe one of the wireless carries.  Cable was the best bang-per-buck.

Anyhow, I'll see if it happens again, then I'll tinker w/ the proxy stuff on my router (Linksys WRT54G) - thanks for the help!

----------

## paddler

I never use my ISP's DNS server. I setup a caching nameserver on one of my gentoo boxs and let it resolve for all the hosts on my home network. (It goes right to the root servers and resolves it for you.) Takes my ISP right out of the loop (their nameservers are sloooow). You can use them as a secondary if you want although I use a much faster one I discovered out on the net.  Speeded up my name resolution response times quite a lot.  I like being in charge of anything I can be.

----------

## zambizzi

 *paddler wrote:*   

> I never use my ISP's DNS server. I setup a caching nameserver on one of my gentoo boxs and let it resolve for all the hosts on my home network. (It goes right to the root servers and resolves it for you.) Takes my ISP right out of the loop (their nameservers are sloooow). You can use them as a secondary if you want although I use a much faster one I discovered out on the net.  Speeded up my name resolution response times quite a lot.  I like being in charge of anything I can be.

 

I'm a software dev...not a networking guru...so this stuff is a little beyond me.  Got any good links on a simple setup like this that I could do if I setup a little gentoo server in my home office?

Thanks!

----------

## paddler

No problem... 

Some people use djbdns but I use bind. I just did this on my laptop and it worked fine..

get the bind package

```
emerge bind
```

get some dns tools like nslookup (optional)

```
emerge bind-tools
```

Edit /etc/bind/named.conf and add the IP address of your host. (change this line as needed)

```

listen-on { 192.168.11.69; };

```

This allows it to listen for requests  from other hosts on your network (only needed if other hosts on your network will be using this as their name server). You may need to open ports on your firewall to let those other hosts in.

edit /etc/resolv.conf and add this as the first line which tells it to use the localhost to resolve DNS. lookups.  

```
nameserver 127.0.0.1

```

You can (and probably should) have at least one more nameserver listed as a backup. It starts at the first one on the list and works its way down until one successfully resolves the name.

Start bind...

```
/etc/init.d/named start
```

make it load on boot

```
rc-update add named default
```

try it out...

nslookup yahoo.com

you should see something like this...

gentoo:> nslookup yahoo.com

Server:         127.0.0.1

Address:        127.0.0.1#53

Non-authoritative answer:

Name:   yahoo.com

Address: 216.109.112.135

Name:   yahoo.com

Address: 66.94.234.13

The 127.0.0.1 shows it used the local host. I don't use dhcp so I set the DNS server statically. Hope this works for your situation. Works great for me.

----------

