Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game. |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
|
11-28-2001, 02:04 PM
|
#1
|
LQ Newbie
Registered: Nov 2001
Posts: 1
Rep:
|
Port Forward with iptables
Newbie to linux and wanted to run internal web servers on my lan. Have tried numerous configurations to have iptables forward ports from linux box to internal lan. Connections from outside the network work fine, but connections from the lan get "connection refused" errors. Any suggestions??? Below is the current config:
$IPTABLES -F
$IPTABLES -F INPUT
$IPTABLES -F OUTPUT
$IPTABLES -F FORWARD
$IPTABLES -F -t mangle
$IPTABLES -F -t nat
$IPTABLES -X
$IPTABLES -P INPUT DROP
$IPTABLES -P OUTPUT ACCEPT
$IPTABLES -P FORWARD ACCEP
echo 1 > /proc/sys/net/ipv4/ip_forward
$IPTABLES -t nat -A POSTROUTING -o eth1 -j MASQUERADE
$IPTABLES -t nat -A PREROUTING -p tcp -d 65.xxx.xxx.xxx --dport 80 -j DNAT --to 192.168.1.X:80
$IPTABLES -t nat -A PREROUTING -p tcp -d 65.xxx.xxx.xxx --dport 2050 -j DNAT --to 192.168.1.X:80
|
|
|
11-29-2001, 07:15 AM
|
#2
|
Member
Registered: Feb 2001
Posts: 69
Rep:
|
You should take a look at the following:
http://www.linuxports.com/howto/IP-MASQ/x1525.htm
and then checkout ipmasqadm. It is talked about in the above readme and is my favorite way to forward ports through a firewall.
-Mark
|
|
|
11-30-2001, 05:07 PM
|
#3
|
Member
Registered: Feb 2001
Location: Texas
Distribution: Slackware, Mandrake, LFS
Posts: 306
Rep:
|
I did something similar for FTP setup and had to go from:
/sbin/iptables -t nat -A PREROUTING -d 5.6.7.8 --dport 4000 -j DNAT --to 1.2.3.4:4000
to
/sbin/iptables -t nat -A PREROUTING -d 5.6.7.8 -s ! 1.2.3.4 --dport 4000 -j DNAT --to 1.2.3.4:4000
Or I got some terrible loop between my ftp machine and the firewall rerouting back to itself.
|
|
|
12-02-2001, 10:07 PM
|
#4
|
Member
Registered: Nov 2001
Location: atl
Distribution: redhat
Posts: 52
Rep:
|
i'm having the same problem. iptables starting to make me scratch my head ... hard! i type the SAME exact thing as what you have and i get an error message that --dport isn't understood. BUT when i put in the protocol (ie -p TCP) it works fine.
why is that? why do i *HAVE* to specify the protocol? did you?
|
|
|
12-02-2001, 10:10 PM
|
#5
|
Member
Registered: Feb 2001
Location: Texas
Distribution: Slackware, Mandrake, LFS
Posts: 306
Rep:
|
Heh, it's because I'm a retard and forgot -p tcp
you must specify the protocol.
|
|
|
12-02-2001, 10:22 PM
|
#6
|
Member
Registered: Nov 2001
Location: atl
Distribution: redhat
Posts: 52
Rep:
|
lol.
ok, thanks! still lmao.
still doesn't work though! bah. ipmasqadm worked so well too. not sure why iptables is giving me such a hard time. can't get any of the portfwarding to work. (proxy server, dns, web)
grrrrrr.
|
|
|
All times are GMT -5. The time now is 01:08 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|