1

I'm looking for a way with firewall-cmd or another command to do the following.

An incoming public interface has multiple ip addresses bound to it. How can I forward ports only for one of the IP addresses?

bond0 - public:
 192.168.1.100 local machine SSHD bound here.
 192.168.1.200  --->  forward  SSH, HTTPS  to  192.168.1.53 vm bridge on machine 

I can use the --forward-port when I forward all incoming traffic on a given port, however I would like to do this only for traffic destined to one target IP.

Routing all traffic destined for .200 to the .53 vm would be the alternative, not sure how to accomplish that either.

2
$ firewall-cmd --zone=external \
    --add-forward-port=port=80:addr=172.16.1.1:proto=tcp:toport=80:toaddr=192.168.0.2

References

Using "Rich Language" rule

Forward IPv6 packets received from 1:2:3:4:6:: on port 4011 with protocol TCP to 1::2:3:4:7 on port 4012:

rule family="ipv6" source address="1:2:3:4:6::" forward-port to-addr="1::2:3:4:7" to-port="4012" protocol="tcp" port="4011"

4.5.3.7.4.5. Using the Rich Rule Log Command Example 5

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.