# no internet--ping www.yahoo.com pin:unknown host www.yahoo.c

## snakeo2

my internet is not working. i have a small network and a router which gives me my ip address viah dchpcd. i was trying to emerge xorg and got a bunch of error messages abut network not being available. 

/etc/init.d/net.eth0 restart returns this

unmounting network filesystems   ok

bringing eth0 down                      ok

removing inet6 addresses             ok

stopping eth0..........                     ok

bringing eth0 up via DHCP

/sbin/runscript.sh: line 109: /sbin/dhcpcd: no such file or directory

does this mean that i dont have dhcpcd? because i remember emerging dhcpcd 2.0 something during installation

/etc/conf.d/net

iface_eth0="dhcp"

dhcpcd_eth0="nodns nontp nonis"

gateway="eth0/192.168.0.1"

thanks in advance

----------

## cyrillic

 *snakeo2 wrote:*   

> does this mean that i dont have dhcpcd? 

 

It kinda sounds like that from the error you are getting.

Try this, and see how many of these commands actually work.

```
# ls -l /sbin/dhcpcd

# emerge -pv dhcpcd

# dhcpcd eth0 
```

----------

## snakeo2

here you go

ls -l /sbin/dhcpcd

ls: /sbin/dhcpcd: no such file or directory

emerge -pv dhcpcd

These are the packages that i would merge, in order:

calculating dependenncies......done!

[ebuild N  ] net-misc/dhcpcd-2.0.0  - build -debug -static 119 kb

total size of downloads: 119kB

dhcpcd eth0

-bash: dhcpcd: command not found

can you post your /etc/conf.d/net file? thanks

----------

## PaulBredbury

 *snakeo2 wrote:*   

> [ebuild N  ] net-misc/dhcpcd-2.0.0  - build -debug -static 119 kb

 

N means New - you don't have dhcpcd installed.

----------

## Jaglover

You do not need DHCP to connect to internet, just set IP address, mask and gw with ifconfig. Add nameserver to resolv.conf and that's it. There is actually no reason why one should use DHCP on home network, I don't. It takes up about 1 MB of RAM and you can't address other computers by name simply by adding them into hosts file.

----------

## snakeo2

hey jaglover, let me get this straight

boot off the live cd and issue /sbin/ifconfig and write down the gateway, netmask and ip address. 

here is my ifconfig eth0

inet addr:192.168.0.2   Bcast:192.168.0255    Mask:255.255.255.0

BROADCAST MULTICAST MTU:1500  Metric:1

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

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

collision:0 txqueuelen:1000

RX bytes:518778 (506.6 kb) TX bytes:1274 (1.2 Kb)

interrupt:16 base address:0xa000

also, i have a dsl connection, what would happen when my current ip address expires, would i have to manually add it again or will be automatically added?

----------

## snakeo2

one more thing, how do i get nameservers? what command?

----------

## Jaglover

```

config_eth0=( "192.168.2.1 netmask 255.255.255.0" )

routes_eth0=( "default gw 192.168.2.254" )

```

Here is the content of my /etc/conf.d/net file. 

Your nameserver is probably your router, these do DNS caching nowadays.

You can use ifconfig to set up your connection, see man ifconfig for details. It's lost with reboot indeed.

Edit: you can do cat /etc/resolv.conf after booting up with livecd to see your nameserver.

----------

## cyrillic

 *Jaglover wrote:*   

> You do not need DHCP to connect to internet, just set IP address, mask and gw with ifconfig. Add nameserver to resolv.conf and that's it. 

 

True.

 *Jaglover wrote:*   

> There is actually no reason why one should use DHCP on home network, I don't. 

 

Typical routers people use at home provide DHCP, so this is the easiest solution.

 *Jaglover wrote:*   

> It takes up about 1 MB of RAM 

 

Unless you have a small enough amount of RAM to be worried about this, in which case it takes about 1MB of swap.  :Razz: 

 *Jaglover wrote:*   

> and you can't address other computers by name simply by adding them into hosts file.

 

I address my local machines by name without adding them to /etc/hosts.  I am currently running a local DNS server in my house with net-dns/dnsmasq, but before that I was using net-misc/mDNSResponder.

----------

## snakeo2

hey guys let me know if this would ok 

config_eth0=( "192.168.0.2 netmask 255.255.255.0" )

routes_eth0=( "default gw 192.168.0.255" )

and nameservers what would i use? also, for now i would like to use dhcp and later on i would like to set up a static ip to host websites withouth having to worry about routing ips , etc, at this point what can i do to install dchp since i dont have internet connection. can i boot off the live cd, chroot into my system, emerge dhcpcd, and follow the steps in manual to set up the network? thanks

----------

## Jaglover

 *cyrillic wrote:*   

> 
> 
>  *Jaglover wrote:*   There is actually no reason why one should use DHCP on home network, I don't.  
> 
> Typical routers people use at home provide DHCP, so this is the easiest solution.
> ...

 

Sure. They use DHCP and NAT provided by their modem. Then they add router/switch which does DHCP (and NAT) again and after this double-everything they wonder why net responds with lag.

----------

## Jaglover

Looks ok, snakeo2.

You can use any nameserver you know or want. Fastest response comes from one given you by your ISP.

----------

## cyrillic

I know some people that have all-in-one units that provide cable modem + router + wireless access point.  I would not recommend adding another router to this.

I only have a basic cable modem - no NAT, and my ISP only provides 1 IP address (via DHCP).  This doesn't add any lag (as far as I know).

----------

## snakeo2

hey jaglover, thanks for the reply. i guess in order to get nameservers, i would have to call my isp provider and get one from them?

----------

## snakeo2

ok added both those lines ot my /etc/conf.d/net file

config_eth0=( "192.168.0.2 netmask 255.255.255.0" )

routes_eth0=( "default gw 192.168.0.255" ) 

added the following lines to my /etc/hosts file

205.152.144.23

205.152.132.23

primary and secondary name servers

then tried ping www.yahoo.com

ping: unknown host www.yahoo.com

please advise

----------

## snakeo2

ran the following command

/etc/init.d/net.eth0 restart

/sbin/runscript.sh: line21: for: command not found

bringing eth0 up (192.168.0.2)...     ok

adding routes

   default gw 192.168.0.255....

SIOCADDRT: Network is unreachable   !!

----------

## mark_alec

Moved from Installing Gentoo to Networking & Security.

----------

## PaulBredbury

Replace 192.168.0.255 with the real IP address of your router (which is your gateway). It's probably 192.168.0.1

/etc/resolv.conf should be:

```
nameserver 205.152.144.23

nameserver 205.152.132.23
```

Edit: Fixed wrong reference to /etc/hosts  :Embarassed: Last edited by PaulBredbury on Thu Feb 23, 2006 12:21 am; edited 1 time in total

----------

## snakeo2

made the changes and it worked. i have one more question, everytime i reboot my machine whats the command i have to issue to bring up eth0 or have internet connection available? thanks in advance

----------

## PaulBredbury

To have e.g. /etc/init.d/net.ath0 started automatically at boot, run:

```
rc-update add net.ath0 default
```

You can also add custom commands to /etc/conf.d/local.start

----------

## Nu-kid

/etc/hosts should be:

Code:

nameserver 205.152.144.23

nameserver 205.152.132.23

Shouldn't the nameserver entries be put in /etc/resolv.conf. Not /etc/hosts  ?

----------

## PaulBredbury

 *Nu-kid wrote:*   

> Shouldn't the nameserver entries be put in /etc/resolv.conf. Not /etc/hosts  ?

 

Correct.  :Embarassed: 

----------

