# Networking problems with static IP

## shoot

Hello there, I have a major problem with my eth0-config. I recently installed gentoo on my server to act as a webserver and a router. The problem is that I haven't really got started yet since my network seems to be giving me huge amounts of problems. I have a friend that has tried helping me to fix it, I'll get more to what we've already tried later, but first I'll give you some info about ifconfig eth0 and my ISPs settings.

First, I'm using a static ISP directly connecting to internet (no dhcp or automatic IP). this is my ifconfig eth0:

eth0	link encap: Ethernet HWaddr FF:FF:FF:FF:FF:FF

	inet addr: 83.227.xxx.xxx Bcast: 83.227.xxx.0 Mask:xxx.xxx.xxx.xxx

	UP BROADCAST NOTRAILERS RUNNING MULTICAST MTU:1500 Metric:1

there's also some more stuff below here but it's nothing of importance I think and it doesn't look suspicious either so. Anyway me and my friend has tried changing broadcast-ip and some other stuff(therefore the Bcast atm is 83.227.xxx.0, we think the problem is something with broadcast-ip since I can surf under windows on two other computers in the network easily.)

My ISP has given me some information for the static ip, such as the ip, netmask, gateway, dns1 and dns2. However, none about broadcast-ip. Also a note here is that my ISP is bredbandsbolaget. (http://bredbandsbolaget.se)

When I do /etc/init.d/net.eth0 restart it gives me zero errors, only "OK"'s. Pinging 127.0.0.1 works fine, but pinging my gateway or dnsservers just gives me "destination host unreachable". Btw, I've added the gateway using "route add default gw 83.227.xxx.xxx". 

Has anyone experienced this before, or is it just me? Since I can't seem to find any other thread that gives a valid help enough for me to get my net up.

Regards

shoot

----------

## magic919

You need to explicitly give it the IP, the subnet mask and the default gateway.  Your gateway may well be x.x.x.1.  You can verify these from the Windows machine, dare I suggest.

----------

## shoot

I have the information needed, I think. I have my static ip, gateway. netmask and two dns servers. I set eth0 up with ifconfig eth0 ${IP_ADDR} broadcast ${BROADCAST} netmask ${NETMASK} up.

I've also typed route add default gateway 83.227.xxx.xxx

I have no idea what to type as broadcastadress, I've tried my ip and 0 or 255 in the end instead of mine, which didn't work(Actually this is what net-setup eth0 told me to do first time. That's why I typed 83.227.xxx.255/0. I've also tried 0.0.0.0 with no success.)

Regards

shoot

----------

## magic919

Why do you feel the need to specify the broadcast address anyway?

Destination host unreachable suggests routing problem.  Skip the broadcast address, get the other stuff right and test.  Post then ifconfig and route outputs.

Would be much easier if you'd just substitute dummy numbers as you are just making it harder to help.  I'd have just hidden the first 2 octets personally and changed the third octet to help obscure if you must.

----------

## shoot

Sorry.

First I ran ifconfig eth0 83.227.xxx.216 netmask 255.255.255.192 up

Then route add default gw 83.227.xxx.193

After that i edited /etc/resolv.conf:

 *Quote:*   

> nameserver 195.54.122.200
> 
> nameserver 195.54.122.204

 

I am positive that I use the right numbers because this works on my two other

machines with windows.

ifconfig eth0 output:

 *Quote:*   

> 
> 
> eth0 Link encap:Ethernet HWaddr FF:FF:FF:FF:FF:FF
> 
> inet addr:83.227.xxx.216 Bcast:83.227.xxx.0*(again, I've tried 255 in the end and 0.0.0.0)* Mask:255.255.255.192
> ...

 

 *Quote:*   

> 
> 
> PING 127.0.0.1 (127.0.0.1) 56(84) bytes of data.
> 
> 64 bytes from 127.0.0.1: icmp_seq=1 ttl=64 time=0.040 ms
> ...

 

 *Quote:*   

> 
> 
> PING 83.227.xxx.193 (83.227.xxx.193) 56(84) bytes of data.
> 
> From 83.227.xxx.216 icmp_seq=1 Destination Host Unreachable
> ...

 

Am I doing something wrong here?

Regards

shoot

----------

## P3SM

Just my 2c:

Your broadcast address should be 255 as that is the last address in your subnet which runs from 83.227.xxx.192 (network address) till 83.227.xxx.255 (broadcast address) when your address is 216 with a /26 subnet.

I normally use the following command to put in my default route:

```
route add -net default gw a.b.c.d netmask 0.0.0.0 metric 1 eth0 
```

I think it should be machine independent (I use it on Sparc).

Last thing I can think of: did you try pinging the default gw from your windows machines? Meaning are you sure the default gw returns pings  :Confused: 

----------

## shoot

Firstly, thanks for the idea, I'll try it out soon(I'm making dinner now so it's quite a bad timing to test it right now  :Razz: )

Second, regarding this:

 *Quote:*   

> Last thing I can think of: did you try pinging the default gw from your windows machines? Meaning are you sure the default gw returns pings 
> 
> 

 

I tried it now, and it does work:

 *Quote:*   

> Sending signals to 83.227.xxx.193 with 32 byte data:
> 
> Answer from 83.227.xxx.193: byte=32 tid=20ms TTL=255
> 
> Answer from 83.227.xxx.193: byte=32 tid=20ms TTL=255
> ...

 

Regards

shoot

----------

## shoot

 *P3SM wrote:*   

> Just my 2c:
> 
> Your broadcast address should be 255 as that is the last address in your subnet which runs from 83.227.xxx.192 (network address) till 83.227.xxx.255 (broadcast address) when your address is 216 with a /26 subnet.
> 
> I normally use the following command to put in my default route:
> ...

 

Ok, so I did type this in:

```
route add -net default gw 83.227.xxx.193 netmask 255.255.255.192 metric 1 eth0
```

Restarted eth0 with /etc/init.d/net.eth0 restart and it gives no error or anything. Pinging my gateway or anything else for that matter still doesn't work. 

Regards

shoot

----------

## magic919

You'd have to say that even without a gateway defined you should be able to ping the gateway as it is on the same subnet.  I'd drop out all the unnecessary.

----------

## shoot

 *magic919 wrote:*   

> You'd have to say that even without a gateway defined you should be able to ping the gateway as it is on the same subnet.  I'd drop out all the unnecessary.

 

Yes, you'd have to say. To bad it doesn't work that way. That's why I'm asking if someone has any ideas to whats going on!

Regards

shoot

----------

## shoot

I've now tried turning my modem off for 20 mins to see if it was some trouble regarding mac adresses. I fired everything up and still no success with pinging neither gateway nor dns's. I redid everything this time using net-setup eth0 and that didn't give me any success either. Has noone ever experienced this problem?

Btw, I can ping my gateway from other internet connections(!)

Regards

shoot

Edit:

Ok, so I once again restarted the computer. Booted into gentoo again and also once again set up net-setup eth0 according to how my ip's are set. /etc/init.d/net.eth0 restart gave me some error response though, my friend pointed out that I should check /var/log/messages/ and this is what it says:

 *Quote:*   

> You are using a depreciated configuration syntax for eth0
> 
> You are advised to read /etc/conf.d/net.example and upgrade it accordingly
> 
> No loaded modules provide "broadcast" (broadcast_start)
> ...

 

This has only occured this time and the first time I set ifconfig for eth0 up.

----------

## P3SM

 *Shoot wrote:*   

> Ok, so I did type this in:
> 
> ```
> route add -net default gw 83.227.xxx.193 netmask 255.255.255.192 metric 1 eth0
> ```
> ...

 

Sorry for being unclear, but I actually meant using 0.0.0.0 where it said so and not the netmask belonging to the subnet!

Then again: I'm using this on a 2.4 kernel on Sparcs!

----------

## shoot

Aha!   :Embarassed: 

I'll try the new one then   :Laughing: 

Regards

shoot

Edit:

I have now tried two things. First the stuff about route add -net etc. This gave no success either. I had a chat with my friend and we figured out since I do have username and password (however I never use them to access internet) I should try to check if it had pppoe. So I setup pppoe-setup and did pppoe-start. Still no success.

Am I supposed to use my username/password anywhere, even though I have never done so? What I know they are only used on the website for my ISP. Actually, I have used to username/password once, and that was when I activated my internet the first time.

----------

## x22

 *shoot wrote:*   

> 
> 
> eth0	link encap: Ethernet HWaddr FF:FF:FF:FF:FF:FF
> 
> 

 

The MAC address does not seems to be correct. There may be hardware or driver problem.

----------

## shoot

 *x22 wrote:*   

>  *shoot wrote:*   
> 
> eth0	link encap: Ethernet HWaddr FF:FF:FF:FF:FF:FF
> 
>  
> ...

 

That could be true, it's just that I've tried almost all steps for eth0 with eth1 aswell that has a correct MAC adress. 

Regards

shoot

PS. Eth1 card is Marvell Technology Group Ltd. 88E8001 Gigabit Ethernet Controller. It seems to be using a driver called "skge". Eth0 is a Realtek card.(I do not have the information about that at the moment but I'll get back with the correct name soon).

Edit:

Eth0: RealTek RTL8129.

----------

## blueaura

I have the exact same problem with a marvell and nvidia controller. Neither seem to realise 192.168.0.1 is a router although a route is set up. Bizzare!

----------

## wynn

A builtin card here showed Ethernet HWaddr FF:FF:FF:FF:FF:FF and it was a card fault (hardware)

----------

## blueaura

Give something like this a go...

/etc/conf.d/net

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

routes_eth0=( "default gw 192.168.0.1" )

gateways_eth0=( "192.168.0.1" )

dns_servers_eth0=( "192.168.0.1" )
```

Fixed it for me. Of course adapt the IPs to your needs.

----------

## jtp755

just thought id let yall know that the last post fixed the problem for me too.

----------

## z1-tram

Fixed my problem too!   :Very Happy:   Thanks blueaura!

----------

## daN-the-man

and mine too! thank you very much!  :Very Happy: 

----------

## blueaura

It also fixed mine again on another new install on a different machine. Must be a new build of something which needs dns servers and gateways to be defined.

----------

