Networking Forums

Networking Forums > Computer Networking > Linux Networking > Quick Question - Default gateway on a different subnet

Reply
Thread Tools Display Modes

Quick Question - Default gateway on a different subnet

 
 
vishal78@gmail.com
Guest
Posts: n/a

 
      10-18-2005, 11:05 AM
Hello Friends,

My ISP has given me this static ip address to use on my server -

IP address - 192.168.1.10
Subnet Mask - 255.255.255.0
Default Gateway - 192.168.100.2
Name Server 1 - 172.21.199.9
Name Server 2 - 172.21.199.10

I was quite surprised initially, coz i was wondering as to how this
thing is gonna work, coz the default gateway is actually on a different
subnet. But to my surprise, the above configuration worked just fine on
my Windows 2000 box and now i am finding it really hard to configure
the same setting in Linux. I am using Fedora Core 4 and i want this IP
to be working on my Linux Box only, as i have a network firewall and
proxy to install on this.

PS - i have changed the above address information for privacy reasons.

Cheers,
Vishal

 
Reply With Quote
 
 
 
 
Alo
Guest
Posts: n/a

 
      10-18-2005, 11:30 AM
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

(E-Mail Removed) wrote:

> IP address - 192.168.1.10
> Subnet Mask - 255.255.255.0


Change "Subnet Mask" to 255.255.0.0 and try...

> Default Gateway - 192.168.100.2
> Name Server 1 - 172.21.199.9
> Name Server 2 - 172.21.199.10


- --
Un saludo
Alo [alo(@)uk2.net]
PGP en http://pgp.eteo.mondragon.edu [Get "0xF6695A61 "]
Usuario registrado Linux #276144 [http://counter.li.org]

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (MingW32)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFDVNzxvzPPcPZpWmERAnU7AJ4zYocIrHesEoi0/iIX7P643hxqwwCeKFHI
kXEgJbzl9urE+dt5Jh7MRUc=
=0bU6
-----END PGP SIGNATURE-----
 
Reply With Quote
 
vishal78@gmail.com
Guest
Posts: n/a

 
      10-18-2005, 11:45 AM
Your solution worked for me. But is it a stable solution. I guess i
wont face any problems later???

Can u suggest an alternative, if any available.

Cheers,

Vishal

 
Reply With Quote
 
Floyd L. Davidson
Guest
Posts: n/a

 
      10-18-2005, 03:34 PM
(E-Mail Removed) wrote:
>Your solution worked for me. But is it a stable solution. I guess i
>wont face any problems later???


You might... if you decide to use all 253 subnets and run out
of room! ;-)

>Can u suggest an alternative, if any available.


The actual problem is merely that you need to have a route to
the gateway host before you can put in a "default" route using
that gateway. How that is done by any given distribution can
change, depending on the admin tools provided by each particular
distribution. At the base level you can read the man pages for
/ifconfig/ and /route/ to learn what they do.

The alternative to using a broader network mask, and one that
will also work if the gateway is on an entirely different IP
address segment, is to add a "host" route to that IP address
before attempting to set any route that uses it as a gateway.

For example, the 255.255.0.0 netmask works when the subnet
is 192.168.1.10 and the gateway is 192.168.100.1, but won't
work for a gateway that is 10.1.1.10. For that address,
a host network is required.

Note that a "host" route (see the man page for /route/) is merely
a network route that has a netmask which allows only a single address
to match. Hence, either of these commands will result in the exact
same route table entry:

route add -net 10.1.1.10 netmask 255.255.255.255 eth0

or

route add -host 10.1.1.10 eth0

In either case you could now do the following:

route add default gw 10.1.1.10 eth0

Which would not be valid using just the wider netmask on a
192.168.x.x subnet.

--
Floyd L. Davidson <http://www.apaflo.com/floyd_davidson>
Ukpeagvik (Barrow, Alaska) (E-Mail Removed)
 
Reply With Quote
 
 
 
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
default gateway question strangelove Broadband 14 12-19-2007 10:32 PM
How to get default Gateway address, subnet address, DNS names using C/C++ Matrixinline Linux Networking 2 01-11-2007 04:32 AM
Question about default gateway George Windows Networking 2 11-15-2006 11:41 PM
Linux: Default gateway fails, must use local IP for default gw instead John Sasso Wireless Internet 2 07-08-2004 08:30 AM
Gateway Default Route Question Hank Kingwood Linux Networking 2 10-15-2003 11:56 PM



1 2 3 4 5 6 7 8 9 10 11