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.
Chain INPUT (policy ACCEPT 808 packets, 55937 bytes)
pkts bytes target prot opt in out source destination
Chain OUTPUT (policy ACCEPT 1843 packets, 128K bytes)
pkts bytes target prot opt in out source destination
Chain POSTROUTING (policy ACCEPT 1767 packets, 118K bytes)
pkts bytes target prot opt in out source destination
738 81101 MASQUERADE all -- * p3p1 0.0.0.0/0 0.0.0.0/0
Not sure what I am missing here
tried to do this
iptables -t nat -A PREROUTING -i p3p2 -p tcp -d PublicIP --dport 80 -j DNAT --to-destination 10.1.1.10
But the connection just hangs i can see it hit iptables but than it dies. Also i still get connection refused from the firewall box directly. Any help would be awesome i am lost on this.
in the above rule, u are specifying the input interface "-i p3p2" which i assume is the public interface. Hence you are able to access port 80 only from the public interface not the lan interface.
So to get access from the internal network, either do not specify the input interface "-i" or add another rule specifying the LAN interface.
in the above rule, u are specifying the input interface "-i p3p2" which i assume is the public interface. Hence you are able to access port 80 only from the public interface not the lan interface.
So to get access from the internal network, either do not specify the input interface "-i" or add another rule specifying the LAN interface.
See that's the weird part the p3p2 interface is the internal interface. What you saying is basically an any interface rule on that port and see what happens?
See that's the weird part the p3p2 interface is the internal interface. What you saying is basically an any interface rule on that port and see what happens?
Hmmm...Try adding a rule without specifying the interface, but specify the public ip.
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:
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.