Confused about defining a gateway - Networking

This is a discussion on Confused about defining a gateway - Networking ; 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 ...

+ Reply to Thread
Results 1 to 3 of 3

Thread: Confused about defining a gateway

  1. Confused about defining a gateway

    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.




  2. Re: Confused about defining a gateway

    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


  3. Re: Confused about defining a gateway

    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 to Thread