I'm running 3 virtual machines with Fedora 19. The machine B is set up with two networks adapters and provides que channel between machine A and machine C.

The machine A IP is set to and machine C IP is set to On machine B I have one adapter with IP and another adapter with IP

I've created this rule in machine B (it's working as a router):

iptables -P INPUT DROP

iptables -A INPUT -p icmp -j ACCEPT

And so, no connections between the machines are made unless the PING that allows the communication between machine A and B.

Now I want to create a rule in the router that allows the communication of HTTPS between the external network (machine C) and the internal network (machine A)

I've added this rule in machine B:

iptables -A FORWARD -o p7p1 -p tcp --dport 443 -d -j ACCEPT

Where p7p1 is the interface on machine B that connects to machine A. I've also tried:

iptables -A FORWARD -i p8p1 -o p7p1 -p tcp --dport 443 -d -j ACCEPT

Where p8p1 is the interface on machine B that connects to machine C.

Now, on machine A I do nc -l 443 and on machine C nc 443 but I'm getting Ncat: Connection timed out

Whats wrong with my rule?


You are missing a rule that also allows the answers to go through your firewall.

I trust the code for netfilter and its powerful state module, so i'd use iptables -A FORWARD -m state --state RELATED,ESTABLISHED -j ACCEPT so that also the packets in the other direction are allowed as well.

In your ruleset the answers from to the other machine at are blocked.

Also see documentation for iptables troubleshooting, for example this on linuxhomenetworking.com and add logging rules when things are not working.

iptables -A FORWARD -j LOG

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.