<div dir="ltr"><div><div><div><div><div><div><div><div><div><div><div><div>Hi :)<br><br></div>I have some LXC containers running on a server and I want to forward a port to each of their SSH ports( Fedora 20, firewalld 0.3.9.2). After fiddling with firewall-cmd for several hours now, I am still nowhere near working solution. <br>
<br></div>I have my external interface in the public zone.<br></div>I enabled the masquerading on public :<br><br>$ firewall-cmd --zone=public --add-masquerade<br><br></div><div>and I am using the following for forwarding the port :<br>
<br>$ firewall-cmd --zone=public --add-forward-port=port=22822:proto=tcp:toport=22:toaddr=192.168.122.11<br></div><div><br></div><div>The zone status after that is :<br></div><br>public (default, active)<br> interfaces: p7p1<br>
sources: <br> services: dhcpv6-client http https mdns ssh<br> ports: <br> masquerade: yes<br> forward-ports: port=22822:proto=tcp:toport=22:toaddr=192.168.122.11<br> icmp-blocks: <br> rich rules: <br></div><br></div>
But ssh on port 22822 is still not possible. There is a change though.<br></div>Without the forward rule nmap shows the port as "filtered", and after applying it it is shown as "closed" . I thought maybe there is something wrong with the routing, so I tried a simpler example :<br>
<br>$ firewall-cmd --zone=public --add-forward-port=port=8888:proto=tcp:toport=22:toaddr=127.0.0.1<br><br></div>to forward port 8888 to port 22 on loop back interface. SSH is enabled to listen on the lo interface, but I still get the same result if I try to connect on port 8888.<br>
</div><div><br></div><div>And if I don't specify destination address :<br><br>$ firewall-cmd --zone=public --add-forward-port=port=8888:proto=tcp:toport=22<br></div><div><br></div><div>Forwarding is working as expected.<br>
</div><div><br></div>Am I missing something, or doing something wrong ? Similar example is shown in the documentation at <a href="http://docs.fedoraproject.org/en-US/Fedora/19/html/Security_Guide/sec-Configure_Port_Forwarding-CLI.html">http://docs.fedoraproject.org/en-US/Fedora/19/html/Security_Guide/sec-Configure_Port_Forwarding-CLI.html</a> .<br>
</div><div>Is there something I need to enable on the target interfaces, for the forwarding to work ?<br></div><div><br></div>I really find firewallD very nice idea, but this is very frustrating ...<br><br></div>Cheers,<br>
</div>Zaro<br><div><div><div><div><div><div><div><br></div></div></div></div></div></div></div></div>