Networking Forums

Networking Forums > Computer Networking > Linux Networking > Confused about defining a gateway

Reply
Thread Tools Display Modes

Confused about defining a gateway

 
 
James H. Newman
Guest
Posts: n/a

 
      04-08-2008, 08:21 PM
I have a Linux box with two NICs; one for my LAN and the other
for the external world. The latter is in the 192.168.2 network (IP
address 192.168.2.2) directly connected by a cable to another device in
the same network (IP address 192.168.2.1.) In turn, this device also has
two NICs, and via its second NIC (IP address 192.168.3.2) it is directly
connected to a gateway in network 192.168.3 (IP address 192.168.3.1).

My question is, would it possible to define the default gateway
for my Linux box to be 192.168.3.1? I would have thought that this is not
possible, for not only they are different in networks but, in addition,
both devices are not directly connected. My gut feeling is that the
default gateway in the Linux must be 192.168.2.1, and the default gateway
in the second device must be 192.168.3.1. Is this the only way to reach
the 192.168.3.1 device from the Linux box?

Comments from savvy contributors would be welcome.



 
Reply With Quote
 
 
 
 
Bit Twister
Guest
Posts: n/a

 
      04-08-2008, 08:31 PM
On Tue, 08 Apr 2008 20:21:08 GMT, James H. Newman wrote:
>
> My question is, would it possible to define the default gateway
> for my Linux box to be 192.168.3.1? I would have thought that this is not
> possible, for not only they are different in networks but, in addition,
> both devices are not directly connected. My gut feeling is that the
> default gateway in the Linux must be 192.168.2.1, and the default gateway
> in the second device must be 192.168.3.1. Is this the only way to reach
> the 192.168.3.1 device from the Linux box?


Your packets will have to travel along physical paths.
I would assume you will have to set default route to nic which has a
path to Internet.

Maybe this picture will help
http://groups.google.com/group/alt.o...842aa74d56188c

 
Reply With Quote
 
Tauno Voipio
Guest
Posts: n/a

 
      04-08-2008, 08:31 PM
James H. Newman wrote:
> I have a Linux box with two NICs; one for my LAN and the other
> for the external world. The latter is in the 192.168.2 network (IP
> address 192.168.2.2) directly connected by a cable to another device in
> the same network (IP address 192.168.2.1.) In turn, this device also has
> two NICs, and via its second NIC (IP address 192.168.3.2) it is directly
> connected to a gateway in network 192.168.3 (IP address 192.168.3.1).
>
> My question is, would it possible to define the default gateway
> for my Linux box to be 192.168.3.1? I would have thought that this is not
> possible, for not only they are different in networks but, in addition,
> both devices are not directly connected. My gut feeling is that the
> default gateway in the Linux must be 192.168.2.1, and the default gateway
> in the second device must be 192.168.3.1. Is this the only way to reach
> the 192.168.3.1 device from the Linux box?
>
> Comments from savvy contributors would be welcome.


For most cases, there is a simple rule:

Put the next hop host toward the Net as the default
gateway.

In your case the default gateway for the most remote
computer would be 192.168.2.1. The default gateway
must always be in an address directly accessible
from the host it is gateway for.

You need to turn IP forwarding on in the box relaying
the traffic. Also, there may be addressing problems,
as the 192.168.x.y addresses are not routed in the
public Net (see RFC 1918).

--

Tauno Voipio
tauno voipio (at) iki fi

 
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
gateway to gateway vpn clients can connect Nick Windows Networking 4 11-11-2004 10:01 PM
Confused! Roy Wireless Internet 2 10-01-2004 03:30 PM
confused!!!! RJO Home Networking 7 04-23-2004 09:37 PM
Defining Multiple internal interfaces in my firewall PullnOutHair Linux Networking 1 03-05-2004 03:19 PM
Windows98 Gateway will not accept static gateway Steve Windows Networking 2 09-21-2003 05:45 AM



1 2 3 4 5 6 7 8 9 10 11