# Static IP troubles [FIXED!]

## loyx

I am trying to set the static ip so I can get it to work with azureus and it is giving me nothing but problems. It ceases to work, despite working that way some long time ago.

```

config_eth0=( "192.168.1.10 netmask 255.255.255.0" )

routes_eth0=( "default via 192.168.1.1" )

```

Is there something wrong here? 

Thanks.

Oh here is the output 

```
 

* Unmounting network filesystems ...                                     [ ok ]

 * Stopping ntpd ...                                                      [ ok ]

 * Stopping privoxy ...                                                   [ ok ]

 * Stopping eth0

 *   Bringing down eth0

 *     Stopping dhcpcd on eth0 ...                                        [ ok ]

 *     Shutting down eth0 ...                                             [ ok ]

 * Starting eth0

 *   Bringing up eth0

 *     192.168.1.10                                                       [ ok ]

 *   Adding routes

 *     default gw 192.168.1.1 ...                                         [ ok ]

 * Mounting network filesystems ...                                       [ ok ]

 * Starting ntpd ...                                                      [ ok ]

 * Starting privoxy ...
```

[/b]Last edited by loyx on Fri Oct 21, 2005 10:20 pm; edited 2 times in total

----------

## magic919

This IP bit looks ok and ifconfig would veryify.  What is 192.168.1.1 exactly?  Is it configured to forward port 6881 to 192.168.1.10?

----------

## loyx

 *magic919 wrote:*   

> This IP bit looks ok and ifconfig would veryify.  What is 192.168.1.1 exactly?

 

I am not sure, exactly. 192.168.1.1 is the address of my router I think, and 192.168.1.10 is supposed to be my ip address on the network.

I have a linksys router.

It just plain won't go on the internet.

 *Quote:*   

>   Is it configured to forward port 6881 to 192.168.1.10?

 

Actually it's the other way around, but with a different port number (6346)

----------

## magic919

What is 'the other way around'?

----------

## rouben

I think there's a way to tell your router to assign a static IP address to the MAC address of the network card in your Linux box. Most relatively modern routers allow that.

Given that the netmask is correct you should be able to go on the Internet. Unless your router is trying to be "smartass" and not routing any packets from hosts that it didn't assign IP addresses to (which is possible... but not very likely). My bet is your netmask is incorrect.

----------

## ac_static

I'm not so sure, that is the standard netmask for a class C address, which 192.168.x.x definately is.

loyx, I presume you've verified network continuity between your machine (192.168.1.10) and the router (192.168.1.1)?  Meaning, you can ping it and/or access its configuration via its web interface?

What's the output of the following two commands?

```
route -n

ifconfig

```

----------

## think4urs11

did you set an dns server in /etc/resolv.conf?

----------

## loyx

Oh, I forgot to say.. the it plain won't go on the internet WITH the static ip config on. It works "fine" with dhcp on. As in bad with torrent clients.

While in static ip mode, here is the route -n:

```

Kernel IP routing table

Destination     Gateway         Genmask         Flags Metric Ref    Use Iface

192.168.1.0     0.0.0.0         255.255.255.0   U     0      0        0 eth0

127.0.0.0       127.0.0.1       255.0.0.0       UG    0      0        0 lo

0.0.0.0         192.168.1.1     0.0.0.0         UG    0      0        0 eth0

```

and here is the ifconfig:

```

eth0      Link encap:Ethernet  HWaddr 00:08:02:22:07:64

          inet addr:192.168.1.10  Bcast:192.168.1.255  Mask:255.255.255.0

          inet6 addr: fe80::208:2ff:fe22:764/64 Scope:Link

          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1

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

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

          collisions:0 txqueuelen:1000

          RX bytes:17092391 (16.3 Mb)  TX bytes:3361286 (3.2 Mb)

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:310 errors:0 dropped:0 overruns:0 frame:0

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

          collisions:0 txqueuelen:0

          RX bytes:19613 (19.1 Kb)  TX bytes:19613 (19.1 Kb)
```

Compared to how it is set without static ip and with dhcp:

route -n: 

```

Kernel IP routing table

Destination     Gateway         Genmask         Flags Metric Ref    Use Iface

192.168.1.0     0.0.0.0         255.255.255.0   U     0      0        0 eth0

127.0.0.0       127.0.0.1       255.0.0.0       UG    0      0        0 lo

0.0.0.0         192.168.1.1     0.0.0.0         UG    0      0        0 eth0
```

and ifconfig:

