Linux - NetworkingThis forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.
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.
Introduction to Linux - A Hands on Guide
This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.
Click Here to receive this Complete Guide absolutely free.
1) From within your network, you try to access your public IP on port 80.
2) Your latest DNAT rule on PREROUTING should work correctly : iptables -t nat -A PREROUTING -i p3p2 -p tcp -d PublicIP --dport 80 -j DNAT --to-destination 10.1.1.10
3) Now, you haven't shown us your FORWARD rules (iptables -vnL FORWARD) - but you will be forwarding from your p3p2 to p3p2 and back again, so you need something like this:
iptables -I FORWARD -i p3p2 -o p3p2 -j ACCEPT
4) This will allow your packets to hit the router and be forwarded back to 10.1.1.10 on your internal network.
5) However, assuming the IP address of your client machine is on that same network (10.1.1.0/24), you will have a small problem - ie, the web on 10.1.1.10 will receive your packets and answer directly to you (as it sees you are on the same network). Your machine will see packets arrive from 10.1.1.10 without the SYN bit set as if they were part of an existing connection and silently ignore them.
6) What you have to do is is SNAT on your router - iptables -t nat -A POSTROUTING -o p3p2 -j MASQUERADE
Thus 10.1.1.10 will always send responses back the way they arrived.
Just as an after thought, it's worth noting that if you put a MASQUERADE or SNAT rule on your internal interface without further qualification, all the log entries on your apache server will appear to come from your router; not very useful, I guess.
You could just change the MASQ rule I mentioned in the previous post as follows: