Article 5H5X3 UFW Config to only allow 1 IP address

UFW Config to only allow 1 IP address

by
Nightbane
from LinuxQuestions.org on (#5H5X3)
Having looked at several sources, I'm stumped as to how to do this. I want the Ubuntu computer to only be able to communicate with one other computer, at IP address 1.2.3.4 from across the internet.

My attempt (with a new Ubuntu Server VM) as root:

ufw disable

ufw default deny incoming
ufw default deny outgoing

ufw allow in on 1.2.3.4
ufw allow out on 1.2.3.4

ufw allow from 192.168.1.0/24
ufw allow to 192.168.1.0/24

ufw enable

ssh user@1.2.3.4

The output of this attempt is a ssh connection timeout. I've also tried these in place of lines 4-5:

ufw allow from 1.2.3.4
ufw allow to 1.2.3.4

I can't get it to work. Basically, I want the system's firewall to block all internet communication except to that server. I need it totally secure.latest?d=yIl2AUoC8zA latest?i=4wPCQhJbQ7A:1Rfs6V_AM04:F7zBnMy latest?i=4wPCQhJbQ7A:1Rfs6V_AM04:V_sGLiP latest?d=qj6IDK7rITs latest?i=4wPCQhJbQ7A:1Rfs6V_AM04:gIN9vFw4wPCQhJbQ7A
External Content
Source RSS or Atom Feed
Feed Location https://feeds.feedburner.com/linuxquestions/latest
Feed Title LinuxQuestions.org
Feed Link https://www.linuxquestions.org/questions/
Reply 0 comments