How do I open a port on one IP only with UFW?

Dave N asked:

I have seven IPs on my server. Using UFW, if I enter the rule ‘ufw allow 7443’, port 7443 is exposed and opened on all my IPs. But I only want port 7443 to be exposed on one particular IP address and to be closed on all the others. How do I achieve this?

My answer:


Specify the destination IP address as the to address:

sudo ufw allow to 198.51.100.205 port 7443/tcp

View the full question and any other answers on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.