Find the answer to your Linux question:
Results 1 to 3 of 3
Hi everyone, I have a server which has 3 nic's in it with the following configuration: eth2 192.168.1.2 to router 192.168.1.1 eth1 192.168.2.1 vlan 10 eth0 192.168.3.1 vlan 20 the ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Jul 2009
    Location
    uk
    Posts
    22

    Need help fast with iptables


    Hi everyone,


    I have a server which has 3 nic's in it with the following configuration:


    eth2 192.168.1.2 to router 192.168.1.1
    eth1 192.168.2.1 vlan 10
    eth0 192.168.3.1 vlan 20

    the server can get the internet no problems, but i am trying to forward the traffic from both eth1 ,eth0 to eth2 and back again etc but i have tried a few peoples iptables scripts and they dont seem to work eg.

    Code:
    #!/bin/sh
    
    IPT=/bin/iptables
    
    $IPT -F
    
    $IPT -P OUTPUT ACCEPT
    $IPT -P INPUT DROP
    $IPT -P FORWARD DROP
    
    
    $IPT -t nat -A POSTROUTING -o eth2 -j MASQUERADE
    $IPT -A FORWARD -i eth2 -o eth1 -m state ---state RELATED,ESTABLISHED -f ACCEPT
    $IPT -A FORWARD -i eth1 -o eth2 -j ACCEPT
    $IPT -A FORWARD -i eth2 -o eth0 -m state ---state RELATED,ESTABLISHED -f ACCEPT
    $IPT -A FORWARD -i eth0 -o eth2 -j ACCEPT
    edit: ip forwarding is on to, and eth1 and eth0 have the gateway and dns of 192.168.1.1 router ip

    Can anyone tell me if i have done something wrong its doing my head in.


    Many thanks
    Last edited by linuxfan27; 11-08-2010 at 09:18 PM.

  2. #2
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    Location
    I can be found either 40 miles west of Chicago, in Chicago, or in a galaxy far, far away.
    Posts
    11,746
    School project?
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

  3. #3
    Just Joined!
    Join Date
    Nov 2010
    Posts
    4
    i'm noob at linux but... dont you need enable forwarding ??

    ###Enable IP forwarding
    echo 1 > /proc/sys/net/ipv4/ip_forward

  4. $spacer_open
    $spacer_close

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •