PDA

View Full Version : [ubuntu] Default gateway



ibob
January 19th, 2009, 04:18 PM
Hi guys,

I have got an 8.10 ubuntu server and for some reason it never gets it's correct gateway.

My /etc/networks/interface says:

# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).


# The loopback network interface
auto lo eth0
iface lo inet loopback

# The primary network interface
iface eth0 inet static
address 192.168.2.43
gateway 192.168.2.1
netmask 255.225.225.0
broadcast 192.168.2.255
network 192.168.2.0

which seems okay except when I restart the networking it says:


SIOCSIFNETMASK: Invalid argument
Failed to bring up eth0

I can't see what is invalid about that? Also, eth0 does appear to have been brought up as it seems to work.

Anyhow, more annoying yet, the default gateway is incorrect. Whan I type 'route' i just get:


Destination Gateway Genmask Flags Metric Ref Use Iface
192.168.2.0 * 255.255.255.0 U 0 0 0 eth0

So, everytime I reboot the server I have to the following command to set the gateway:

route add default gw 192.168.2.1 eth0

If there a way I can fix my networking? Thanks,

James

Kebabman
January 19th, 2009, 04:22 PM
Your netmask looks wrong in your interface file :

You have :

255.225.225.0

It should be :

255.255.255.0

Hope this helps

ibob
January 19th, 2009, 04:43 PM
Thanks. That was a great spot! Networking starting okay now.

Amazingly the gateway is fixed too.

Thanks,

James