From 612bf9b55184236bd4275d6862d604c580d053d9 Mon Sep 17 00:00:00 2001 From: Pradeep Tarakar Date: Mon, 3 Aug 2026 02:33:10 +0530 Subject: [PATCH] ufw-{deny, allow}: add ufw-deny page and update ufw-allow (#23425) --- pages/linux/ufw-allow.md | 16 ++++++++++------ pages/linux/ufw-deny.md | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 42 insertions(+), 6 deletions(-) create mode 100644 pages/linux/ufw-deny.md diff --git a/pages/linux/ufw-allow.md b/pages/linux/ufw-allow.md index 29a7883eea..d2999f5952 100644 --- a/pages/linux/ufw-allow.md +++ b/pages/linux/ufw-allow.md @@ -5,24 +5,28 @@ - Allow all traffic on a port: -`ufw allow {{port}}` +`sudo ufw allow {{port}}` - Allow traffic for a protocol on a port: -`ufw allow {{port}}/{{protocol}}` +`sudo ufw allow {{port}}/{{protocol}}` - Allow incoming traffic for a protocol and add a comment for documentation: -`ufw allow in {{protocol}} comment '{{comment}}'` +`sudo ufw allow in {{protocol}} comment '{{comment}}'` - Allow all traffic from a source address: -`ufw allow from {{source_address}}` +`sudo ufw allow from {{source_address}}` + +- Allow all incoming traffic from the subnet 192.168.13.0/24: + +`sudo ufw allow from 192.168.13.0/24` - Allow TCP traffic from 192.168.1.12 to 192.168.1.100 on port 443: -`ufw allow from 192.168.1.12 to 192.168.1.100 port 443 proto tcp` +`sudo ufw allow from 192.168.1.12 to 192.168.1.100 port 443 proto tcp` - Allow all incoming GRE traffic to 192.168.1.100 on the eth0 interface: -`ufw allow in on eth0 to 192.168.1.100 proto gre` +`sudo ufw allow in on eth0 to 192.168.1.100 proto gre` diff --git a/pages/linux/ufw-deny.md b/pages/linux/ufw-deny.md new file mode 100644 index 0000000000..0fa2c2a82f --- /dev/null +++ b/pages/linux/ufw-deny.md @@ -0,0 +1,32 @@ +# ufw deny + +> Block traffic through the firewall. +> More information: . + +- Deny all traffic on a port: + +`sudo ufw deny {{port}}` + +- Deny traffic for a protocol on a port: + +`sudo ufw deny {{port}}/{{protocol}}` + +- Deny incoming traffic for a protocol and add a comment for documentation: + +`sudo ufw deny in {{protocol}} comment '{{comment}}'` + +- Deny all traffic from a source address: + +`sudo ufw deny from {{source_address}}` + +- Deny all incoming traffic from the subnet 192.168.13.0/24: + +`sudo ufw deny from 192.168.13.0/24` + +- Deny UDP traffic from 192.168.1.12 to 192.168.1.100 on port 8080: + +`sudo ufw deny from 192.168.1.12 to 192.168.1.100 port 8080 proto udp` + +- Deny all incoming IGMP traffic to 192.168.1.100 on the eth0 interface: + +`sudo ufw deny in on eth0 to 192.168.1.100 proto igmp`