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.
Hello.
I have a question about iptables firewall.
I would like to know some things about how iptables port forwarding is done. I have a RHL9 PC with 2 network cards - I use one for my internal network (static IP subnet) and the other one for internet access. The PC sorta works like a router and a firewall allowing the subnet PC's to access internet via it - gateway. I have configured the firewall to block all incoming connections from the internet except the related ones and later on opened some ports and ordered iptables to forward them to the IP of my computer (only my IP, no other) on the subnet for I use those ports (gaming, IM's, p2p, etc). Now the thing is that I just don't get it how this port forwarding really works. Does it forward the incoming connections of those ports to my subnet IP and my subnet IP only (as I assumed) or does it also forward them to the rest of the PC's on the subnet? For some reason I see a lot of applications work on other PC's on the subnet but I haven't really opened any ports for them. Is it possible that iptables allows those applications to use the ports I registered as my own?
Thanks in advice.
Originally posted by comptiger5000 port forwarding is only reffering to inbound connections, not outbound
I know this but that's not exactly what I asked. The applications that establish a connection with a server work properly as the connection becomes "related" and the firewall passes it by. However some other applications act as servers and require connections to be made from clients outside the subnet - they have to get passed the firewall but since the firewall is configured to drop all unrelated incoming connection requests, those apps should not work properly. What I am asking is if those applications (on another subnet PC) can work using a common port I originally programmed to be forwarded to my IP. For example I let iptables know that port 6666 tcp should be forwarded to my IP let's say 192.168.0.3. If this is the case, does iptables also allow an application on PC2 whose IP is 192.168.0.2 to use this port 6666 tcp to accept incoming connections from the internet?
This is bugging be because I've seen some applications work on other PC's that refused to work properly on my PC until I opened/forwarded the proper ports.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.