# [Solved] Yet another static ip thread..

## otisranson

Can't get my static ip to work.  I can't ping the outside world.  I can ping any computer on my local network though.

```

# 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 :]!).

modules=( "ifconfig" )

config_eth0=( "192.168.1.14/24" )

routes_eth0=( "default via 192.168.1.253" )

```

I've read the handbook here.  What am I doing wrong..?  If I dhcp the server, it will work and use the same default route (192.168.1.253).

Thanks for the help!Last edited by otisranson on Tue Jan 05, 2010 1:12 pm; edited 1 time in total

----------

## rtomek

I use 

```

config_eth0=(

         "192.168.123.125/24 brd 192.168.123.255"

)

routes_eth0=(

        "default via 192.168.123.254"

)

```

for eth0, but I also use iproute2 as I have two network interfaces.  I don't know if ifconfig needs that broadcast or not but that's the only difference I see.

----------

## otisranson

Should I use iproute2?  I've never tried it before.

----------

## mikegpitt

Perhaps it is a DNS issue?  What does your /etc/resolv.conf look like?

Your configuration looks correct... for example, here is mine configuration for my server:

```
config_eth0=( "192.168.1.100/24" )

routes_eth0=( "default via 192.168.1.1" )
```

----------

## otisranson

 *mikegpitt wrote:*   

> Perhaps it is a DNS issue?  What does your /etc/resolv.conf look like?
> 
> Your configuration looks correct... for example, here is mine configuration for my server:
> 
> ```
> ...

 

```
# Generated by dhcpcd from eth0

# /etc/resolv.conf.head can replace this line

nameserver x.x.37.23

nameserver x.x.144.23

nameserver x.x.150.23

```

X's obviously are other numbers.  :Smile: 

It looks all right to me.  We have numerous servers using static ip's with absolutely no problems.

----------

## mikegpitt

Can you post the output of `route`?

----------

## otisranson

```
Kernel IP routing table

Destination     Gateway         Genmask         Flags Metric Ref    Use Iface

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.253   0.0.0.0         UG    0      0        0 eth0
```

----------

## mikegpitt

It looks like your gateway is being set up properly (I assume that .153 is indeed your gateway).  Based on what you mentioned above, I also assume you can ping your gateway?

One thing I noticed is that you have this line in your /etc/conf.d/net:

```
modules=( "ifconfig" )
```

I personally don't have this in my configuration that uses static ip addressing.  Perhaps you should try commenting it out and see if that works.

----------

## cach0rr0

you sure it's 192.168.1.253 instead of 192.168.1.254? 

sorry if this is silly to suggest, it's just .254 as a gateway is very common, .253 is not 

In terms of /etc/conf.d/net, it doesn't take heaps honestly...I use this

```

dns_servers_eth0="8.8.8.8"

config_eth0=(

                "192.168.1.100 netmask 255.255.255.0 brd 192.168.1.255"

)

routes_eth0=( "default via 192.168.1.1" )

```

That machine is on baselayout-1 btw, for whatever that's worth.

----------

## otisranson

 *cach0rr0 wrote:*   

> you sure it's 192.168.1.253 instead of 192.168.1.254? 
> 
> sorry if this is silly to suggest, it's just .254 as a gateway is very common, .253 is not 
> 
> In terms of /etc/conf.d/net, it doesn't take heaps honestly...I use this
> ...

 

Yea, good suggestion on the .253, but it's our DSL line here.  I'll try and change my /etc/conf.d/net file around a little bit.  What is your "brd 192.168.1.255" ?  Broadcast?

Worked.  Thanks!

----------

## mikegpitt

 *otisranson wrote:*   

> What is your "brd 192.168.1.255" ?  Broadcast?
> 
> Worked.  Thanks!

 You are correct... brd is broadcast.  I guess you needed to explicitly state it for some reason.  I thought that 192.168.1.255 is the standard for that netmask, but maybe I'm wrong.

----------

