Technology Questions

Go Back   Technology Questions > Software Questions > Operating System Questions > Linux

Reply
 
LinkBack Thread Tools
  #1 (permalink)  
Old 10-26-2009, 05:50 PM
phil
Newsgroup Contributor
 
Posts: n/a
Port forwarding

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 -
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

 
Old 10-26-2009, 05:50 PM
  #2 (permalink)  
Old 10-26-2009, 06:10 PM
Grant
Newsgroup Contributor
 
Posts: n/a
Re: Port forwarding

On Mon, 26 Oct 2009 21:32:46 -0400, "phil" <phil@sbbs.cyberchatnet.com.remove-tgz-this> wrote:

>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


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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

  #3 (permalink)  
Old 10-27-2009, 11:00 AM
phil
Newsgroup Contributor
 
Posts: n/a
Re: Port forwarding

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" <phil@sbbs.cyberchatnet.com.remov
>
> >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

>
> 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
> --- 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?

--- Synchronet 3.15a-Win32 NewsLink 1.85
- telnet://sbbs.cyberchatnet.com:23 -
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

  #4 (permalink)  
Old 10-27-2009, 03:40 PM
phil
Newsgroup Contributor
 
Posts: n/a
Re: Port forwarding

To: phil
> 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"
> > <phil@sbbs.cyberchatnet.com.remov
> > >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

> >
> > 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
> > --- 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?
>



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
--- Synchronet 3.15a-Win32 NewsLink 1.85
- telnet://sbbs.cyberchatnet.com:23 -
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

  #5 (permalink)  
Old 10-28-2009, 04:50 PM
Pascal Hambourg
Newsgroup Contributor
 
Posts: n/a
Re: Port forwarding

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.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Reply

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
port mapping / forwarding ermanu@hotmail.com Windows XP 1 04-25-2007 08:45 AM
Port forwarding Jack Black Windows XP 2 01-22-2007 04:15 AM
RDP & Port Forwarding Aussie Girl Windows XP 5 01-04-2007 05:11 AM
ICS Port Forwarding Not Working Right RedPenguin Windows XP 0 01-04-2007 05:00 AM
Remote Desktop port forwarding Jeff Windows XP 6 01-04-2007 04:14 AM


New To Technology Questions? Do You Need Help with Your Computer or Device? Do You Need Help with this site?

All times are GMT -8. The time now is 07:41 PM.


2003 - 2009 All Rights Reserved. Technology Questions

Search Engine Friendly URLs by vBSEO 3.3.0