Changes between Version 14 and Version 15 of Csle2022/Agenda/FW


Ignore:
Timestamp:
Nov 24, 2022, 9:45:31 AM (2 years ago)
Author:
geethike
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Csle2022/Agenda/FW

    v14 v15  
    206206}}}
    207207Be aware that this command will fully disable the firewall service on your system.
     208
     209'''Block an IP Address'''
     210
     211To block all network connections that originate from a specific IP address, run the following command, replacing the highlighted IP address with the IP address that you want to block:
     212{{{
     213sudo ufw deny from 203.0.113.100
     214}}}
     215
     216{{{
     217Output
     218Rule added
     219}}}
     220In this example, from 203.0.113.100 specifies a source IP address of “203.0.113.100”.
     221
     222If you run sudo ufw status now, you’ll see the specified IP address listed as denied:
     223{{{
     224Output
     225Status: active
     226
     227To                         Action      From
     228--                         ------      ----
     229Anywhere                   DENY        203.0.113.100       
     230}}}
     231
     232'''Block a Subnet'''
     233
     234If you need to block a full subnet, you may use the subnet address as from parameter on the ufw deny command. This would block all IP addresses in the example subnet 203.0.113.0/24:
     235{{{
     236sudo ufw deny from 203.0.113.0/24
     237}}}
     238
     239{{{
     240Output
     241Rule added
     242}}}
     243
     244'''Block Incoming Connections to a Network Interface '''
     245
     246To block incoming connections from a specific IP address to a specific network interface, run the following command, replacing the highlighted IP address with the IP address you want to block:
     247{{{
     248sudo ufw deny in on eth0 from 203.0.113.100
     249}}}
     250
     251The '''''in''''' parameter tells '''''ufw''''' to apply the rule only for incoming connections, and the on '''''eth0''''' parameter specifies that the rule applies only for the '''eth0''' interface. This might be useful if you have a system with several network interfaces (including virtual ones) and you need to block external access to some of these interfaces, but not all.