# static ip address{SOLVED}

## muhsinzubeir

I always use dhcp but i think i need a static ip address on my pc, so i googled en got to gentoo docs en ive read the net.example as well.This is my configuration of on /etc/conf.d/net

```
config_eth0=( "192.168.0.150 netmask 255.255.255.255 brd 192.168.0.255" )

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

The problem is that it assigns my machine to that ip address, but with no connection to the internet.Any idea what could cause this?

PS

I have a dhcp server on my a wireless router from sitecom, i still want to keep the dhcp server on it.Im planning to do some port forwarding on this router to my desktop, thats why i need a static ip address.

I appreciate guys...thanks

----------

## drwook

try 255.255.255.0 for the netmask as you're on a class C network range  :Smile: 

Although personally I'd use a DHCP reservation on the router.  At the least you should exclude your static address from the DHCP pool to avoid a conflict (although maybe unlikely at .150 on a home network, but still  :Wink:  )

----------

## muhsinzubeir

thanks drwook.

my dhcp range is .100-200{manually set}, so when i get back ill try something out of the range to see if it works.But why do u think .150 for home networking is not possible?

Unfortunately, the last time i checked my sitecom router doesnt support reservation but it was my first place to check.En im not pretty familiar with flushing new firmware.But if i have pretty good info i might consider doing it just to explore new possibilities, kinda of afraid to break the my lovely router  :Very Happy: 

Edit:

My sitecom is wl535 unsupported by dd-wrt, supported hardware:

http://dd-wrt.com/wiki/index.php/Supported_Devices#Sitecom

----------

## muhsinzubeir

still doesnt work ...this is my file now after applying the new ideas:

```
config_eth0=( "192.168.0.25 netmask 255.255.255.0 brd 192.168.0.255" )

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

PS:

Edit now i changed my dhcp range to .10-20

----------

## IvanMajhen

Try this:

```
config_eth0=( "192.168.0.25/24 brd 192.168.0.255" )

routes_eth0=( "default gw 192.168.0.1" )

```

----------

## muhsinzubeir

same results.....  :Crying or Very sad: 

----------

## IvanMajhen

Do you have dns servers set?

```
dns_servers_eth0=( "" "" )

```

----------

## think4urs11

do you really have no connection to internet at all or do you only have a problem resolving names?

what gives ping 209.177.148.229 and/or traceroute -n 209.177.148.229?

please provide the output for

- netstat -rn

- cat /etc/resolv.conf

- grep dns_servers /etc/conf.d/net

- ipconfig -a

----------

## muhsinzubeir

The problem is not having internet, only assigning static IP to my desktop is not working straight from boot not runlevel problem.I do have internet if  i use dhcp to acquire ip address from my router but that is not guaranteed to be the same all the time {depends on the mood of the router  :Razz:  }

But I have noticed actually right now, if i bootup my machine get the ip address set on my file but no internet connection....if i run dhclient i get another ip with internet, if i restart net.eth0 i get the static IP with internet...  :Confused: 

Then I took the following results, when it connects me after restarting my net.eth0 so with my static ip.

netstat -rn

```
Kernel IP routing table

Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface

192.168.0.0     0.0.0.0         255.255.255.0   U         0 0          0 eth0

127.0.0.0       0.0.0.0         255.0.0.0       U         0 0          0 lo

0.0.0.0         192.168.0.1     0.0.0.0         UG        0 0          0 eth0

```

gendesktop muhsin # ping 209.177.148.229

```
PING 209.177.148.229 (209.177.148.229) 56(84) bytes of data.

64 bytes from 209.177.148.229: icmp_seq=1 ttl=51 time=174 ms

64 bytes from 209.177.148.229: icmp_seq=2 ttl=51 time=184 ms
```

gendesktop muhsin # traceroute6 -n 209.177.148.229

```
traceroute: unknown host 209.177.148.22
```

gendesktop muhsin # cat /etc/resolv.conf 

```
# Generated by dhclient for interface eth0

nameserver 192.168.0.1
```

