one gateway two subnet routing

Discussion in 'Server Operation' started by paulley, Sep 4, 2010.

  1. paulley

    paulley New Member

    Hi all,


    I am trying to set a linux router as such so i can route the internet connection on one nic, to two other networks (subnets). What i have done so far is setup this:


    server:
    eth2 ----------router----------internet
    192.168.2.2 192.168.2.1

    eth0 -------------- vlan 2 on web managed switch ------ clients
    192.168.3.1 192.168.3.2 > 10

    eth1 -------------- vlan 3 on web managed switch ------ clients
    192.168.4.1 192.168.4.2 > 10


    I have got a dhcp server running with 2 scopes to assign ip's for each clients on the different subnets which this works great and i can ping the gateway ip for that subnet, all im having a problem with is how to route the gateway to the internet to the eth0 and 1 ip's so i can use these ip's for the gateway and dns ip's to connect to the internet.

    I have ip_forward on and tried the route and ip route commands but these didnt work

    Any help with this will be great


    Thanks
     
    Last edited: Sep 4, 2010
  2. pwn

    pwn New Member

    You need to enable masquerading under iptables.

    iptables -t nat -A POSTROUTING -o eth2 -j MASQUERADE

    off the top of my head...IIRC
     

Share This Page