# [solved] static ip - /etc/conf.d/net doesnt work

## selberbauer

Hi, because dhcpcd costs too much time getting an valid ip i want to switch to static.

I have a fritz!box which uses dhcp but gives the clients the same ip everytime.

Seems theres a Problem with my conf:

 *Quote:*   

> #config_eth0=( "192.168.178.29 broadcast 192.168.178.255 netmask 255.255.255.0" )
> 
> #routes_eth0=( "default via 192.168.178.1" )

 

/etc/init.d/net.eth0 restart

 *Quote:*   

> 
> 
>  * Bringing up interface eth0
> 
>  *   No configuration specified; defaulting to DHCP
> ...

 

ifconfig

 *Quote:*   

> 
> 
> ifconfig
> 
> eth0      Protokoll:Ethernet  Hardware Adresse 6c:f0:49:58:91:45  
> ...

 

Did i forget anything in the conf?

i dont get an error by restarting the interface but theres no local either inet connection

regardsLast edited by selberbauer on Fri Apr 01, 2011 7:33 pm; edited 1 time in total

----------

## DONAHUE

It looks as though this is a literal quote of /etc/conf.d/net; *Quote:*   

> #config_eth0=( "192.168.178.29 broadcast 192.168.178.255 netmask 255.255.255.0" ) 
> 
> #routes_eth0=( "default via 192.168.178.1" )

  the # makes the entries into comments; delete the # as in:

 *Quote:*   

> config_eth0=( "192.168.178.29 broadcast 192.168.178.255 netmask 255.255.255.0" ) 
> 
> routes_eth0=( "default via 192.168.178.1" )

 

 you can now use *Quote:*   

> config_eth0="192.168.178.29 broadcast 192.168.178.255 netmask 255.255.255.0"
> 
> routes_eth0="default via 192.168.178.1"

 which will be required format when/if baselayout2/openrc takes over

----------

## selberbauer

oh sry, i know that # is kommenting for bash. copied wrong..

could this problem exist because of an missing package?

 *Quote:*   

> 
> 
> /etc/init.d/net.eth0 restart
> 
>  * Bringing down interface eth0
> ...

 

----------

## DONAHUE

Let's try to define not connecting:

```
ping -c 2 192.168.178.1

ping -c 2 8.8.8.8

ping -c 2 google.com
```

any of these work?

if only 

```
ping -c 2 google.com
```

fails, suggest checking /etc/resolv.conf contains a valid nameserver entry. my /etc/conf.d/net contains one more line than yours *Quote:*   

> dns_servers="192.168.1.4 8.8.8.8"

 to set /etc/resolv.conf to use my local name server first with google's nameserver as backup.

----------

## selberbauer

 *Quote:*   

> 
> 
> X58A-UD7 / # /etc/init.d/net.eth0 stop
> 
>  * Bringing down interface eth0
> ...

 

This is the Problem:

Router 1 <WLAN> Router 2 <LAN> PC

I have access to the Router 2 over LAN when using the staticip, but the request are not being sent to router 1.

----------

## DONAHUE

crossed in the mail:

```
ping -c 2 google.com
```

fails, suggest checking /etc/resolv.conf contains a valid nameserver entry. my /etc/conf.d/net contains one more line than yours *Quote:*   

> dns_servers="192.168.1.4 8.8.8.8"

 to set /etc/resolv.conf to use my local name server first with google's nameserver as backup. suggest manual edit of /etc/resolv.conf to  *Quote:*   

> nameserver 8.8.8.8

  and 

```
ping -c 2 google.com
```

----------

## selberbauer

Ah now it works thank you for the help  :Very Happy: 

Is it recommend to set up an extra DNS-Server (or use a already operating one) or should I leave it by 8.8.8.8

regards

----------

## DONAHUE

google server is very fast and reliable, a local caching server can be faster for some repeat lookups i use my isp and then google as forwarders on local name server  

adding to /etc/conf.d/net one more line:  *Quote:*   

> dns_servers="8.8.8.8"

  should do nicely.

 *Quote:*   

> dns_servers="<your isp's nameserver ipaddress> 8.8.8.8"

 should be faster

----------

## selberbauer

Thanks this was it finally  :Very Happy: 

The resolv.conf was resetting by boot everytime, now i dont have to change it anymore   :Laughing: 

----------

## DONAHUE

enjoy!

----------

