# strange network problem with route

## Jiraiya

hi! i've this problem with my net that's really bugging me. let's take a look at my network:

```
my ip   : 192.168.22.254

netmask : 255.255.255.240

gateway : 192.168.22.241
```

i tried a zillion times to setup with this until i finally found the problem, and lol it is: linux thinks my network address is 192.168.22.241, which is wrong, cause it is 192.168.22.239. so it doesn't allow to add a gateway with this address (route).

how do you remove a network in route? whenever i try to, it says something like

```
SIOC<something>: NO SUCH DEVICE (or PROCESS).
```

there was a time when this worked with gentoo, but it never did with slackware. i remember solving it one time, on slack, but i can't remember how  :Evil or Very Mad:  :Evil or Very Mad: 

please help me out. i checked every last ethernet howto i found.

thanks, nik

----------

## Jiraiya

much as i hate to reply to my own thread:

i tried to completely manually add a network (read a route howto:), like this:

```
route del -net <the default gentoo one>

route add -net 192.168.22.239 netmask 255.255.255.240 eth0

error: netmask doesn't match route address

route add -net 192.168.22.240 netmask 255.255.255.240 eth0

route add 192.168.22.241 gw default

error: can't add network as gateway!

(i thought i already told him my net was not 192.168.22.241)

route del -net 192.168.22.240 netmask 255.255.255.240 eth0

route add -net 192.168.22.239 netmask 255.255.255.240 gw 192.168.22.241 eth0

error: netmask doesn't match route address (same as above)

route add -net 192.168.22.240 netmask 255.255.255.240 gw 192.168.22.241 eth0

error: can't add network as gateway! (grrrrr...)

```

i solved it once with adding 255.255.255.255 as something to route. though i can't remeber wtf it was   :Embarassed:   :Crying or Very sad:   :Crying or Very sad: 

----------

## Jiraiya

another self-reply:

i connected the slack box where it works, and route output looks like that:

```
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface

localnet        *               255.255.255.240 U     0      0        0 eth0

loopback        *               255.0.0.0       U     0      0        0 lo

default         192.168.22.241  0.0.0.0         UG    1      0        0 eth0

```

though i accidentally deleted the first one, but it still worked! (wtf?) anybody care for an explanation? and what in fucks name are localnet and loopback? they are declared in no file, and they are not variables. is this only the name of the net? if it is, why does route complain that 192.168.22.239 doesn't match my netmask?

i'm totally wtf right now!

----------

## Jiraiya

oh come on guys don't say none of you can help me with this!

what's even more strange is that, i installed a gentoo box, in my network, with the same settings (except the address), from the same cd, and nothing went wrong! no such problems at all!

though i tried today to delete & add the gateway there, manually. it wouldn't even let me delete (can't use network as gateway). how the FUCK does is set at boot time?!?!?!?!?!???!!!!!! i even tried every possible order of operations, no change, nothing!! i'm getting really pissed off, and there's nowhere even a hint as to how to solve this! come on please one of you help me here!   :Crying or Very sad:   :Crying or Very sad:   :Crying or Very sad:   :Crying or Very sad:   :Crying or Very sad: 

----------

## speed_bump

 *Quote:*   

> i tried a zillion times to setup with this until i finally found the problem, and lol it is: linux thinks my network address is 192.168.22.241, which is wrong, cause it is 192.168.22.239. so it doesn't allow to add a gateway with this address (route).
> 
> 

 

Incorrect. With a netmask of 255.255.255.240, the address 192.168.22.239 is the broadcast address for the 192.168.22.224/28 subnet. 192.168.22.240 is the network address for the 192.168.22.240/28 subnet.

So in this case, your route commands should look more like this (if you've completely flushed the routing table):

```

route add -net 192.168.22.240/28 gw 192.168.22.254

route add -net default gw 192.168.22.241

```

You may not need the first command if your interface is already speaking correctly to your local lan.

----------

