# [SOLVED] i'm failing at static ip for some reason

## musasabi

so my network scheme goes:

router: 192.168.42.42

main machine (this one): 192.168.42.1

unraid server: 192.168.42.2

htpc: 192.168.42.3

xbox 360: 192.168.42.4

laptop:dhcp

except that... since i've installed gentoo this time around, i cannot get static IP working.

my current net config:

```
patrick@blackbox ~ $ cat /etc/conf.d/net 

# This blank configuration will automatically use DHCP for any net.*

# scripts in /etc/init.d.  To create a more complete configuration,

# please review /etc/conf.d/net.example and save your configuration

# in /etc/conf.d/net (this file :]!).

dns_domain_lo="anglednet"

#config_eth0=( "192.168.42.1/24" )

#routes_eth0=( "default via 192.168.42.42" )

config_eth0=( "dhcp" )
```

if i switch it over to the static config, it'll work in that it boots and i can ping my server/router, but i can't resolve google.com, etc.

simple as that. the interface is up, has an IP, knows its route, but can't get online. but with dhcp, everything's fine. what kind of nonsense is that?Last edited by musasabi on Thu Feb 17, 2011 2:49 am; edited 2 times in total

----------

## Veldrin

what is the content of /etc/resolv.conf if you switch to static, compared to dhcp? My guess it, that you are simply missing the dns entries. 

IIRC, if you switch to static, you have to set /etc/resolv.conf manually the first time.

Assuming, that your router know DNS forwarding, this should suffice

```
nameserver 192.168.42.42
```

as alternative, you may use the google DNS Servers

```
nameserver 8.8.8.8

nameserver 8.8.4.4
```

V.

----------

## musasabi

haha. as soon as i saw the "generated by dhcp" when i looked at resolv.conf, i facepalmed.

thank you.

just for posterity: i added "nameserver 192.168.42.42" to resolv.conf and now i'm online like normal.

any insight as to why having the routes entry in /etc/conf.d/net doesn't cover that?

----------

## Veldrin

routes and dns are to different sets.

to get basic ip connectivity only routing is required (apart from the ip address on the interface itself).

dns is for us stupid humans, who cannot remember ip addresses. plus it runs on top of the ip stack (dns = udp/53).

and dns servers are more static than routes, especially if you are thinking of a notebook. When ever you connect to a new network segment you routing changes. dns could remain the same (e.g if you would use google dns servers, or thinking of a corporate environment - few global dns servers). 

HTH

V.

----------

## musasabi

yeah, that clears it up. danke danke. =)

----------

