RE: iptables forwarding help

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




> -----Original Message-----
> From: redhat-list-bounces@xxxxxxxxxx [mailto:redhat-list-
> bounces@xxxxxxxxxx] On Behalf Of Romeo Theriault
> Sent: Thursday, June 16, 2011 4:22 PM
> To: General Red Hat Linux discussion list
> Subject: Re: iptables forwarding help
> 
> 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
> 

Thanks, it was the last line that I was missing
iptables -t nat -A POSTROUTING -o eth1 -j MASQUERADE


-- 
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]     [Red Hat Install]     [PAM]     [Fedora Users]     [Red Hat Development]     [Red Hat 9]     [Big List of Linux Books]     [Linux Admin]     [Photo Sharing]     [Hot Springs]     [Gimp]     [Asterisk PBX]     [Yosemite News]     [Red Hat Crash Utility]

  Powered by Linux