```

eth0      Link encap:Ethernet  HWaddr 00:08:02:22:07:64

          inet addr:192.168.1.102  Bcast:192.168.1.255  Mask:255.255.255.0

          inet6 addr: fe80::208:2ff:fe22:764/64 Scope:Link

          UP BROADCAST NOTRAILERS RUNNING MULTICAST  MTU:1500  Metric:1

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

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

          collisions:0 txqueuelen:1000

          RX bytes:17093341 (16.3 Mb)  TX bytes:3362314 (3.2 Mb)

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:310 errors:0 dropped:0 overruns:0 frame:0

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

          collisions:0 txqueuelen:0

          RX bytes:19613 (19.1 Kb)  TX bytes:19613 (19.1 Kb)

```

[quote=ac_static]loyx, I presume you've verified network continuity between your machine (192.168.1.10) and the router (192.168.1.1)? Meaning, you can ping it and/or access its configuration via its web interface? [/quote]

Yes, I can ping and access my router with an internet browser with the static ip config on.

[quote=Think4UrS11]did you set an dns server in /etc/resolv.conf?[/quote] 

I did the instructions in the installation guide that had to do with resolv.confg (I can't remember exactly what), but I haven't touched it since.

Thanks for the help so far.

[edit] I forgot to mention, it was working fine like this for a while with the same settings for my config, but one day it just stopped working so I had to change it back to dhcp.

I can get the static ip working fine on windongs.

----------

## ac_static

I'm curious what is in your /etc/resolv.conf . 

One other question, while in static-ip, what happens if you try and ping a known good ip address: say 72.14.203.99 (www.l.google.com) or 216.183.157.5?

----------

## asterix404

This is going to sound kinda stupid but did you try turning dhcp off on your router? It may only be looking for like... something thats pluged into it to accept dhcp.

----------

## ac_static

Or, as rouben mentioned, most modern routers allow you to specify a "static" ip address for a given mac address... I'm not sure about linksys, but for d-link & netgear, you should find it under the dhcp configuration tab.

----------

## loyx

My resolv.conf:

```
  

nameserver 167.206.245.8

nameserver 167.206.245.7

nameserver 167.206.245.72

```

Oh yeah, those IP addresses work in static ip mode.

Odd...

----------

## ac_static

So its obviously a DNS issue.

FWIW: 167.206.245.8 does not appear to be running a dns server, so you might want to remove it from your list.  The other two refuse to resolve anything for me, but I'm not in CVNET's  subnet, so that is par for the course.

That copy of your resolv.conf, was that when set to a static ip, or when using dhcp? (dhcpcd will overwrite your resolv.conf unless told otherwise).

----------

## loyx

 *ac_static wrote:*   

> So its obviously a DNS issue.
> 
> FWIW: 167.206.245.8 does not appear to be running a dns server, so you might want to remove it from your list.  The other two refuse to resolve anything for me, but I'm not in CVNET's  subnet, so that is par for the course.
> 
> 

 

I commented 167.206.245.8

 *ac_static wrote:*   

> 
> 
> That copy of your resolv.conf, was that when set to a static ip, or when using dhcp? (dhcpcd will overwrite your resolv.conf unless told otherwise).

 

It was set up while running DHCP.

----------

## ac_static

So, that begs the question, what does /etc/resolv.conf contain when you use static ip address?

----------

## loyx

```

nameserver 167.206.3.224

nameserver 167.206.3.223

nameserver 167.206.3.158

```

Sorry, I forgot to post it.

[edit] FIXED! Finally! Thanks for the help guys. I fixed it by copying the nameserver ip adresses from the dhcp /etc/resolv.conf to the static ip /etc/resolv.conf!

Hope this helps someone in the future.

----------

## garbas

hola, 

i have similar problem but things mentioned before didn't help me.

i was also trying other thing mentioned in other podt but there was no whay that i could ping smth (except 127.0.0.1)

so here are some details:

/etc/resolv.conf

 *Quote:*   

> 
> 
> nameserver 192.168.2.1 #gateway
> 
> 

 

/etc/conf.d/net

 *Quote:*   

> 
> 
> config_eth0=( "192.168.2.2 netmask 255.255.255.0" )
> 
> routes_eth0=( "default gw 192.168.2.1" )
> ...

 

lsmod

 *Quote:*   

> 
> 
> 8139too
> 
> mii
> ...

 

lspci

 *Quote:*   

> 
> 
> Ethernet controller: Realtek Semiconductor Co., Ltd. RLT-8169 Gigabit Ethernet (rev 10)
> 
> 

 

i used genkernel during install.

is anything else needed?

and most funy thing about this problem is that is installed gentoo without any problems on my PC (i'm writing this from it).

i used the same commands on my leptop as on PC. the only diference is that PC processor is athlon xp and leptop pentium 4.

tnx for ur help in advance

----------

