User Tools

Site Tools


ufw_arguments

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
ufw_arguments [2016/07/24 20:26] walkeradminufw_arguments [2023/03/09 22:35] (current) – external edit 127.0.0.1
Line 9: Line 9:
 \\  \\ 
 Of the available arguments, the ones you’ll use the most with the ufw command are:\\  Of the available arguments, the ones you’ll use the most with the ufw command are:\\ 
-\\  
   * allow   * allow
   * deny    * deny 
   * reject   * reject
   * limit   * limit
-\\ +
   * status: displays if the firewall is active or inactive   * status: displays if the firewall is active or inactive
   * show: displays the current running rules on your firewall   * show: displays the current running rules on your firewall
Line 20: Line 19:
   * reload: reloads the current running firewall   * reload: reloads the current running firewall
   * disable: disables the firewall   * disable: disables the firewall
-\\  
-If you want to use a fuller syntax, you can then begin to define a source and a destination for a rule. Say, for example, you have an IP address you’ve discovered has been attempting to get into your machine (for whatever reason) through port 25 (SMTP). Let’s say that address is 192.168.2.100 (even though it’s an internal address) and your machine address is 192.168.2.101. To block that address from gaining access (through any port), you could create the rule like so: 
-sudo ufw deny from 192.168.2.100/8 to 192.168.2.101 port 25 
  
 +If you want to use a fuller syntax, you can then begin to define a source and a destination for a rule. Say, for example, you have an IP address you’ve discovered has been attempting to get into your machine (for whatever reason) through port 25 (SMTP). Let’s say that address is 192.168.2.100 (even though it’s an internal address) and your machine address is 192.168.2.101. To block that address from gaining access (through any port), you could create the rule like so:
 +\\ 
 +        sudo ufw deny from 192.168.2.100/8 to 192.168.2.101 port 25
 +\\ 
 +\\ 
 Let’s look at the limit option. If you have any reason for concern that someone might be attempting a denial of service attack on your machine, via port 80. You can limit connections to that port with UFW, like so: Let’s look at the limit option. If you have any reason for concern that someone might be attempting a denial of service attack on your machine, via port 80. You can limit connections to that port with UFW, like so:
 sudo ufw limit 80/tcp sudo ufw limit 80/tcp
 +\\  
 +\\ 
 By default, the connection will be blocked after six attempts in a 30-second period. By default, the connection will be blocked after six attempts in a 30-second period.
 +\\  
 +\\ 
 You might also have a need to allow outgoing traffic on a certain port but deny incoming traffic on the same port. To do this, you would use the directional argument like so. To allow outgoing traffic on port 25 (SMTP), issue the command: You might also have a need to allow outgoing traffic on a certain port but deny incoming traffic on the same port. To do this, you would use the directional argument like so. To allow outgoing traffic on port 25 (SMTP), issue the command:
-sudo ufw allow out on eth0 to any port 25 proto tcp +\\  
 +\\  
 +        sudo ufw allow out on eth0 to any port 25 proto tcp 
 +\\  
 +\\ 
 You could then add the next rule to block incoming traffic on the same interface and port: You could then add the next rule to block incoming traffic on the same interface and port:
-sudo ufw deny in on eth0 from any 25 proto tcp+\\  
 +        sudo ufw deny in on eth0 from any 25 proto tcp 
 +\\  
 +\\  
  
ufw_arguments.1469388364.txt.gz · Last modified: 2023/03/09 22:35 (external edit)