Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Port forwarding

2 views
Skip to first unread message

phil

unread,
Oct 26, 2009, 9:32:46 PM10/26/09
to
I am trying to forward port 80 on 192.168.1.5 and 127.0.0.1 to
192.168.1.100:8080. I am using a example from the internet
but its not working. I am running a proxy server on
192.168.1.100.

Can you please tell me how I can get this to work please? I am
using one nic card on each computer and I can ping all the ip
address on the local network.


modprobe iptable_nat
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
echo 1 > /proc/sys/net/ipv4/ip_forward
iptables -A PREROUTING -t nat -p tcp -d 127.0.0.1 --dport 80 -j DNAT --to
192.168.1.100:8080
iptables -A PREROUTING -t nat -p tcp -d 192.168.1.5 --dport 80 -j DNAT --to
192.168.1.100:8080
iptables -A PREROUTING -t nat -p tcp -d 127.0.0.1 --dport 53 -j DNAT --to
192.168.1.100:8080
iptables -t nat -A PREROUTING -p tcp --dport 80 -i eth0 -j DNAT --to
192.168.1.100:8080


--- Synchronet 3.15a-Win32 NewsLink 1.85
- telnet://sbbs.cyberchatnet.com:23 -

Grant

unread,
Oct 26, 2009, 9:55:38 PM10/26/09
to

port forwading requires two rules per port, plus optional logging,
for example:

# the NAT bit
iptables -t nat -A PREROUTING -p tcp -i $xf_world \
--dport $torrent_port \
-j DNAT --to-destination $torrent_host
# the port-forward, logging
iptables -A FORWARD -p tcp -m state --state NEW \
--dport $torrent_port \
$limit_rate_log "JLE:fwd:okay ingress "
# the port-forward, action
iptables -A FORWARD -p tcp -m state --state NEW \
--dport $torrent_port -j ACCEPT


Grant.
--
http://bugsplatter.id.au

phil

unread,
Oct 27, 2009, 2:54:27 PM10/27/09
to
To: Grant
Re: Re: Port forwarding
By: Grant to alt.os.linux on Tue Oct 27 2009 12:55:38

> From Newsgroup: alt.os.linux


>
> On Mon, 26 Oct 2009 21:32:46 -0400, "phil" <ph...@sbbs.cyberchatnet.com.remov
>

> --- Synchronet 3.15a-Win32 NewsLink 1.85

Can you please give me a example that I can paste and use in my script that
will work with the example that I have above?

phil

unread,
Oct 27, 2009, 7:31:05 PM10/27/09
to
To: phil


I was reffering to a example that I can use this is script so all I have to do
is copy and paste it without making modifications to it.

modprobe iptable_nat
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
echo 1 > /proc/sys/net/ipv4/ip_forward
iptables -A PREROUTING -t nat -p tcp -d 127.0.0.1 --dport 80 -j DNAT --to
192.168.1.100:8080
iptables -A PREROUTING -t nat -p tcp -d 192.168.1.5 --dport 80 -j DNAT --to
192.168.1.100:8080
iptables -A PREROUTING -t nat -p tcp -d 127.0.0.1 --dport 53 -j DNAT --to
192.168.1.100:8080
iptables -t nat -A PREROUTING -p tcp --dport 80 -i eth0 -j DNAT --to
192.168.1.100:8080


Thanks

Pascal Hambourg

unread,
Oct 28, 2009, 8:47:56 PM10/28/09
to
Hello,

phil a ᅵcrit :


> I am trying to forward port 80 on 192.168.1.5 and 127.0.0.1 to
> 192.168.1.100:8080.

That is not very clear. Please explain what is the source host, the
original destination and the forwarding host.

0 new messages