nothing set for dns_servers...do i need it?

```
grep dns_servers /etc/conf.d/net 

```

gendesktop muhsin # ifconfig -a

```
eth0      Link encap:Ethernet  HWaddr 00:1D:60:52:6D:79  

          inet addr:192.168.0.25  Bcast:192.168.0.255  Mask:255.255.255.0

          inet6 addr: fe80::21d:60ff:fe52:6d79/64 Scope:Link

          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1

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

          TX packets:1118 errors:0 dropped:0 overruns:0 carrier:1

          collisions:0 txqueuelen:1000 

          RX bytes:1184074 (1.1 Mb)  TX bytes:176626 (172.4 Kb)

lo        Link encap:Local Loopback  

          inet addr:127.0.0.1  Mask:255.0.0.0

          inet6 addr: ::1/128 Scope:Host

          UP LOOPBACK RUNNING  MTU:16436  Metric:1

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

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

          collisions:0 txqueuelen:0 

          RX bytes:18302 (17.8 Kb)  TX bytes:18302 (17.8 Kb)

sit0      Link encap:IPv6-in-IPv4  

          NOARP  MTU:1480  Metric:1

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

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

          collisions:0 txqueuelen:0 

          RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)
```

P:S

Typo ipconfig -a to ifconfig -a

----------

## muhsinzubeir

my rc-update show ....shows too much stuffs even not set

gendesktop muhsin # rc-update show

```
         acpid |      default                  

           alsasound | boot                          

             apache2 |                               

              autofs |                               

            bootmisc | boot                          

             checkfs | boot                          

           checkroot | boot                          

               clock | boot                          

         consolefont | boot                          

          consolekit |                               

            cpufreqd |      default                  

        cpufrequtils | boot                          

         crypto-loop |                               

               cupsd |                               

                dbus |      default                  

       device-mapper |                               

               dhcpd |                               

            dhcrelay |                               

             dmcrypt |                               

            dmeventd |                               

             dnsextd |                               

              esound |                               

              et-ded |                               

          fancontrol |                               

                fuse |                               

          git-daemon |                               

                 gpm |                               

                hald |      default                  

             hddtemp |                               

              hdparm |                               

            hostname | boot                          

               ivman |      default                  

          ivman-user |      default                  

             keymaps | boot                          

          lm_sensors |                               

               local |      default nonetwork        

          localmount | boot                          

               mdnsd |                               

  mDNSResponderPosix |                               

     mit-krb5kadmind |                               

         mit-krb5kdc |                               

             modules | boot                          

               mysql |                               

        mysqlmanager |                               

                 nas |                               

            net.eth0 |                               

              net.lo | boot                          

            netmount |      default                  

                 nfs |                               

            nfsmount |                               

                nscd |                               

          ntp-client |                               

                ntpd |                               

             numlock |      default                  

             omniORB |                               

             portmap |                               

             pwcheck |                               

           pydoc-2.4 |                               

           rmnologin | boot                          

            rpc.gssd |                               

          rpc.idmapd |                               

           rpc.statd |                               

         rpc.svcgssd |                               

              rsyncd |                               

               samba |      default                  

           saslauthd |                               

             sensord |                               

               snmpd |                               

           snmptrapd |                               

                sshd |      default                  

           syslog-ng |      default                  

      udev-postmount |                               

             urandom | boot                          

          vixie-cron |      default                  

                 vnc |      default                  

                 xdm |                               

              xinetd |      default                  

```

----------

## IvanMajhen

Add this to net

```
dns_servers_eth0=( "192.168.0.1" ) 
```

You can't use internet if you don't have dns servers specified.

----------

## muhsinzubeir

Thanks guys seemed like working now...that dns_server was the issue en i didnt know what it...but ill have to google later on  :Wink: 

```

dns_servers_eth0=( "192.168.0.1" )

config_eth0=( "192.168.0.25/24 brd 192.168.0.255" )

routes_eth0=( "default gw 192.168.0.1" )
```

I really appreciated....

cheers...

----------

