Linux - NetworkingThis 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.
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.
I'd like to enable an internal http-server to the external net.
My approach: All requests to a dummy-port (i.e. 8888) on my Standard-Gateway, which is the only one visible to the external net) will be redirected to the http-server
Thanks for your reply !
If I understand you correcdtly, my approach fails, because the port-number is in the http-header as well ?
Would it help to configure the http-server to listen on port 8888 instead of 80 ?
Add a virtualhost that listens on port 8888
and also add a Listen directive for port 8888 in httpd.conf
Leave the default settings of port 80, just add these.
Then add the NAT to the ip address, eg
iptables -t nat -A PREROUTING -i ${EXTIF} -p tcp --dport 8888 -j DNAT --to-destination ${IP_HTTP}
Last edited by peter_robb; 08-07-2006 at 09:50 AM.
It took me a while to implement your advice, but the internal http-server run into more basic problems. Anyway now its up again (its a camera btw), I changed the port of the webserver to 8888, but its still the same effect, no packets from outside are forwarded to the internal http-server.
I found some hits regarding iptables DNAT, that it has to be accompanied by a SNAT-Statement like:
iptables -t nat -A PREROUTING -d ${IP_GATEWAY} -p tcp --dport 8888 -j DNAT
--to-destination ${IP_HTTP}
Accomplishing SNAT:
iptables -t nat -A POSTROUTING -s ${IP_HTTP} -p tcp --sport 8888 -j SNAT
--to-source ${IP_GATEWAY}
I tried this....but did not change anything !
On the other hand iptables-doc says that I need only to reroute the first (incoming) packet, all others follow "automatically".
You only need the DNAT rule. The snat is handled internally by netfilter.
Avoid using -d ip.add.ress in a DNAT rule.
Rather, use an interface specification, ie -i eth~
This way you can be sure exactly which packets are being changed.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.