# Network configuration

## ivanradanov

So I installed gentoo, managed to boot it, but cant get the inet to work. I have a router with 192.168.1.1 address and I have reserved 192.168.1.100 for my pc.

/etc/conf.d/hostname:

```
hostname="ivan-desktop"
```

/etc/conf.d/net

```
config_eth0="dhcp"
```

I emerged dhcpcd.

What should I have in my /etc/hosts file? I couldn't find how to configure it for dhcp. Sorry if it has already been explained somewhere, I did not manage to find it.

Edit: with /etc/hosts

```
127.0.0.1   ivan-desktop localhost

::1      ivan-desktop localhost
```

the output of ifconfig is:

```
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500

        inet6 fe80::21a:92ff:fe3e:b756  prefixlen 64  scopeid 0x20<link>

        ether 00:1a:92:3e:b7:56  txqueuelen 1000  (Ethernet)

        RX packets 12  bytes 7128 (6.9 KiB)

        RX errors 0  dropped 0  overruns 0  frame 0

        TX packets 99  bytes 11130 (10.8 KiB)

        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

        device interrupt 17  memory 0xcfee0000-cff00000  

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 16436

        inet 127.0.0.1  netmask 255.0.0.0

        inet6 ::1  prefixlen 128  scopeid 0x10<host>

        loop  txqueuelen 0  (Local Loopback)

        RX packets 8  bytes 560 (560.0 B)

        RX errors 0  dropped 0  overruns 0  frame 0

        TX packets 8  bytes 560 (560.0 B)

        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

```

And there is no internet (When I try pinging google it says "unknown host")

----------

## druggo

forget it:)

----------

## khayyam

 *druggo wrote:*   

> you need a dhcpclient, just install one:
> 
>  *Quote:*   emerge -av dhcpcd 

 

druggo ... the OP stated "I emerged dhcpcd" ... so that isn't the issue.

ivanradanov ... it looks as though your routers dhcp server isn't handing out the address, a possible misconfiguration on your part. How did you assign 192.168.1.100 to your machine? I would look at the router again, as it doesn't seem to be configured to hand out addresses correctly.

As for your configuration, you could self assign the address and not use dhcp like so:

```
modules_eth0="!plug iproute2"

config_eth0="192.168.1.100/24"

routes_eth0="default via 192.168.1.1"

enable_ipv6_eth0="false"

dns_servers_eth0="192.168.1.1" # assuming your router is also providing DNS
```

Otherwise, a dhcp configuration doesn't require anything in /etc/conf.d/net as its automatically assumed if nothing is provided therein. However, here is an example dhcpcd configuration.

```
modules_eth0="!plug dhcpcd"

dhcpcd_eth0="-t 10" # passed as parameters to dhcpcd, here a timeout of 10

enable_ipv6_eth0="false"

dhcp_eth0="nodns" # don't request DNS

dns_servers_eth0="8.8.8.8 8.8.4.4" # for using google's DNS servers
```

HTH & best ... khay

----------

## 666threesixes666

didja as root

```

rc-update add dhcpcd default

```

??????

merging the package is half the battle, you need to add the service to your startup scripts or on reboot it will not fire up or pull your ip info from the router.

after that ping 192.168.1.1

after that

```

cat /etc/resolv.conf

```

to show your dns is in it....

----------

## khayyam

 *666threesixes666 wrote:*   

> 
> 
> ```
> rc-update add dhcpcd default
> ```
> ...

 

666threesixes666 ... that is incorrect, you do not need dhcpcd in a runlevel as net.${IFACE} calls the dhcpcd client if its is configured to do so, or by default if no configuration is provided in /etc/conf.d/net.

So, this ... again ... has nothing to do with the issue.

best ... khay

----------

