We’ll learn how to allow IP addresses from Ubuntu Firewall in this UFW tutorial.
Using the ufw allow command in Ubuntu Firewall, we can add rules to allow IP addresses for all traffic or for specific network ports.
ufw allow from <Remote-IP> to <local-IP>
ufw allow from 192.168.1.50
This Firewall rule will allow all traffic from the IP Address 192.168.1.50.
ufw allow from 192.168.1.50 to 192.168.0.10
This one will allow all traffic from IP 192.168.1.50, But only on Local Server IP 192.168.0.10.
ufw allow from 192.168.1.10 to any proto tcp
From the Ubuntu firewall, we allow all network traffic related to the TCP protocol to the IP address 192.168.1.10.
ufw allow from 192.168.1.10 to any proto tcp port 80
Open Port 80 (HTTP Traffic) to the IP Address 192.168.1.10 from Ubuntu Firewall.
ufw allow from 192.168.1.10 to any proto udp port 53
This Rule will Open UDP port 53 to IP 192.168.1.10.
Allow IP Network From Ubuntu Firewall
Using the subnet mask prefix we can allow the entire subnetwork from the UFW Firewall.
ufw allow from 192.168.1.0/24 to any proto tcp port 21
This Rule will Allow FTP Traffic on 192.168.1.0/24 Network.
We learned how to use the ufw allow command to allow IP through the UFW Firewall in this tutorial. We can allow IP addresses for all network traffic or for specific network ports, as you learned