# network is unreachable

## Etsh

hi 

i used genkerenl to compile kernel

and i can ping to router 

but when i use "wget" says network is unreachable 

and "links " command not found 

any help plz

----------

## DONAHUE

run 

```
ping -c 2 google.com 

emerge wget

emerge links
```

What happens?

----------

## krinn

try

```
route add default gw <routerip>

ping -c1 google.com

```

----------

## Etsh

when i ping to any website says cant resolve hostname

----------

## Ahenobarbi

Please post results of "ifconfig" and "route".

----------

## DONAHUE

```
ping -c1 4.2.2.6
```

what happens?

are you using dhcp or fixed ip?

what is the content of /etc/resolv.conf?Last edited by DONAHUE on Sun Jul 19, 2009 3:55 pm; edited 1 time in total

----------

## Etsh

```

ifconfig

eth0  link encap : Ethernet   HWaddr -----------------------------

inet addr :192.168.1.201  Bcast : 192.168.1.255   Mask : 255.255.255.0

UP BRODCAST RUNNING MULTICAST MTU:1500 METRIC : 1

RX packets : 4 error : 0 dropped : 0 overruns:0 frame : 0

Tx packets : 3 error : 0 dropped : 0 overruns : 0 carrier:0

colisons : 0 Txqueuelen : 1000 RX bytes :537 (537.0 B) Tx bytes :116 (1160 B)

interrupt : 11 base address 0xe000

 

```

```

route

 kernel IP routing table

Destination     Gateway    Gemmask              flags  Metric   Ref   Use     Inface

192.168.1.0       *             255.255.255.0       U        0          0       0         eth0

loopback           *             255.0.0.0              U        0          0       0         lo

default        192.168.1.1    0.0.0.0                 UG      0          0       0         eth0

```

----------

## Etsh

 *DONAHUE wrote:*   

> 
> 
> ```
> ping -c1 4.2.2.6
> ```
> ...

 

the ping command worked well

and i ues fixed ip

content of resolv.conf is

```

#GENERated by net-scripts for interface lo

domain my-dnsdomain

```

when i use 

```
emerge links 
```

 says exactly

resolving mirror netcologne.de faild: Temporary failure in name resolution .....................................

and when i use wget 

unable to resolve host address 

 :Question: 

----------

## NeddySeagoon

Etsh,

What do you have in /etc/resolv.conf ?

I there are no nameserver lines add

```
nameserver <IPofRouter>

nameserver 4.2.2.1
```

This will try to use your router as you primary nameserver and fall back to a public one if that fails.

If you are using dhcp and you have no nameservers, your /etc/conf.d/net setup is incorrect. The above is a test and workaround, not a fix

----------

## Etsh

done  :Very Happy: 

i forget to define my dns server  :Smile: 

thanx for all helped me

----------

## DONAHUE

changed /etc/resolv.conf as neddy suggested and you are in business, however...

If you did this step of the handbook:

 *Quote:*   

> Code Listing 2.2: Setting the domainname
> 
> # nano -w /etc/conf.d/net
> 
> (Set the dns_domain variable to your domain name)
> ...

 

resolv.conf is going to be overwritten each time you restart the nic (reboot). remove dns_domain_lo=" from /etc/net to prevent rewriting /etc/resolv.conf.

if you are running a nameserver on your local network you can add it to resolv.conf.

If your isp has a nameserver and your router is set to relay to it you can add the router to resolv.conf.

example:  

 *Quote:*   

> nameserver 192.168.1.2   # a local nameserver
> 
> nameserver 192.168.1.1   # the router relay to isp nameserver 
> 
> nameserver 4.2.2.1          # a public nameserver

 

The search for a nameserver will go in the order of the list

----------

