Mailing List Archive
tlug.jp Mailing List tlug archive tlug Mailing List Archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]Re: [tlug] Question on iptables and port forwarding
- Date: Fri, 1 Oct 2010 18:18:46 +0900
- From: Ian Barwick <barwick@example.com>
- Subject: Re: [tlug] Question on iptables and port forwarding
- References: <AANLkTi=2v16v-Oa_zdgVcgos99DYG18Hc3DZwMXw=KK0@example.com> <AANLkTi=n8txhPuCUBD1L2-uLgG4KrnT+1P6xmE7eQ3E8@example.com>
2010/10/1 Romeo Theriault <romeo.theriault@example.com>: > On Fri, Oct 1, 2010 at 16:30, Ian Barwick <barwick@example.com> wrote: >> >> Hi all >> >> I have two machines on the same local network, 192.168.2.6 and 192.168.2.7 >> and I want to forward say TCP connections to 192.168.2.7:12345 to >> 192.168.2.6:80 >> (just for the hell of it, it's Friday ;) ). >> >> All available sources indicate I should be doing something like this >> (on 192.168.2.7): >> >> iptables -A PREROUTING -i eth0 -t nat -p tcp --dport 12345 -m state >> --state NEW,ESTABLISHED,RELATED -j DNAT --to 192.168.2.6:80 >> iptables -A FORWARD -i eth0 -p tcp --dport 80 -m state --state >> NEW,ESTABLISHED,RELATED -j ACCEPT >> > > I was playing with this just the other day too. I think what your missing is > your POSTROUTING statement. > iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE > that does your SNAT, so the connections get sent back to your 192.168.2.7 > machine. Bingo, that was it! Time to read up on networking again... Ian Barwick
- Follow-Ups:
- Re: [tlug] Question on iptables and port forwarding
- From: Romeo Theriault
- References:
- [tlug] Question on iptables and port forwarding
- From: Ian Barwick
- Re: [tlug] Question on iptables and port forwarding
- From: Romeo Theriault
Home | Main Index | Thread Index
- Prev by Date: Re: [tlug] Question on iptables and port forwarding
- Next by Date: [tlug] Question on iptables and port forwarding
- Previous by thread: Re: [tlug] Question on iptables and port forwarding
- Next by thread: Re: [tlug] Question on iptables and port forwarding
- Index(es):
Home Page Mailing List Linux and Japan TLUG Members Links