Connecting two networks with two linux boxes.

Discussion in 'Linux Networking' started by Markvr, Aug 24, 2006.

  1. Markvr

    Markvr Guest

    I have 2 networks each with a linux box as the gateway to the internet.

    At the moment they are VPN'd together, but are close enough to get a
    cable run and I'd like to connct them like this to make it quicker
    so each linux box will have 3 nics in it.

    My question is possibly a dumb one! But what should the IP for the 3rd
    nic in each box be?

    The networks are:
    network - linux box internal address
    Box 1) 10.0.12.x/24 -
    Box 2) 192.168.12.x/24 -

    Should the 3rd NIC in the box 1 be on the 192.168.12.x range, and vice
    versa but wouldn't that confuse the other network as it would think that
    it is a local IP when it wouldn't be.

    Should they both be on a different range althogether? And then set the
    routing up on each.

    ie 3 NICS in each
    public 123.456.78.2

    public 423.243.123.32

    If it was 2 networks with one linux box it would be easy, just not sure
    how you'd connect the two boxes together....

    Any advice appreciated!


    Markvr, Aug 24, 2006
    1. Advertisements

  2. That should work.
    Allen McIntosh, Aug 24, 2006
    1. Advertisements

  3. On a separate subnet from the other two interfaces.
    All you have to do to make routing work is, on each box, add a static
    route to the original internal network on the *other* box, with the IP
    of the other boxes' 3rd interface as the gateway for that static route.

    Box 1:
    $INTERNAL1, $NEW_IF1 = (or whatever)

    Box 2:
    $INTERNAL2, $NEW_IF2 =

    On Box 1:
    route add net $INTERNAL2 gw $NEW_IF2

    On Box 2:
    route add net $INTERNAL1 gw $NEW_IF1

    Exactly as if there was no Internet - whether you have 3 interfaces or
    28, it's all the same.

    Jeroen Geilman, Aug 24, 2006
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.