I have been googling and researching iptables and forwarding all day and
still can't figure this out. I am trying to set up some port forwarding.
Since I couldn't get it to work with my current firewall, I cleared it and
am using the following script. For this test I am trying to forward port
2222 on eth0 (the WAN) to another servers port 22 on the internal network
which should get to it on eth1. I am running a new install of a Redhat
2.6 kernel.
Here is my script, followed by the output and an iptables -vnL. I am really
hoping that someone can spot my mistake so that I can get this working. Not
sure if I have left something out of this installation or not.
--
redhat-list mailing list
unsubscribe mailto:redhat-list-request@redhat.com?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/redhat-list
06-16-2011, 09:22 PM
Romeo Theriault
iptables forwarding help
On Thu, Jun 16, 2011 at 4:27 PM, Steven Buehler <steve@ibushost.com> 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.
--
redhat-list mailing list
unsubscribe mailto:redhat-list-request@redhat.com?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/redhat-list
06-17-2011, 12:38 AM
"Steven Buehler"
iptables forwarding help
> -----Original Message-----
> From: redhat-list-bounces@redhat.com [mailto:redhat-list-
> bounces@redhat.com] 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@ibushost.com>
> 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@redhat.com?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/redhat-list