Re: iptables forwarding help

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Jun 16, 2011 at 4:27 PM, Steven Buehler <steve@xxxxxxxxxxxx> wrote:
>
> I have been googling and researching iptables and forwarding all day and
> still can't figure this out.

Try something like this (untested):

# Make sure that this is set to 1 to enable forwarding.
cat /proc/sys/net/ipv4/ip_forward

# If it's not set, set it with:
echo 1 > /proc/sys/net/ipv4/ip_forward

# Setup your iptables rules that you need to enable the forwarding. In
this example, I'm just forwarding traffic from a specific ip to
another another ip.

iptables -A FORWARD -i eth0 -o eth1 -p tcp --dport 2222 -m state
--state NEW,ESTABLISHED,RELATED -j ACCEPT
iptables -t nat -A PREROUTING -p tcp -i eth0 -d <eth0_ip> --dport 2222
-j DNAT --to <internal_server_ip>:22
iptables -t nat -A POSTROUTING -o eth1 -j MASQUERADE


Romeo

-- 
redhat-list mailing list
unsubscribe mailto:redhat-list-request@xxxxxxxxxx?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/redhat-list


[Index of Archives]     [CentOS]     [Kernel Development]     [PAM]     [Fedora Users]     [Red Hat Development]     [Big List of Linux Books]     [Linux Admin]     [Gimp]     [Asterisk PBX]     [Yosemite News]     [Red Hat Crash Utility]


  Powered by Linux