Jump to content

Template:Networking rutos manual firewall: Difference between revisions

From Teltonika Networks Wiki
No edit summary
 
(46 intermediate revisions by 2 users not shown)
Line 14: Line 14:


This chapter of the user manual provides an overview of the Firewall page for {{{name}}} devices.
This chapter of the user manual provides an overview of the Firewall page for {{{name}}} devices.
{{Template:Networking_rutos_manual_basic_advanced_webui_disclaimer
| series = {{{series}}}
}}


==General Settings==
==General Settings==
Line 65: Line 61:
</ul>
</ul>


{{#ifeq: {{{name}}} | TRB500 | | ===Routing/NAT Offloading===
{{#switch: {{{series}}} | TRB500 | TRB501 | TRB1 | TRB16 | TRB5 = | #default = ===Routing/NAT Offloading===
----
----
The <b>Routing/NAT Offloading</b> is used to turns software flow offloading on or off.
The <b>Routing/NAT Offloading</b> is used to turn software flow offloading on or off.


The device checks whether the flow (sequence of related packets) is of a received a packed is known. Packets of unknown flow are forwarded to the networking stack. Meanwhile, if the flow is known, NAT is applied (if matched) and the packet is forwarded to the correct destination port. This process is called <b>software flow offloading</b>. {{#switch: {{{series}}} | RUTX | RUTM = <b>Hardware flow offloading</b> is used to execute functions of the router using the hardware directly, instead of a process of software functions. | #default =}}
The device checks whether the flow (sequence of related packets) is received and packed. Packets of unknown flow are forwarded to the networking stack. Meanwhile, if the flow is known, NAT is applied (if matched) and the packet is forwarded to the correct destination port (fast path) to bypass certain layers or packet processing process. As a result, we have a higher throughput and reduced the CPU load. This process is called <b>software flow offloading</b>. {{#switch: {{{series}}} | RUTX | RUTM | RUTC | OTD500 = <b>Hardware flow offloading</b> is used to execute functions of the router using the hardware directly, instead of a process of software functions. | #default =}}


{{#switch: {{{series}}}  
{{#switch: {{{series}}}  
| RUTX | RUTM = [[File:Networking_rutos_manual_firewall_general_settings_routing_nat_offloading_rutx_v2.png|border|class=tlt-border]]
| RUTM | RUTC | OTD500 = [[File:Networking_rutos_manual_firewall_general_settings_routing_nat_offloading_rutx_v3.png|border|class=tlt-border]]
| #default =[[File:Networking_rutos_manual_firewall_general_settings_routing_nat_offloading_v2.png|border|class=tlt-border]]}}
| RUTX = [[File:Networking_rutos_manual_firewall_general_settings_routing_nat_offloading_rutxx.png|border|class=tlt-border]]
| #default =[[File:Networking_rutos_manual_firewall_general_settings_routing_nat_offloading_v3.png|border|class=tlt-border]]}}
<table class="nd-mantable">
<table class="nd-mantable">
     <tr>
     <tr>
Line 82: Line 79:
     <tr>
     <tr>
         <td>Software flow offloading</td>
         <td>Software flow offloading</td>
         <td>off {{!}} on; default: <b>on</b></td>
         <td>off {{!}} <span style="color:blue">on</span>; default: <b>on</b></td>
         <td>Turns software flow offloading on or off.</td>
         <td>Software based offloading for routing/NAT.</td>
     </tr>
     </tr>
  {{#switch: {{{series}}} | RUTX | RUTM =   
  {{#switch: {{{series}}} | RUTM | RUTC | OTD500 =   
     <tr>
     <tr>
         <td>Hardware flow offloading</td>
         <td><span style="color:blue">Hardware flow offloading</span></td>
         <td>off {{!}} on; default: <b>on</b></td>
         <td>off {{!}} on; default: <b>on</b></td>
         <td>Turns hardware flow offloading on or off.</td>
         <td>Hardware based offloading for routing/NAT.</td>
     </tr>| #default =}}
     </tr>| #default =}}
    <tr>
        <td><span style="color:blue">IPsec software flow offload</span></td>
        <td>off {{!}} on; default: <b>off</b></td>
        <td>Software based offloading for IPsec.</td>
    </tr>
</table>}}
</table>}}


===Zones===
==Zones==
----
The <b>Zones</b> section is used to manage default traffic forwarding policies between different device zones. The figure below is an example of the Zones section and the table below provides information on the fields contained in that section:
The <b>Zones</b> section is used to manage default traffic forwarding policies between different device zones. The figure below is an example of the Zones section and the table below provides information on the fields contained in that section:


[[File:Networking_rutos_manual_firewall_general_settings_zones_v2.png|border|class=tlt-border]]
[[File:Networking_rutos_manual_firewall_general_settings_zones_v4.png|border|class=tlt-border]]
----
----
You can change a zone's settings from this page by interacting with entries in the zones table. For a more in-depth configuration click the edit button [[File:Networking_rutx_trb14x_manual_edit_button_v2.png|20px]] next to a zone:
You can change a zone's settings from this page by interacting with entries in the zones table. For a more in-depth configuration click the edit button [[File:Networking_rutx_trb14x_manual_edit_button_v2.png|20px]] next to a zone.


[[File:Networking_rutos_manual_firewall_general_settings_zones_edit_button_v2.png|border|class=tlt-border]]
===Zones: General Settings===
 
====Zones: General Settings====
----
----
[[File:Networking_rutos_manual_firewall_general_settings_zones_general_settings_v2.png|border|class=tlt-border]]
[[File:Networking_rutos_manual_firewall_general_settings_zones_general_settings_v3.png|border|class=tlt-border]]


<table class="nd-mantable">
<table class="nd-mantable">
Line 115: Line 114:
     <tr>
     <tr>
         <td>Name</td>
         <td>Name</td>
         <td>string; default: <b>newzone</b></td>
         <td>string; default: <b>none</b></td>
         <td>A custom name for the zone. Used for easier management purposes.</td>
         <td>A custom name for the zone. Used for easier management purposes.</td>
     </tr>
     </tr>
     <tr>
     <tr>
         <td>Input</td>
         <td>Input</td>
       <td>Reject | Drop | Accept; default: <b>Accept</b></td>
       <td>Accept | Drop | Reject; default: <b>Accept</b></td>
         <td>Default policy for traffic entering the zone.</td>
         <td>Default policy for traffic entering the zone.
          <ul>
              Possible variants:
              <li><b>ACCEPT:</b> packet gets to continue to the next chain.</li>
              <li><b>DROP:</b> packet is stopped and deleted.</li>
              <li><b>REJECT:</b> packet is stopped, deleted and, differently from Drop, an ICMP packet containing a message of rejection is sent to the source from which the dropped packet came.</li>
            </ul>
        </td>
     </tr>
     </tr>
     <tr>
     <tr>
         <td>Output</td>
         <td>Output</td>
       <td>Reject | Drop | Accept; default: <b>Accept</b></td>
       <td>Accept | Drop | Reject; default: <b>Accept</b></td>
         <td>Default policy for traffic originating from and leaving the zone.</td>
         <td>Default policy for traffic originating from and leaving the zone.
            <ul>
              Possible variants:
              <li><b>ACCEPT:</b> packet gets to continue to the next chain.</li>
              <li><b>DROP:</b> packet is stopped and deleted.</li>
              <li><b>REJECT:</b> packet is stopped, deleted and, differently from Drop, an ICMP packet containing a message of rejection is sent to the source from which the dropped packet came.</li>
            </ul>
        </td>
     </tr>
     </tr>
     <tr>
     <tr>
         <td>Forward</td>
         <td>Forwarding inside zone</td>
       <td>Reject | Drop | Accept; default: <b>Reject</b></td>
       <td>Accept | Drop | Reject; default: <b>Accept</b></td>
         <td>Default policy for traffic forwarded between the networks belonging to the zone.</td>
         <td>Default policy for traffic forwarded between the networks belonging to the zone.
            <ul>
              Possible variants:
              <li><b>ACCEPT:</b> packet gets to continue to the next chain.</li>
              <li><b>DROP:</b> packet is stopped and deleted.</li>
              <li><b>REJECT:</b> packet is stopped, deleted and, differently from Drop, an ICMP packet containing a message of rejection is sent to the source from which the dropped packet came.</li>
            </ul>
        </td>
     </tr>
     </tr>
     <tr>
     <tr>
Line 145: Line 165:
     <tr>
     <tr>
         <td>Covered networks</td>
         <td>Covered networks</td>
         <td>network interface(s); default: <b>none</b></td>
         <td>network interface(s); default: <b>depends on zone</b></td>
         <td>Network or networks that belong to the zone.</td>
         <td>Network or networks that belong to the zone.</td>
     </tr>
     </tr>
</table>
</table>


====Zones: Advanced Settings====
===Zones: Advanced Settings===
----
----
[[File:Networking_rutos_manual_firewall_general_settings_zones_advanced_settings_v4.png|border|class=tlt-border]]
[[File:Networking_rutos_manual_firewall_general_settings_zones_advanced_settings_v6.png|border|class=tlt-border]]


<table class="nd-mantable">
<table class="nd-mantable">
Line 163: Line 183:
         <td>Restrict to address family</td>
         <td>Restrict to address family</td>
         <td>IPv4 and IPv6 | IPv4 only | IPv6 only; default: <b>IPv4 and IPv6</b></td>
         <td>IPv4 and IPv6 | IPv4 only | IPv6 only; default: <b>IPv4 and IPv6</b></td>
         <td>IP address family to which to rule will apply.</td>
         <td>IP address family to which to zone will apply.</td>
     </tr>
     </tr>
     <tr>
     <tr>
Line 181: Line 201:
     </tr>
     </tr>
     <tr>
     <tr>
         <td>Enable logging on this zone</td>
         <td>Enable logging</td>
         <td>off | <span style="color: #1550bf; font-weight: bold;">on</span>; default: <b>off</b></td>
         <td>off | <span style="color: #1550bf; font-weight: bold;">on</span>; default: <b>off</b></td>
         <td>Logs packets that hit this rule.</td>
         <td>Log dropped and rejected packets.</td>
     </tr>
     </tr>
     <tr>
     <tr>
         <td><span style="color: #1550bf;">Limit log messages</span></td>
         <td><span style="color: #1550bf;">Limit log messages</span></td>
         <td>integer/minute; default: <b>none</b></td>
         <td>integer/minute; default: <b>none</b></td>
         <td>Limit how many messages can be logged in the span of 1 minute. For example, to log 50 packets per minute use: <i>50/minute</i>.</td>
         <td>Limit how many messages can be logged in the span of 1 minute. For example, to log 50 packets per minute use: 50/minute.</td>
     </tr>
     </tr>
     <tr>
     <tr>
         <td>Conntrack helpers</td>
         <td>Conntrack helpers</td>
         <td> Amanda backup and archiving proto (AMANDA) | FTP passive connection tracking (FTP) | RAS proto tracking (RAS) | Q.931 proto tracking (Q.931) | IRC DCC connection tracking (IRC) | NetBIOS name service broadcast tracking (NETBIOS-NS) | PPTP VPN connection tracking (PPTP) | SIP VoIP connection tracking (SIP) | SNMP monitoring connection tracking (SNMP) | TFTP connection tracking (TFTP); default: <b>none</b></td>
         <td> Amanda backup and archiving proto (AMANDA) | FTP passive connection tracking (FTP) | RAS proto tracking (RAS) | Q.931 proto tracking (Q.931) | IRC DCC connection tracking (IRC) | PPTP VPN connection tracking (PPTP) | SIP VoIP connection tracking (SIP) | SNMP monitoring connection tracking (SNMP) | TFTP connection tracking (TFTP); default: <b>none</b></td>
         <td><b>This option appears only when automatic helper assignment option in the firewall's general settings is disabled. </b>Explicitly choses allowed connection tracking helpers for zone traffic.</td>
         <td>Explicitly choses allowed connection tracking helpers for zone traffic.</td>
     </tr>
     </tr>
</table>
</table>


====Zones: Inter-zone Forwarding====
===Forwarding between zones===
----
----
The <b>Inter-zone forwarding</b> options control the forwarding policies between the currently edited zone and other zones.  
The options below control the forwarding policies between this zone (lan) and other zones. ''Destination zones'' cover forwarded traffic '''originating from lan'''. ''Source zones'' match forwarded traffic from other zones '''targeted at lan'''. The forwarding rule is ''unidirectional'' e.g., a forward from lan to wan does not imply a permission to forwad from wan to lan as well.  


[[File:Networking_rutos_manual_firewall_general_settings_zones_inter-zone_forwarding_v1.png|border|class=tlt-border]]
[[File:Networking_rutos_manual_firewall_general_settings_zones_inter-zone_forwarding_v2.png|border|class=tlt-border]]


<table class="nd-mantable">
<table class="nd-mantable">
Line 229: Line 249:
The Port forwards table displays configured port forwarding rules currently configured on the device.
The Port forwards table displays configured port forwarding rules currently configured on the device.


[[File:Networking_rutos_manual_firewall_port_forwards_port_forwards_v2.png|border|class=tlt-border]]
[[File:Networking_rutos_manual_firewall_port_forwards_port_forwards_v3.png|border|class=tlt-border]]
 
<table class="nd-mantable">
    <tr>
        <th>Field</th>
      <th>Value</th>
      <th>Description</th>
    </tr>
    <tr>
      <td>Name</td>
      <td>string; default: <b>none</b></td>
      <td>The name of the rule. This is used for easier management purposes.</td>
    </tr>
    <tr>
    <td>Match</td>
        <td></td>
        <td>Only match traffic using the given rules.</td>
    </tr>
    <tr>
    <td>Forward</td>
        <td></td>
        <td>Forward traffic to the given location.</td>
    </tr>
    <tr>
    <td>Status</td>
        <td></td>
        <td>Displays the status of NAT rule.</td>
    </tr>
    <tr>
    <td>Counter</td>
        <td></td>
        <td>Only the first packet of connection is usually counted due to stateful packet inspection (SPI). This also affects connectionless protocols.</td>
    </tr>
    <tr>
    <td>Enabled</td>
        <td>off {{!}} on; default <b>none</b></td>
        <td>Enables port forward rule.</td>
    </tr>
    <tr>
    <td>Actions</td>
        <td>clone {{!}} Edit {{!}} Delete; default <b>-</b></td>
        <td>Performs the selected action.</td>
    </tr>
</table>


===Add New Port Forward===
===Add new instance===
----
----
The <b>Add New Port Forward</b> section is used to quickly add additional port forwarding rules. The figure below is an example of the Add New Port Forward section and the table below provides information on the fields contained in that section:
The <b>Add new instance</b> section is used to quickly add additional port forwarding rules.


[[File:Networking_rutos_manual_firewall_port_forwards_add_new_port_forward_v3.png|border|class=tlt-border]]
[[File:Networking_rutos_manual_firewall_port_forwards_add_new_port_forward_v3.png|border|class=tlt-border]]
Line 249: Line 312:
     </tr>
     </tr>
     <tr>
     <tr>
        <td>External port</td>
    <td>External port</td>
         <td>integer [0..65535] | range of integers [0..65534] - [1..65535] | port inversion [!0..!65535]; default: <b>none</b></td>
         <td>Any {{!}} FTP data (20) {{!}} FTP cmd (21) {{!}} SSH (22) {{!}} Old SMTP (25) {{!}} DNS (53) {{!}} HTTP (80) {{!}} NTP (123) {{!}} BGP (179) {{!}} HTTPS (443) {{!}} ISAKMP (500) {{!}} Modern SMTP (587) {{!}} RDP (3389) {{!}} + Add new; default: <b>none</b></td>
         <td>The port number to which hosts will be connecting.</td>
         <td>Only match traffic coming to the given port.
          <ul>
              Possible variants:
              <li><b>Any:</b> Match everything</li>
              <li><b>Port:</b> 422</li>
              <li><b>Port range:</b> 1000-2000</li>
              <li><b>All except value:</b> !value</li>
          </ul>
        </td>
     </tr>
     </tr>
     <tr>
     <tr>
        <td>Internal IP address</td>
    <td>Internal IP address</td>
         <td>ip; default: <b>none</b></td>
         <td>IP | + Add new; default: <b>first IP from the list</b></td>
         <td>The IP address to which the incoming connection will be redirected.</td>
         <td>Forward traffic to the given network address.
          <ul>
              Possible variants:
              <li><b>Any:</b> Match everything</li>
              <li><b>IP address:</b> 192.168.1.1</li>
              <li><b>Subnet:</b> 192.168.1.0/24</li>
          </ul>
        </td>
     </tr>
     </tr>
     <tr>
     <tr>
        <td>Internal port</td>
    <td>Internal port</td>
         <td>integer [0..65535] | range of integers [0..65534] - [1..65535] | port inversion [!0..!65535]; default: <b>none</b></td>
         <td>No rewrite {{!}} FTP data (20) {{!}} FTP cmd (21) {{!}} SSH (22) {{!}} Old SMTP (25) {{!}} DNS (53) {{!}} HTTP (80) {{!}} NTP (123) {{!}} BGP (179) {{!}} HTTPS (443) {{!}} ISAKMP (500) {{!}} Modern SMTP (587) {{!}} RDP (3389) {{!}} + Add new; default: <b>No rewrite</b></td>
         <td>The port number to which the incoming connection will be redirected.</td>
         <td>Forward traffic to the given port.
          <ul>
              Possible variants:
              <li><b>No rewrite:</b> Keep External port</li>
              <li><b>Port:</b> 422</li>
              <li><b>Port range:</b> 1000-2000</li>
              <li><b>All except value:</b> !value</li>
          </ul>
        </td>
     </tr>
     </tr>
</table>
</table>
Line 293: Line 379:
     <tr>
     <tr>
         <td>Protocol</td>
         <td>Protocol</td>
         <td>TCP | UDP | ICMP | All | +Add new; default: <b>TCP+UDP</b></td>
         <td><span style="color:blue">TCP</span> | <span style="color:blue">UDP</span> | ICMP | All | +Add new; default: <b>TCP+UDP</b></td>
         <td>Specifies to which protocols the rule should apply.</td>
         <td>Only match traffic using the given internet communication protocol.
          <ul>
              Possible variants:
              <li><b>TCP:</b> used by most applications (e.g., web browsing, file downloads, games).</li>
              <li><b>UDP:</b> used by real-time applications that can accept packet loss (e.g., voice calls, video streaming).</li>
              <li><b>ICMP:</b> used for diagnostic, control and error transfers in networks (e.g., ping).</li>
              <li><b>All:</b> Accept all protocols</li>
              <li><b>Custom protocol:</b> sctp</li>
            </ul>
        </td>
     </tr>
     </tr>
     <tr>
     <tr>
         <td>Source zone</td>
         <td>Source zone</td>
         <td>firewall zone name; default: <b>wan</b></td>
         <td>Unspecified | firewall zone name | framed; default: <b>wan</b></td>
         <td>The zone to which the third party will be connecting. (Same thing as "External zone" in the New port forward section.)</td>
         <td>Only match traffic coming to the given firewall zone.</td>
     </tr>
     </tr>
     <tr>
     <tr>
        <td>External port</td>
    <td><span style="color:blue">External port</span></td>
         <td>integer [0..65535] | range of integers [0..65534] - [1..65535] | port inversion [!0..!65535]; default: <b>none</b></td>
         <td>Any {{!}} FTP data (20) {{!}} FTP cmd (21) {{!}} SSH (22) {{!}} Old SMTP (25) {{!}} DNS (53) {{!}} HTTP (80) {{!}} NTP (123) {{!}} BGP (179) {{!}} HTTPS (443) {{!}} ISAKMP (500) {{!}} Modern SMTP (587) {{!}} RDP (3389) {{!}} + Add new; default: <b>none</b></td>
         <td>Port number(s) to which hosts will be connecting.<br>The rule will apply only to hosts that connect to the port number(s) specified in this field. Leave empty to make the rule skip external port matching.</td>
         <td>Only match traffic coming to the given port.
          <ul>
              Possible variants:
              <li><b>Any:</b> Match everything</li>
              <li><b>Port:</b> 422</li>
              <li><b>Port range:</b> 1000-2000</li>
              <li><b>All except value:</b> !value</li>
          </ul>
        </td>
     </tr>
     </tr>
     <tr>
     <tr>
         <td>Internal zone</td>
         <td>Internal zone</td>
         <td>firewall zone name; default: <b>lan</b></td>
         <td>Unspecified | firewall zone name | framed; default: <b>lan</b></td>
         <td>The zone to which the incoming connection will be redirected.</td>
         <td>Forward traffic to the given firewall zone.</td>
     </tr>
     </tr>
     <tr>
     <tr>
        <td>Internal IP address</td>
    <td>Internal IP address</td>
         <td>Device LAN IP; default: <b>Device LAN IP</b></td>
         <td>Any | IP | + Add new; default: <b>first IP from the list</b></td>
         <td>The IP address to which the incoming connection will be redirected.</td>
         <td>Forward traffic to the given network address.
          <ul>
              Possible variants:
              <li><b>IP address:</b> 192.168.1.1</li>
              <li><b>Subnet:</b> 192.168.1.0/24</li>
          </ul>
        </td>
     </tr>
     </tr>
     <tr>
     <tr>
        <td>Internal port</td>
    <td><span style="color:blue">Internal port</span></td>
         <td>integer [0..65535] | range of integers [0..65534] - [1..65535] | port inversion [!0..!65535]; default: <b>none</b></td>
         <td>No rewrite {{!}} FTP data (20) {{!}} FTP cmd (21) {{!}} SSH (22) {{!}} Old SMTP (25) {{!}} DNS (53) {{!}} HTTP (80) {{!}} NTP (123) {{!}} BGP (179) {{!}} HTTPS (443) {{!}} ISAKMP (500) {{!}} Modern SMTP (587) {{!}} RDP (3389) {{!}} + Add new; default: <b>No rewrite</b></td>
         <td>The port number to which the incoming connection will be redirected.</td>
         <td>Forward traffic to the given port.
          <ul>
              Possible variants:
              <li><b>No rewrite:</b> Keep External port</li>
              <li><b>Port:</b> 422</li>
              <li><b>Port range:</b> 1000-2000</li>
              <li><b>All except value:</b> !value</li>
          </ul>
        </td>
     </tr>
     </tr>
</table>
</table>
Line 335: Line 452:
     <tr>
     <tr>
         <td>Source MAC address</td>
         <td>Source MAC address</td>
         <td>mac; default: <b>none</b></td>
         <td>mac | + Add new; default: <b>Any</b></td>
         <td>MAC address of connecting hosts.<br>The rule will apply only to hosts that match MAC addresses specified in this field. Leave empty to make the rule skip MAC address matching.</td>
         <td>Only match traffic coming from the given MAC address.
          <ul>
              Possible variants:
              <li><b>Any:</b> Match everything</li>
              <li><b>Mac address:</b> 01:23:45:56:78:9a</li>
              <li><b>All except value:</b> !value</li>
          </ul>
        </td>
     </tr>
     </tr>
     <tr>
     <tr>
        <td>Source IP address</td>
    <td>Source IP address</td>
         <td>ip | ip/netmask; default: <b>any</b></td>
         <td>IP | + Add new; default: <b>Any</b></td>
         <td>IP address or network segment used by connecting hosts.<br>The rule will apply only to hosts that connect from IP addresses specified in this field.<br>To specify a network segment instead of one IP address, add a forward slash followed by the netmask length after the network indication (for example, <i>10.0.0.0/8</i>).</td>
         <td>Only match traffic coming from the given network address.
          <ul>
              Possible variants:
              <li><b>Any:</b> Match everything</li>
              <li><b>IP address:</b> 192.168.1.1</li>
              <li><b>Subnet:</b> 192.168.1.0/24</li>
              <li><b>All except value:</b> !value</li>
          </ul>
        </td>
     </tr>
     </tr>
     <tr>
     <tr>
        <td>Source port</td>
    <td><span style="color:blue">Source port</span></td>
         <td>integer [0..65535] | range of integers [0..65534] - [1..65535] | port inversion [!0..!65535]; default: <b>none</b></td>
         <td>FTP data (20) {{!}} FTP cmd (21) {{!}} SSH (22) {{!}} Old SMTP (25) {{!}} DNS (53) {{!}} HTTP (80) {{!}} NTP (123) {{!}} BGP (179) {{!}} HTTPS (443) {{!}} ISAKMP (500) {{!}} Modern SMTP (587) {{!}} RDP (3389) {{!}} + Add new; default: <b>Any</b></td>
         <td>Port number(s) used by the connecting host.<br>The rule will match the source port used by the connecting host with the port number(s) specified in this field. Leave empty to make the rule skip source port matching.</td>
         <td>Only match traffic coming from the given port.
          <ul>
              Possible variants:
              <li><b>Any:</b> Match everything</li>
              <li><b>Port:</b> 422</li>
              <li><b>Port range:</b> 1000-2000</li>
              <li><b>All except value:</b> !value</li>
          </ul>
        </td>
     </tr>
     </tr>
     <tr>
     <tr>
        <td>External IP address</td>
    <td>External IP address</td>
         <td>ip | ip/netmask; default: <b>any</b></td>
         <td>Any | IP | + Add new; default: <b>Any</b></td>
         <td>IP address or network segment to which hosts will be connecting.<br>The rule will apply only to hosts that connect to IP addresses specified in this field.<br>To specify a subnet instead of one IP, add a forward slash followed by the netmask length after the network indication (for example, <i>10.0.0.0/8</i>).</td>
         <td>Only match traffic coming to the given network address.
          <ul>
              Possible variants:
              <li><b>Any:</b> Match everything</li>
              <li><b>IP address:</b> 192.168.1.1</li>
              <li><b>Subnet:</b> 192.168.1.0/24</li>
              <li><b>All except value:</b> !value</li>
          </ul>
        </td>
     </tr>
     </tr>
     <tr>
     <tr>
Line 361: Line 509:
         <td>Extra arguments</td>
         <td>Extra arguments</td>
         <td>string; default: <b>none</b></td>
         <td>string; default: <b>none</b></td>
         <td>Adds extra iptables options to the rule.</td>
         <td>Passes additional arguments to iptables. Use with care!</td>
     </tr>
     </tr>
</table>
</table>
Line 369: Line 517:
The <b>Traffic rules</b> tab is used to set firewall rules that filter traffic moving through the device. The figure below is an example of the Traffic rules table:
The <b>Traffic rules</b> tab is used to set firewall rules that filter traffic moving through the device. The figure below is an example of the Traffic rules table:


[[File:Networking_rutos_manual_firewall_traffic_rules_v2.png|border|class=tlt-border]]
[[File:Networking_rutos_manual_firewall_traffic_rules_v5.png|border|class=tlt-border]]
 
<table class="nd-mantable">
    <tr>
        <th>Field</th>
      <th>Value</th>
      <th>Description</th>
    </tr>
    <tr>
      <td>Name</td>
      <td>string; default: <b>-</b></td>
      <td>The name of the rule. This is used for easier management purposes.</td>
    </tr>
    <tr>
    <td>Match</td>
        <td></td>
        <td>Only match traffic using the given rules.</td>
    </tr>
    <tr>
    <td>Action</td>
        <td></td>
        <td>Take given action when traffic matches all conditions.</td>
    </tr>
    <tr>
    <td>Status</td>
        <td></td>
        <td>Displays the status of NAT rule.</td>
    </tr>
    <tr>
    <td>Counter</td>
        <td></td>
        <td>Only the first packet of connection is usually counted due to stateful packet inspection (SPI). This also affects connectionless protocols.</td>
    </tr>
    <tr>
    <td>Enabled</td>
        <td>off {{!}} on; default <b>none</b></td>
        <td>Enables traffic rule.</td>
    </tr>
    <tr>
    <td>Actions</td>
        <td>clone {{!}} Edit {{!}} Delete; default <b>-</b></td>
        <td>Performs the selected action.</td>
    </tr>
</table>


===Traffic Rule Configuration===
===Traffic Rule Configuration===
Line 400: Line 591:
     <tr>
     <tr>
     <td>Protocol</td>
     <td>Protocol</td>
         <td>TCP | UDP | All | +Add new |<span style="color:red">ICMP</span>; default: <b>depends on the rule</b></td>
         <td><span style="color:blue">TCP</span> | <span style="color:blue">UDP</span> | <span style="color:red">ICMP</span> | All | +Add new; default: <b>depends on the rule</b></td>
         <td>Specifies to which protocols the rule should apply.</td>
         <td>Only match traffic using the given internet communication protocol.
          <ul>
              Possible variants:
              <li><b>TCP:</b> used by most applications (e.g., web browsing, file downloads, games)</li>
              <li><b>UDP:</b> used by real-time applications that can accept packet loss (e.g., voice calls, video streaming)</li>
              <li><b>ICMP:</b> used for diagnostic, control and error transfers in networks (e.g., ping)</li>
              <li><b>All:</b> Accept all protocols</li>
              <li><b>Custom protocol:</b> sctp</li>
            </ul>
        </td>
     </tr>
     </tr>
     <tr>
     <tr>
         <td><span style="color:red"> Match ICMP type</span></td>
         <td><span style="color:red"> Match ICMP type</span></td>
         <td>Any | ICMP-type | + Add new; default: '''none'''</td>
         <td>Any | ICMP-type (list) | + Add new; default: <b>Any</b></td>
         <td>Allows matching specific ICMP types.</td>
         <td>Only match traffic having the given ICMP type.</td>
     </tr>
     </tr>
     <tr>
     <tr>
         <td>Source zone</td>
         <td>Source zone</td>
         <td>firewall zone name; default: '''wan'''</td>
         <td>firewall zone; default: '''wan'''</td>
         <td>The zone to which the third party will be connecting.</td>
         <td>Only match traffic coming to the given firewall zone.</td>
     </tr>
     </tr>
     <tr>
     <tr>
         <td>Source IP address</td>
         <td>Source IP address</td>
         <td>ip | ip/netmask; default: <b>any</b></td>
         <td>ip address; default: <b>Any</b></td>
         <td>IP address or network segment used by connecting hosts.<br>The rule will apply only to hosts that connect from IP addresses specified in this field.<br>To specify a network segment instead of one IP address, add a forward slash followed by the netmask length after the network indication (for example, <i>10.0.0.0/8</i>).</td>
         <td>Only match traffic coming from the given network address.
          <ul>
              Possible variants:
              <li><b>Any:</b> Match everything</li>
              <li><b>IP address:</b> 192.168.1.1</li>
              <li><b>Subnet:</b> 192.168.1.0/24</li>
              <li><b>IPv6 address:</b> 123:1::5:6:7</li>
              <li><b>IPv6 Subnet:</b> 123:1:5:6::0/64</li>
              <li><b>All except value:</b> !value</li>
          </ul>
        </td>
     </tr>
     </tr>
     <tr>
     <tr>
         <td>Source port</td>
         <td><span style="color:blue">Source port</span></td>
         <td>integer [0..65535] | range of integers [0..65534] - [1..65535] | port inversion [!0..!65535]; default: <b>none</b></td>
         <td>FTP data (20) {{!}} FTP cmd (21) {{!}} SSH (22) {{!}} Old SMTP (25) {{!}} DNS (53) {{!}} HTTP (80) {{!}} NTP (123) {{!}} BGP (179) {{!}} HTTPS (443) {{!}} ISAKMP (500) {{!}} Modern SMTP (587) {{!}} RDP (3389) {{!}} + Add new; default: <b>Any</b></td>
         <td>Port number(s) used by the connecting host.<br>The rule will match the source port used by the connecting host with the port number(s) specified in this field. Leave empty to make the rule skip source port matching. Port negation using is also available, for ex. <b>!1</b>.<td>
         <td>Only match traffic coming from the given port.
          <ul>
              Possible variants:
              <li><b>Any:</b> Match everything</li>
              <li><b>Port:</b> 422</li>
              <li><b>Port range:</b> 1000-2000</li>
              <li><b>All except value:</b> !value</li>
          </ul>
        </td>
     </tr>
     </tr>
     <tr>
     <tr>
     <td>Destination zone</td>
     <td>Destination zone</td>
         <td>firewall zone; default: <b>Device (input)</b></td>
         <td>firewall zone; default: <b>Device (input)</b></td>
         <td>Target zone of the incoming connection.</td>
         <td>Only match traffic being forwarded to to the given firewall zone.</td>
     </tr>
     </tr>
     <tr>
     <tr>
     <td>Destination address</td>
     <td>Destination address</td>
         <td>ip | ip/netmask; default: <b>any</b></td>
         <td>ip address; default: <b>Any</b></td>
         <td>Tagert IP address or network segment of the incoming connection.</td>
         <td>Only match traffic being forwarded to the given network address.
          <ul>
              Possible variants:
              <li><b>Any:</b> Match everything</li>
              <li><b>IP address:</b> 192.168.1.1</li>
              <li><b>Subnet:</b> 192.168.1.0/24</li>
              <li><b>IPv6 address:</b> 123:1::5:6:7</li>
              <li><b>IPv6 Subnet:</b> 123:1:5:6::0/64</li>
              <li><b>All except value:</b> !value</li>
            </ul>
        </td>
     </tr>
     </tr>
     <tr>
     <tr>
     <td>Destination port</td>
     <td><span style="color:blue">Destination port</span></td>
         <td>integer [0..65535] | range of integers [0..65534] - [1..65535] | port inversion [!0..!65535]; default: <b>none</b></td>
         <td>FTP data (20) {{!}} FTP cmd (21) {{!}} SSH (22) {{!}} Old SMTP (25) {{!}} DNS (53) {{!}} HTTP (80) {{!}} NTP (123) {{!}} BGP (179) {{!}} HTTPS (443) {{!}} ISAKMP (500) {{!}} Modern SMTP (587) {{!}} RDP (3389) {{!}} + Add new; default: <b>Any</b></td>
         <td>Tagert port or range of ports of the incoming connection. Port negation using is also available, for ex. <b>!1</b>.</td>
         <td>Only match traffic being forwarded to the given port.
          <ul>
              Possible variants:
              <li><b>Any:</b> Match everything</li>
              <li><b>Port:</b> 422</li>
              <li><b>Port range:</b> 1000-2000</li>
              <li><b>All except value:</b> !value</li>
          </ul>
        </td>
     </tr>
     </tr>
     <tr>
     <tr>
     <td>Action</td>
     <td>Action</td>
         <td>Drop | Accept | Reject | Don't track | <span style="color:green">DSCP</span> | <span style="color:blue">Mark</span>; default: <b>Accept</b></td>
         <td>Drop | Accept | Reject | Do not track | <span style="color:green">Change DSCP</span> | <span style="color:olive">Mark</span> | <span style="color:red">Change TTL</span>; default: <b>Accept</b></td>
         <td>Action that is to be taken when a packet matches the conditions of the rule.
         <td>Take given action when traffic matches all conditions.
             <ul>
             <ul>
                Possible variants:
                <li><b>Accept</b> – packet gets to continue to the next chain.</li>
                 <li><b>Drop</b> – packet is stopped and deleted.</li>
                 <li><b>Drop</b> – packet is stopped and deleted.</li>
                <li><b>Accept</b> – packet gets to continue to the next chain.</li>
                 <li><b>Reject</b> – packet is stopped, deleted and, differently from Drop, an ICMP packet containing a message of rejection is sent to the source from which the dropped packet came.</li>
                 <li><b>Reject</b> – packet is stopped, deleted and, differently from Drop, an ICMP packet containing a message of rejection is sent to the source from which the dropped packet came.</li>
                 <li><b>Don't track</b> – packet is no longer tracked as it moves forward.</li>
                 <li><b>Change DSCP:</b> – packet is marked with specified DiffServ Code Point value.</li>
                 <li><b>DSCP</b> – packet is marked with specified DiffServ Code Point value.</li>
                 <li><b>Do not track</b> – packet gets excluded from connection tracking (conntrack).</li>
                 <li><b>Mark</b> – packet is marked with specified firewall mark..</li>
                 <li><b>Mark</b> – packet is marked with specified firewall mark.</li>
                <li><b>Change TTL</b> – packet's TTL value is adjusted based on the selected action.</li>
                <li><b>Clamp MSS</b> – packet's MSS will be clamped to improve compatability with other networks. Only available if protocol is TCP.</li>
             </ul>
             </ul>
         </td>
         </td>
     </tr>
     </tr>
  </table>
    <tr>
    <td><span style="color:green">DSCP value</span></td>
        <td>Default {{!}} CS1 {{!}} AF11 {{!}} AF12 {{!}} AF13 {{!}} CS2 {{!}} AF21 {{!}} AF22 {{!}} AF23...; default: <b>Default</b></td>
        <td>DSCP value to use for actions.</td>
    </tr>
    <tr>
    <td><span style="color:olive">Mark value</span></td>
        <td>hexadecimal string; default: <b>empty</b></td>
        <td>Mark value to use for actions.</td>
    </tr>
    <tr>
    <td><span style="color:red">TTL action</span></td>
        <td>Set | Increment | Decrement; default: <b>Set</b></td>
        <td>TTL action to apply to packets.</td>
    </tr>
    <tr>
    <td><span style="color:red">TTL value</span></td>
        <td>integer [1..255]; default: <b>none</b></td>
        <td>TTL value to use for actions.</td>
    </tr>
</table>


====Advanced settings====
====Advanced settings====
Line 461: Line 720:
       <td>Restrict to address family</td>
       <td>Restrict to address family</td>
       <td>IPv4 and IPv6 | IPv4 only | IPv6 only; default: <b>IPv4 and IPv6</b></td>
       <td>IPv4 and IPv6 | IPv4 only | IPv6 only; default: <b>IPv4 and IPv6</b></td>
       <td>IP address family to which the rule will apply to.</td>
       <td>Only match traffic using the given IP family.</td>
     </tr>
     </tr>
     <tr>
     <tr>
         <td>Source MAC address</td>
         <td>Source MAC address</td>
         <td>mac; default: <b>none</b></td>
         <td>mac | + Add new; default: <b>Any</b></td>
         <td>MAC address(es) of connecting hosts.<br>The rule will apply only to hosts that match MAC addresses specified in this field. Leave empty to make the rule skip MAC address matching.</td>
         <td>Only match traffic coming from the given MAC address.
    </tr>
          <ul>
  <tr>
              Possible variants:
    <td><span style="color:green">DSCP</span>: Set Target value</td>
              <li><b>Any:</b> Match everything</li>
        <td>Default | DSCP values; default: <b>Default</b></td>
              <li><b>Mac address:</b> 01:23:45:56:78:9a</li>
        <td>If specified, target traffic against the given firewall DSCP value.</td>
              <li><b>All except value:</b> !value</li>
    </tr>
          </ul>
    <tr>
         </td>
    <td><span style="color:blue">Mark</span>: Set Target value</td>
        <td>hex; default: <b>none</b></td>
         <td>If specified, target traffic against the given firewall mark, e.g. 0xFF to target mark 255 or 0x0/0x1 to target any even mark value.</td>
     </tr>
     </tr>
     <tr>
     <tr>
Line 490: Line 746:
     <tr>
     <tr>
     <td><span style="color:blue">Mark</span>: Set Match value</td>
     <td><span style="color:blue">Mark</span>: Set Match value</td>
         <td>hex; default: <b>none</b></td>
         <td>hexadecimal string; default: <b>none</b></td>
         <td>If specified, match traffic against the given firewall mark, e.g. 0xFF to match mark 255 or 0x0/0x1 to match any even mark value.</td>
         <td>If specified, match traffic against the given firewall mark, e.g. FF or ff to match mark 255.</td>
     </tr>
     </tr>
     <tr>
     <tr>
Line 537: Line 793:
     <td>Time in UTC</td>
     <td>Time in UTC</td>
         <td>off | on; default: <b>no</b></td>
         <td>off | on; default: <b>no</b></td>
         <td>Specifies whether the device should use UTC time. If this is disabled, the time zone specified in the Services → [[{{{name}}} NTP|NTP]] page will be used.</td>
         <td>Specifies whether the device should use UTC time. If this is disabled, the time zone specified in the System → Administration → [[{{{name}}}_Administration#NTP|NTP]] page will be used.</td>
     </tr>
     </tr>
</table>
</table>
Line 556: Line 812:
       <td>Name</td>
       <td>Name</td>
       <td>string; default: <b>none</b></td>
       <td>string; default: <b>none</b></td>
       <td>The name of the rule. This is used for easier management purposes.<br>The name field is filled automatically when port numbers are specified, unless the name was specified beforehand by the user.</td>
       <td>Name of the rule. This is only used for easier management purposes.</td>
     </tr>
     </tr>
     <tr>
     <tr>
     <td>Protocol</td>
     <td>Protocol</td>
         <td>TCP | UDP | ICMP | All | +Add new; default: <b>none</b></td>
         <td>TCP | UDP | ICMP | All | +Add new; default: <b>depends on the rule</b></td>
         <td>Specifies to which protocols the rule should apply.</td>
         <td>Only match traffic using the given internet communication protocol.
    </tr>
          <ul>
    <tr>
              Possible variants:
    <td>External port</td>
              <li><b>TCP:</b> used by most applications (e.g., web browsing, file downloads, games)</li>
        <td>integer [0..65535] | range of integers [0..65534] - [1..65535] | port inversion [!0..!65535]; default: <b>none</b></td>
              <li><b>UDP:</b> used by real-time applications that can accept packet loss (e.g., voice calls, video streaming)</li>
        <td>Specifies which port(s) should be opened.</td>
              <li><b>ICMP:</b> used for diagnostic, control and error transfers in networks (e.g., ping)</li>
              <li><b>All:</b> Accept all protocols</li>
              <li><b>Custom protocol:</b> sctp</li>
            </ul>
        </td>
     </tr>
     </tr>
</table>
</table>
Line 574: Line 834:
In the <b>Add new instance</b> section, select <b>Add new forward rule</b>. This is used to create firewall rules that control traffic on the FORWARD chain. The figure below is an example of the Add New Forward Rule section and the table below provides information on the fields contained in that section:
In the <b>Add new instance</b> section, select <b>Add new forward rule</b>. This is used to create firewall rules that control traffic on the FORWARD chain. The figure below is an example of the Add New Forward Rule section and the table below provides information on the fields contained in that section:


[[File:Networking_rutos_manual_firewall_traffic_rules_add_new_forward_rule_v2.png|border|class=tlt-border]]
[[File:Networking_rutos_manual_firewall_traffic_rules_add_new_forward_rule_v3.png|border|class=tlt-border]]


<table class="nd-mantable">
<table class="nd-mantable">
Line 589: Line 849:
     <tr>
     <tr>
     <td>Source zone</td>
     <td>Source zone</td>
         <td>firewall zone; default: <b>wan</b></td>
         <td>firewall zone; default: <b>lan</b></td>
         <td>The zone from which traffic has originated.</td>
         <td>Only match traffic coming to the given firewall zone.</td>
     </tr>
     </tr>
     <tr>
     <tr>
     <td>Destination zone</td>
     <td>Destination zone</td>
         <td>firewall zone; default: <b>lan</b></td>
         <td>firewall zone; default: <b>lan</b></td>
         <td>The zone to which traffic will be forwarded to.</td>
         <td>Only match traffic being forwarded to the given firewall zone.</td>
     </tr>
     </tr>
     <tr>
     <tr>
Line 606: Line 866:
==NAT Rules==
==NAT Rules==


<b>Network address translation</b> (<b>NAT</b>) is method of modifying the source/destination address and/or port information in a packet's IP header.
<b>NAT</b> rules allow fine grained control over the source IP to use for outbound or forwarded traffic.


===Source NAT===
The NAT section displays currently existing NAT rules.
----
<b>Source NAT</b> (<b>SNAT</b>) is a form of masquerading used to change a packet's source address and/or port number to a static, user-defined value. SNAT is performed in the POSTROUTING chain, just before a packet leaves the device.


The Source NAT section displays currently existing SNAT rules.
[[File:Networking_rutos_manual_firewall_nat_rules_v1.png|border|class=tlt-border]]


[[File:Networking_rutos_manual_firewall_nat_rules_source_nat_v2.png|border|class=tlt-border]]
<table class="nd-mantable">
    <tr>
        <th>Field</th>
      <th>Value</th>
      <th>Description</th>
    </tr>
    <tr>
      <td>Name</td>
      <td>string; default: <b>none</b></td>
      <td>The name of the rule. This is used for easier management purposes.</td>
    </tr>
    <tr>
    <td>Match</td>
        <td></td>
        <td>Only match traffic using the given rules.</td>
    </tr>
    <tr>
    <td>Action</td>
        <td></td>
        <td>Modify traffic with the given rules.</td>
    </tr>
    <tr>
    <td>Status</td>
        <td></td>
        <td>Displays the status of NAT rule.</td>
    </tr>
    <tr>
    <td>Counter</td>
        <td></td>
        <td>Only the first packet of connection is usually counted due to stateful packet inspection (SPI). This also affects connectionless protocols.</td>
    </tr>
    <tr>
    <td>Enabled</td>
        <td>off {{!}} on; default <b>none</b></td>
        <td>Enables NAT rule.</td>
    </tr>
    <tr>
    <td>Actions</td>
        <td>clone {{!}} Edit {{!}} Delete; default <b>-</b></td>
        <td>Performs the selected action.</td>
    </tr>
</table>


===Add New Source NAT===
===Add new instance===
----
----
The <b>Add New Source NAT</b> section is used to create new source NAT rules.
The <b>Add new instance</b> section is used to create new NAT rules.


[[File:Networking_rutos_manual_firewall_nat_rules_add_new_source_nat_v2.png|border|class=tlt-border]]
[[File:Networking_rutos_manual_firewall_nat_rules_add_new.png|border|class=tlt-border]]


<table class="nd-mantable">
<table class="nd-mantable">
Line 631: Line 930:
       <td>Name</td>
       <td>Name</td>
       <td>string; default: <b>none</b></td>
       <td>string; default: <b>none</b></td>
       <td>The name of the rule. Used only for easier management purposes.</td>
       <td>The name of the rule. This is used for easier management purposes.</td>
     </tr>
     </tr>
     <tr>
     <tr>
     <td>Source zone</td>
     <td>Source zone</td>
         <td>firewall zone; default: <b>lan</b></td>
         <td>firewall zone; default: <b>lan</b></td>
         <td>Matches traffic originated from the specified zone.</td>
         <td>Only match traffic coming to the given firewall zone.</td>
    </tr>
    <tr>
    <td>Destination Zone</td>
        <td>firewall zone; default: <b>wan</b></td>
        <td>Matches traffic destined for the specified zone.</td>
     </tr>
     </tr>
     <tr>
     <tr>
     <td>To source IP</td>
     <td>Rewrite IP</td>
         <td>ip | do not rewrite; default: <b>none</b></td>
         <td>IP | + Add new; default: <b>first IP from the list</b></td>
         <td>Changes the source IP address in the packet header to the value specified in this field.</td>
         <td>Rewrite matched traffic to the given source network address.
          <ul>
              Possible variants:
              <li><b>IP address:</b> 192.168.1.1</li>
              <li><b>Subnet:</b> 192.168.1.0/24</li>
          </ul>
        </td>
     </tr>
     </tr>
     <tr>
     <tr>
     <td>To Source Port</td>
     <td>Rewrite Port</td>
         <td>integer [0..65335] | port inversion [!0..!65535] | do not rewrite; default: <b>none</b></td>
         <td>integer [0..65335] | port inversion [!0..!65535] | do not rewrite; default: <b>none</b></td>
         <td>Changes the source port in the packet header to the value specified in this field.</td>
         <td>Rewrite matched traffic to the given source port.
          <ul>
              Possible variants:
              <li><b>No rewrite:</b> Keep Source port</li>
              <li><b>Port:</b> 422</li>
              <li><b>Port range:</b> 1000-2000</li>
          </ul>
        </td>
     </tr>
     </tr>
     <tr>
     <tr>
Line 660: Line 967:
</table>
</table>


===Source NAT Configuration===
===NAT Configuration===
----
----
In order to begin editing a traffic rule, click the edit button [[File:Networking_rutx_trb14x_manual_edit_button_v2.png|20px]] next to it:


[[File:Networking_rutos_manual_firewall_nat_rules_source_nat_edit_button_v2.png|border|class=tlt-border]]
After adding new rule, you will be redirected to that rule's configuration page:


You will be redirected to that rule's configuration page:
[[File:Networking rutos manual firewall nat rules configuration.png|border|class=tlt-border]]
 
[[File:Networking rutos manual firewall nat rules configuration mobile general.png|border|class=tlt-border]]


<table class="nd-mantable">
<table class="nd-mantable">
Line 688: Line 992:
     <tr>
     <tr>
     <td>Protocol</td>
     <td>Protocol</td>
         <td>TCP | UDP | ICMP | +Add new; default: <b>All protocols</b></td>
         <td><span style="color:blue">TCP</span> | <span style="color:blue">UDP</span> | ICMP | All | +Add new; default: <b>All</b></td>
         <td>Specifies to which protocols the rule should apply.</td>
         <td>Only match traffic using the given internet communication protocol.
          <ul>
              Possible variants:
              <li><b>TCP:</b> used by most applications (e.g., web browsing, file downloads, games).</li>
              <li><b>UDP:</b> used by real-time applications that can accept packet loss (e.g., voice calls, video streaming).</li>
              <li><b>ICMP:</b> used for diagnostic, control and error transfers in networks (e.g., ping).</li>
              <li><b>All:</b> Accept all protocols</li>
              <li><b>Custom protocol:</b> sctp</li>
            </ul>
        </td>
     </tr>
     </tr>
     <tr>
     <tr>
     <td>Source zone</td>
     <td>Outband zone</td>
         <td>firewall zone; default: <b>lan</b></td>
         <td>firewall zone; default: <b>lan</b></td>
         <td>Matches traffic originated from the specified zone.</td>
         <td>Only match traffic leaving the given firewall zone.</td>
     </tr>
     </tr>
     <tr>
     <tr>
         <td>Source IP address</td>
         <td>Source IP address</td>
         <td>ip | ip/netmask; default: <b>Any</b></td>
         <td>ip address; default: <b>Any</b></td>
         <td>Mathes traffic originated from specified IP address or network segment.</td>
         <td>Only match traffic coming from the given network address.
          <ul>
              Possible variants:
              <li><b>Any:</b> Match everything</li>
              <li><b>IP address:</b> 192.168.1.1</li>
              <li><b>Subnet:</b> 192.168.1.0/24</li>
              <li><b>IPv6 address:</b> 123:1::5:6:7</li>
              <li><b>IPv6 Subnet:</b> 123:1:5:6::0/64</li>
              <li><b>All except value:</b> !value</li>
          </ul>
        </td>
     </tr>
     </tr>
     <tr>
     <tr>
         <td>Source port</td>
         <td><span style="color:blue">Source port</span></td>
         <td>integer [0..65535] | range of integers [0..65534] - [1..65535] | port inversion [!0..!65535]; default: <b>none</b></td>
         <td>FTP data (20) {{!}} FTP cmd (21) {{!}} SSH (22) {{!}} Old SMTP (25) {{!}} DNS (53) {{!}} HTTP (80) {{!}} NTP (123) {{!}} BGP (179) {{!}} HTTPS (443) {{!}} ISAKMP (500) {{!}} Modern SMTP (587) {{!}} RDP (3389) {{!}} + Add new; default: <b>Any</b></td>
         <td>Mathes traffic originated from specified port number.</td>
         <td>Only match traffic coming from the given port.
          <ul>
              Possible variants:
              <li><b>Any:</b> Match everything</li>
              <li><b>Port:</b> 422</li>
              <li><b>Port range:</b> 1000-2000</li>
              <li><b>All except value:</b> !value</li>
          </ul>
        </td>
     </tr>
     </tr>
    <tr>
    <td>Destination zone</td>
        <td>firewall zone; default: <b>wan</b></td>
        <td>Matches traffic destined for the specified zone.</td>
    </tr>   
     <tr>
     <tr>
     <td>Destination IP address</td>
     <td>Destination IP address</td>
         <td>ip | ip/netmask; default: <b>any</b></td>
         <td>ip address; default: <b>Any</b></td>
         <td>Matches traffic destined for the specified IP address or network segment.</td>
         <td>Only match traffic being forwarded to the given network address.
          <ul>
              Possible variants:
              <li><b>Any:</b> Match everything</li>
              <li><b>IP address:</b> 192.168.1.1</li>
              <li><b>Subnet:</b> 192.168.1.0/24</li>
              <li><b>All except value:</b> !value</li>
            </ul>
        </td>
     </tr>
     </tr>
     <tr>
     <tr>
     <td>Destination port</td>
     <td><span style="color:blue">Destination port</span></td>
         <td>integer [0..65535] | range of integers [0..65534] - [1..65535] | port inversion [!0..!65535]; default: <b>none</b></td>
         <td>FTP data (20) {{!}} FTP cmd (21) {{!}} SSH (22) {{!}} Old SMTP (25) {{!}} DNS (53) {{!}} HTTP (80) {{!}} NTP (123) {{!}} BGP (179) {{!}} HTTPS (443) {{!}} ISAKMP (500) {{!}} Modern SMTP (587) {{!}} RDP (3389) {{!}} + Add new; default: <b>Any</b></td>
         <td>Matches traffic destined for the specified port number.</td>
         <td>Only match traffic being forwarded to the given port.
          <ul>
              Possible variants:
              <li><b>Any:</b> Match everything</li>
              <li><b>Port:</b> 422</li>
              <li><b>Port range:</b> 1000-2000</li>
              <li><b>All except value:</b> !value</li>
          </ul>
        </td>
     </tr>
     </tr>
     <tr>
     <tr>
    <td>Rewrite port</td>
      <td>Action</td>
        <td>integer [0..65535] | range of integers [0..65534] - [1..65535] | port inversion [!0..!65535]; default: <b>No rewrite</b></td>
      <td>SNAT | MASQUERADE | ACCEPT; default <b>SNAT</b></td>
        <td>Rewrite matched traffic to the given source port.</td>
      <td>NAT action to use on matched traffic.
          <ul>
              Possible variants:
              <li><b>SNAT:</b> rewrite to specific source IP or port.</li>
              <li><b>MASQUERADE:</b> automatically rewrite to outbound interface IP.</li>
              <li><b>ACCEPT:</b> blacklist from having IP or port rewritten.</li>
          </ul>
        </td>
     </tr>
     </tr>
     </table>
     <tr>
    <td>Rewrite IP address</td>
        <td>ip address; default: <b>Any</b></td>
        <td>Only match traffic being forwarded to the given network address.
          <ul>
              Possible variants:
              <li><b>Any:</b> Match everything</li>
              <li><b>IP address:</b> 192.168.1.1</li>
              <li><b>Subnet:</b> 192.168.1.0/24</li>
              <li><b>All except value:</b> !value</li>
            </ul>
        </td>
      </tr>
</table>
      
      
    [[File:Networking rutos manual firewall nat rules configuration mobile advanced.png|border|class=tlt-border]]
[[File:Networking rutos manual firewall nat rules configuration advanced.png|border|class=tlt-border]]
      
      
     <table class="nd-mantable">
     <table class="nd-mantable">
Line 739: Line 1,101:
     <td>Extra arguments</td>
     <td>Extra arguments</td>
         <td>string; default: <b>none</b></td>
         <td>string; default: <b>none</b></td>
         <td>Adds extra .iptables options to the rule.</td>
         <td>Passes additional arguments to iptables. Use with care!</td>
     </tr>
     </tr>
     </table>
     </table>
      
      
    [[File:Networking rutos manual firewall nat rules configuration mobile time restriction.png|border|class=tlt-border]]
[[File:Networking rutos manual firewall nat rules configuration time restriction.png|border|class=tlt-border]]
      
      
     <table class="nd-mantable">
     <table class="nd-mantable">
Line 784: Line 1,146:
     <td>Time in UTC</td>
     <td>Time in UTC</td>
         <td>off | on; default: <b>no</b></td>
         <td>off | on; default: <b>no</b></td>
         <td>Specifies whether the device should use UTC time. If this is disabled, the time zone specified in the Services → [[{{{name}}} NTP|NTP]] page will be used.</td>
         <td>Specifies whether the device should use UTC time. If this is disabled, the time zone specified in the System → Administration → [[{{{name}}}_Administration#NTP|NTP]] page will be used.</td>
     </tr>
     </tr>
</table>
</table>
Line 792: Line 1,154:
The <b>Attack Prevention</b> menu tab provides the possibility to configure protections against certain types of online attacks.
The <b>Attack Prevention</b> menu tab provides the possibility to configure protections against certain types of online attacks.


===SYN Flood Protection===
[[File:Networking_rutos_manual_firewall_attack_prevention_main.png|border|class=tlt-border]]
 
<table class="nd-mantable">
    <tr>
        <th>Field</th>
      <th>Value</th>
      <th>Description</th>
    </tr>
    <tr>
      <td>Attack type</td>
      <td></td>
      <td>Name of attack prevention type.</td>
    </tr>
    <tr>
      <td>Enable</td>
      <td>off | on</td>
      <td>Enable attack from WAN zone prevention (except SYN flood which applies to all zones).</td>
    </tr>
    <tr>
      <td>Advanced settings</td>
      <td>-interactive button (Edit)</td>
      <td>Opens attack prevention configuration window.</td>
    </tr>
</table>
 
<b>Note:</b> the individual attack prevention configuration windows are shown below.
 
===SYN flood===
----
----
<b>SYN Flood Protection</b> allows you to protect yourself from attacks that exploit part of the normal TCP three-way handshake to consume resources on the targeted server and render it unresponsive. Essentially, with SYN flood DDOS, the offender sends TCP connection requests faster than the targeted machine can process them, causing network over-saturation.
<b>SYN Flood attack prevention</b> allows you to protect yourself from attacks that exploit part of the normal TCP three-way handshake to consume resources on the targeted server and render it unresponsive. Essentially, with SYN flood DDOS, the offender sends TCP connection requests faster than the targeted machine can process them, causing network over-saturation.


[[File:Networking_rutos_manual_firewall_attack_prevention_syn_flood_protection_v2.png|border|class=tlt-border]]
[[File:Networking_rutos_manual_firewall_attack_prevention_syn_flood_protection_v3.png|border|class=tlt-border]]


<table class="nd-mantable">
<table class="nd-mantable">
Line 805: Line 1,194:
     </tr>
     </tr>
     <tr>
     <tr>
       <td>Enable SYN flood protection</td>
       <td>Enable attack prevention</td>
       <td>off | on; default: <b>on</b></td>
       <td>off {{!}} on; default: <b>on</b></td>
       <td>Turns the rule on or off.</td>
       <td>Enable new connection throttle for the "SYN flood" to prevent flood attacks from all zones. It uses token bucket algorithm.</td>
     </tr>
     </tr>
     <tr>
     <tr>
       <td>SYN flood rate</td>
       <td>Limit</td>
       <td>integer; default: <b>5</b></td>
       <td>integer [1..10000]; default: <b>25</b></td>
       <td>Set rate limit (packets per second) for SYN packets above which the traffic is considered floodedb</td>
       <td>The maximum theoretical rate. It represents how quickly the burst refills.</td>
     </tr>
     </tr>
     <tr>
     <tr>
     <td>SYN flood burst</td>
     <td>Burst</td>
         <td>integer; default: <b>10</b></td>
         <td>integer [1..10000]; default: <b>50</b></td>
         <td>Sets burst limit for SYN packets above which the traffic is considered flooded if it exceeds the allowed ratbe</td>
         <td>Sets burst limit for SYN packets above which the traffic is considered flooded if it exceeds the allowed rate</td>
     </tr>
     </tr>
     <tr>
     <tr>
     <td>TCP SYN cookies</td>
     <td>TCP SYN cookies</td>
         <td>off | on; default: <b>on</b></td>
         <td>off {{!}} on; default: <b>on</b></td>
         <td>Enables the use of SYN cookies (particular choices of initial TCP sequence numbers by TCP servers)</td>
         <td>Enables the use of SYN cookies (particular choices of initial TCP sequence numbers by TCP servers)</td>
     </tr>
     </tr>
</table>
</table>


===Remote ICMP Requests===
===Ping flood===
----
----
Some attackers use <b>ICMP echo request</b> packets directed to IP broadcast addresses from remote locations to generate denial-of-service attacks. You can set up some custom restrictions to help protect your router from ICMP bursts.  
Some attackers use <b>ICMP echo request</b> packets directed to IP broadcast addresses from remote locations to generate denial-of-service attacks. You can set up some custom restrictions to help protect your router from ICMP bursts.  


[[File:Networking_rutos_manual_firewall_attack_prevention_remote_icmp_requests.png|border|class=tlt-border]]
[[File:Networking_rutos_manual_firewall_attack_prevention_remote_icmp_requests_v3.png|border|class=tlt-border]]


<table class="nd-mantable">
<table class="nd-mantable">
Line 839: Line 1,228:
     </tr>
     </tr>
     <tr>
     <tr>
       <td>Enable ICMP requests</td>
       <td>Enable remote ping requests</td>
       <td>off | on; default: <b>on</b></td>
       <td>off {{!}} on; default: <b>on</b></td>
       <td>Turns the rule on or off.</td>
       <td>Allows remote (WAN zone) ICMP echo-request type.</td>
    </tr>
    <tr>
      <td>Enable attack prevention</td>
      <td>off {{!}} <span style="color: #1550bf;">on</span>; default: <b>off</b></td>
      <td>Enable new connection throttle for the "Ping flood" to prevent flood attacks from WAN zone. It uses token bucket algorithm.</td>
     </tr>
     </tr>
     <tr>
     <tr>
      <td>Enable ICMP limit</td>
    <td><span style="color: #1550bf;">Limit</span></td>
      <td>off | <span style="color: #1550bf;">on</span>; default: <b>off</b></td>
        <td>integer [1..10000]; default: <b>60</b></td>
      <td>Turns ICMP echo-request limit in selected period on or off.</td>
        <td>The maximum theoretical rate. It represents how quickly the burst refills.</td>
     </tr>
     </tr>
     <tr>
     <tr>
     <td><span style="color: #1550bf;">Limit period</span></td>
     <td><span style="color: #1550bf;">Limit period</span></td>
         <td>Second | Minute | Hour | Day; default: <b>Second</b></td>
         <td>Second {{!}} Minute {{!}} Hour {{!}} Day; default: <b>Second</b></td>
       <td>Period length for matching the conditions of the rule.</td>
       <td>Period length for matching the conditions of the rule.</td>
     </tr>
     </tr>
     <tr>
     <tr>
     <td><span style="color: #1550bf;">Limit</span></td>
     <td><span style="color: #1550bf;">Burst</span></td>
         <td>integer; default: <b>5</b></td>
         <td>integer [1..10000]; default: <b>60</b></td>
         <td>Maximum ICMP echo-request number during the period.</td>
         <td>The maximum number of new connections that can occur in a short time. This is the token bucket, which is depleted with each new connection. It refills at the rate defined by the limit, and if empty, new connections are blocked.</td>
     </tr>
     </tr>
     <tr>
     <tr>
     <td><span style="color: #1550bf;">Limit burst</span></td>
     <td><span style="color: #1550bf;">Enable logging</span></td>
         <td>integer; default: <b>10</b></td>
         <td>off {{!}} on; default: <b>off</b></td>
        <td>Indicates the maximum burst before the above limit kicks in.</td>
      <td>Flood detection events will be logged to [[{{{name}}}__Maintenance#Troubleshoot_Logs|System log]].</td>
     </tr>
     </tr>
</table>
</table>


===SSH Attack Prevention===
===SSH flood===
----
----
This protection prevent <b>SSH attacks</b> by limiting connections in a defined period.
This protection prevent <b>SSH attacks</b> by limiting connections in a defined period.


[[File:Networking_rutos_manual_firewall_attack_prevention_ssh_attack_prevention.png|border|class=tlt-border]]
[[File:Networking_rutos_manual_firewall_attack_prevention_ssh_attack_prevention_v3.png|border|class=tlt-border]]


<table class="nd-mantable">
<table class="nd-mantable">
Line 878: Line 1,272:
     </tr>
     </tr>
     <tr>
     <tr>
       <td>Enable SSH limit</td>
       <td>Enable attack prevention</td>
       <td>off | on; default: <b>off</b></td>
       <td>off {{!}} <span style="color: #1550bf;">on</span>; default: <b>off</b></td>
       <td>Turns the rule on or off.</td>
       <td>Enable new connection throttle for the "SSH flood" to prevent flood attacks from WAN zone. It uses token bucket algorithm.</td>
    </tr>
    <tr>
    <td><span style="color: #1550bf;">Limit</span></td>
        <td>integer [1..10000]; default: <b>100</b></td>
        <td>The maximum theoretical rate. It represents how quickly the burst refills.</td>
     </tr>
     </tr>
     <tr>
     <tr>
      <td>Limit period</td>
    <td><span style="color: #1550bf;">Limit period</span></td>
      <td>Second | Minute | Hour | Day; default: <b>Second</b></td>
        <td>Second {{!}} Minute {{!}} Hour {{!}} Day; default: <b>Second</b></td>
       <td>Period length for matching the conditions of the rule.</td>
       <td>Period length for matching the conditions of the rule.</td>
     </tr>
     </tr>
     <tr>
     <tr>
     <td>Limit</td>
     <td><span style="color: #1550bf;">Burst</span></td>
         <td>integer; default: <b>5</b></td>
         <td>integer [1..10000]; default: <b>100</b></td>
         <td>Maximum SSH connections during the set period</td>
         <td>The maximum number of new connections that can occur in a short time. This is the token bucket, which is depleted with each new connection. It refills at the rate defined by the limit, and if empty, new connections are blocked.</td>
     </tr>
     </tr>
     <tr>
     <tr>
     <td>Limit burst</td>
     <td><span style="color: #1550bf;">Enable logging</span></td>
         <td>integer; default: <b>10</b></td>
         <td>off {{!}} on; default: <b>off</b></td>
        <td>Indicates the maximum burst before the above limit kicks in.</td>
      <td>Flood detection events will be logged to [[{{{name}}}__Maintenance#Troubleshoot_Logs|System log]].</td>
     </tr>
     </tr>
</table>
</table>


===HTTP Attack Prevention===
===HTTP flood===
----
----
An <b>HTTP attack</b> sends a complete, legitimate HTTP header, which includes a 'Content-Length' field to specify the size of the message body to follow. However, the attacker then proceeds to send the actual message body at an extremely slow rate (e.g. 1 byte/100 seconds.) Due to the entire message being correct and complete, the target server will attempt to obey the 'Content-Length' field in the header, and wait for the entire body of the message to be transmitted, hence slowing it down.
An <b>HTTP attack</b> sends a complete, legitimate HTTP header, which includes a 'Content-Length' field to specify the size of the message body to follow. However, the attacker then proceeds to send the actual message body at an extremely slow rate (e.g. 1 byte/100 seconds.) Due to the entire message being correct and complete, the target server will attempt to obey the 'Content-Length' field in the header, and wait for the entire body of the message to be transmitted, hence slowing it down.


[[File:Networking_rutos_manual_firewall_attack_prevention_http_attack_prevention.png|border|class=tlt-border]]
[[File:Networking_rutos_manual_firewall_attack_prevention_http_attack_prevention_v3.png|border|class=tlt-border]]


<table class="nd-mantable">
<table class="nd-mantable">
Line 912: Line 1,311:
     </tr>
     </tr>
     <tr>
     <tr>
       <td>Enable HTTP limit</td>
       <td>Enable attack prevention</td>
       <td>off | on; default: <b>off</b></td>
       <td>off {{!}} <span style="color: #1550bf;">on</span>; default: <b>off</b></td>
       <td>Turns the rule on or off.</td>
       <td>Enable new connection throttle for the "HTTP flood" to prevent flood attacks from WAN zone. It uses token bucket algorithm.</td>
    </tr>
    <tr>
    <td><span style="color: #1550bf;">Limit</span></td>
        <td>integer [1..10000]; default: <b>120</b></td>
        <td>The maximum theoretical rate. It represents how quickly the burst refills.</td>
     </tr>
     </tr>
     <tr>
     <tr>
      <td>Limit period</td>
    <td><span style="color: #1550bf;">Limit period</span></td>
      <td>Second | Minute | Hour | Day; default: <b>Second</b></td>
        <td>Second {{!}} Minute {{!}} Hour {{!}} Day; default: <b>Second</b></td>
       <td>Period length for matching the conditions of the rule.</td>
       <td>Period length for matching the conditions of the rule.</td>
     </tr>
     </tr>
     <tr>
     <tr>
     <td>Limit</td>
     <td><span style="color: #1550bf;">Burst</span></td>
         <td>integer; default: <b>5</b></td>
         <td>integer [1..10000]; default: <b>120</b></td>
         <td>Maximum HTTP connections during the set period<./td>
         <td>The maximum number of new connections that can occur in a short time. This is the token bucket, which is depleted with each new connection. It refills at the rate defined by the limit, and if empty, new connections are blocked.</td>
     </tr>
     </tr>
     <tr>
     <tr>
     <td>Limit burst</td>
     <td><span style="color: #1550bf;">Enable logging</span></td>
         <td>integer; default: <b>10</b></td>
         <td>off {{!}} on; default: <b>off</b></td>
        <td>Indicates the maximum burst before the above limit kicks in.</td>
      <td>Flood detection events will be logged to [[{{{name}}}__Maintenance#Troubleshoot_Logs|System log]].</td>
     </tr>
     </tr>
</table>
</table>


===HTTPS Attack Prevention===
===HTTPS flood===
----
----
This section allows you to enable protection against <b>HTTPS attacks</b>, also known as "man-in-the-middle" attacks (MITM).
This section allows you to enable protection against <b>HTTPS attacks</b>, also known as "man-in-the-middle" attacks (MITM).
Line 939: Line 1,343:
In cryptography and computer security, a man-in-the-middle attack (MITM) is an attack where the perpetrator secretly relays and possibly alters the communication between two parties who believe they are directly communicating with each other. One example of man-in-the-middle attacks is active eavesdropping, in which the attacker makes independent connections with the victims and relays messages between them to make them believe they are talking directly to each other over a private connection, when in fact the entire conversation is controlled by the attacker.
In cryptography and computer security, a man-in-the-middle attack (MITM) is an attack where the perpetrator secretly relays and possibly alters the communication between two parties who believe they are directly communicating with each other. One example of man-in-the-middle attacks is active eavesdropping, in which the attacker makes independent connections with the victims and relays messages between them to make them believe they are talking directly to each other over a private connection, when in fact the entire conversation is controlled by the attacker.


[[File:Networking_rutos_manual_firewall_attack_prevention_https_attack_prevention.png|border|class=tlt-border]]
[[File:Networking_rutos_manual_firewall_attack_prevention_https_attack_prevention_v3.png|border|class=tlt-border]]


<table class="nd-mantable">
<table class="nd-mantable">
Line 948: Line 1,352:
     </tr>
     </tr>
     <tr>
     <tr>
       <td>Enable HTTPS limit</td>
       <td>Enable attack prevention</td>
       <td>off | on; default: <b>off</b></td>
       <td>off {{!}} <span style="color: #1550bf;">on</span>; default: <b>off</b></td>
       <td>Turns the rule on or off.</td>
       <td>Enable new connection throttle for the "HTTPS flood" to prevent flood attacks from WAN zone. It uses token bucket algorithm.</td>
    </tr>
    <tr>
    <td><span style="color: #1550bf;">Limit</span></td>
        <td>integer [1..10000]; default: <b>120</b></td>
        <td>The maximum theoretical rate. It represents how quickly the burst refills.</td>
     </tr>
     </tr>
     <tr>
     <tr>
      <td>Limit period</td>
    <td><span style="color: #1550bf;">Limit period</span></td>
      <td>Second | Minute | Hour | Day; default: <b>Second</b></td>
        <td>Second {{!}} Minute {{!}} Hour {{!}} Day; default: <b>Second</b></td>
       <td>Period length for matching the conditions of the rule.</td>
       <td>Period length for matching the conditions of the rule.</td>
     </tr>
     </tr>
     <tr>
     <tr>
     <td>Limit</td>
     <td><span style="color: #1550bf;">Burst</span></td>
         <td>integer; default: <b>5</b></td>
         <td>integer [1..10000]; default: <b>120</b></td>
         <td>Maximum HTTPS connections during the set period.</td>
         <td>The maximum number of new connections that can occur in a short time. This is the token bucket, which is depleted with each new connection. It refills at the rate defined by the limit, and if empty, new connections are blocked.</td>
     </tr>
     </tr>
     <tr>
     <tr>
     <td>Limit burst</td>
     <td><span style="color: #1550bf;">Enable logging</span></td>
         <td>integer; default: <b>10</b></td>
         <td>off {{!}} on; default: <b>off</b></td>
        <td>Indicates the maximum burst number before the above limit kicks in.</td>
      <td>Flood detection events will be logged to [[{{{name}}}__Maintenance#Troubleshoot_Logs|System log]].</td>
     </tr>
     </tr>
</table>
</table>
Line 974: Line 1,383:
Port scanning is usually done in the initial phase of a penetration test in order to discover all network entry points into the target system. The Port Scan section provides you with the possibility to enable protection against port scanning software. The Defending Type section provides the possibility for the user to enable protections from certain types of online attacks. These include <b>SYN-FIN</b>, <b>SYN-RST</b>, <b>X-Mas</b>, <b>FIN scan</b> and <b>NULLflags</b> attacks.
Port scanning is usually done in the initial phase of a penetration test in order to discover all network entry points into the target system. The Port Scan section provides you with the possibility to enable protection against port scanning software. The Defending Type section provides the possibility for the user to enable protections from certain types of online attacks. These include <b>SYN-FIN</b>, <b>SYN-RST</b>, <b>X-Mas</b>, <b>FIN scan</b> and <b>NULLflags</b> attacks.


[[File:Networking_rutos_manual_firewall_attack_prevention_port_scan.png|border|class=tlt-border]]
[[File:Networking_rutos_manual_firewall_attack_prevention_port_scan_v3.png|border|class=tlt-border]]


<table class="nd-mantable">
<table class="nd-mantable">
Line 983: Line 1,392:
     </tr>
     </tr>
     <tr>
     <tr>
       <td>Enable</td>
       <td>Enable port scan prevention</td>
       <td>off | on; default: <b>off</b></td>
       <td>off {{!}} on; default: <b>off</b></td>
       <td>Turns the function on or off.</td>
       <td>Enable brute force port scan prevention from WAN zone. If there is too much TCP packets from same host without responses they start to be rejected.</td>
     </tr>
     </tr>
     <tr>
     <tr>
     <td>Scan count</td>
     <td>Scan count</td>
         <td>integer [5..65534]; default: <b>5</b></td>
         <td>integer [5..255]; default: <b>5</b></td>
         <td>How many port scans before blocked.</td>
         <td>Port scan (TCP packet without response) count before packets are rejected.</td>
     </tr>
     </tr>
     <tr>
     <tr>
       <td>Interval</td>
       <td>Interval</td>
       <td>integer [10..60]; default: <b>10</b></td>
       <td>integer [10..1000]; default: <b>10</b></td>
       <td>Time interval in seconds in which port scans are counted.</td>
       <td>Time span (in seconds) in which 'scan count' has to be reached before packets are rejected.</td>
     </tr>
     </tr>
     <tr>
     <tr>
       <td>SYN-FIN attack</td>
       <td>SYN-FIN attack</td>
       <td>off | on; default: <b>off</b></td>
       <td>off {{!}} on; default: <b>off</b></td>
       <td>Turns protection from SYN-FIN attacks on or off.</td>
       <td>Turns protection from SYN-FIN attacks on or off.</td>
     </tr>
     </tr>
     <tr>
     <tr>
       <td>SYN-RST attack</td>
       <td>SYN-RST attack</td>
       <td>off | on; default: <b>off</b></td>
       <td>off {{!}} on; default: <b>off</b></td>
       <td>Turns protection from SYN-RST attacks on or off.</td>
       <td>Turns protection from SYN-RST attacks on or off.</td>
     </tr>
     </tr>
     <tr>
     <tr>
     <td>X-Mas attack</td>
     <td>X-Mas attack</td>
         <td>off | on; default: <b>off</b></td>
         <td>off {{!}} on; default: <b>off</b></td>
         <td>Turns protection from X-Mas attacks on or off.</td>
         <td>Turns protection from X-Mas attacks on or off.</td>
     </tr>
     </tr>
     <tr>
     <tr>
     <td>FIN scan</td>
     <td>FIN scan</td>
         <td>off | on; default: <b>off</b></td>
         <td>off {{!}} on; default: <b>off</b></td>
         <td>Turns protection from FIN scan attacks on or off.</td>
         <td>Protect from nmap FIN scan.</td>
     </tr>
     </tr>
     <tr>
     <tr>
     <td>NULLflags attack</td>
     <td>NULLflags attack</td>
         <td>off | on; default: <b>off</b></td>
         <td>off {{!}} on; default: <b>off</b></td>
         <td>Turns protection from NULLflags attacks on or off.</td>
         <td>Turns protection from NULLflags attacks on or off.</td>
     </tr>
     </tr>
Line 1,044: Line 1,453:
The <b>DMZ</b> is a security concept. It comprises the separation of the LAN-side network into at least two networks: the user LAN and the DMZ. Generally the DMZ is imprisoned: only access to certain ports from the Internet are allowed into the DMZ, while the DMZ is not allowed to establish new connections to the WAN-side or LAN-side networks. That way, if a server inside of the DMZ is hacked the potential damage that can be done remains restricted! The whole point of the DMZ is to cleanly create a unique firewall rule set that dramatically restricts access in to, and out of the, DMZ.
The <b>DMZ</b> is a security concept. It comprises the separation of the LAN-side network into at least two networks: the user LAN and the DMZ. Generally the DMZ is imprisoned: only access to certain ports from the Internet are allowed into the DMZ, while the DMZ is not allowed to establish new connections to the WAN-side or LAN-side networks. That way, if a server inside of the DMZ is hacked the potential damage that can be done remains restricted! The whole point of the DMZ is to cleanly create a unique firewall rule set that dramatically restricts access in to, and out of the, DMZ.


[[File:Networking rutos manual network firewall dmz.png|border|class=tlt-border]]
[[File:Networking rutos manual network firewall dmz_v3.png|border|class=tlt-border]]


<table class="nd-mantable">
<table class="nd-mantable">
Line 1,054: Line 1,463:
     <tr>
     <tr>
         <td>Enable</td>
         <td>Enable</td>
         <td>off | on; default: <b>off</b></td>
         <td>off {{!}} on; default: <b>off</b></td>
         <td>Enables the DMZ configuration.</td>
         <td>Enables the DMZ configuration.</td>
    </tr>
    <tr>
        <td>Status</td>
        <td>state; default: <b></b></td>
        <td>Displays the status of the DMZ.</td>
    </tr>
    <tr>
        <td>Counter</td>
        <td>count of packets; default: <b></b></td>
        <td>Only the first packet of connection is usually counted due to stateful packet inspection (SPI). This also affects connectionless protocols.</td>
     </tr>
     </tr>
     <tr>
     <tr>
Line 1,064: Line 1,483:
     <tr>
     <tr>
         <td>Protocol</td>
         <td>Protocol</td>
         <td>All | <span style="color:blue">TCP</span> | <span style="color:blue">UDP</span> | ICMP; default: <b>None</b></td>
         <td>All {{!}} <span style="color:blue">TCP</span> {{!}} <span style="color:blue">UDP</span> {{!}} ICMP; default: <b>None</b></td>
         <td>Specifies for which protocols the DMZ will be used.</td>
         <td>Specifies for which protocols the DMZ will be used.</td>
     </tr>
     </tr>
     <tr>
     <tr>
         <td><span style="color:blue">Ports</span></td>
         <td><span style="color:blue">Ports</span></td>
         <td>0..65535 | port range | port negation; default: <b>none</b></td>
         <td>0..65535 {{!}} port range {{!}} port negation; default: <b>none</b></td>
         <td>Match incoming traffic directed at the given destination port or port range on DMZ host IP.</td>
         <td>Match incoming traffic directed at the given destination port or port range on DMZ host IP.</td>
     </tr>
     </tr>

Latest revision as of 11:49, 23 October 2025

The information in this page is updated in accordance with firmware version .


Summary

{{{name}}} devices use a standard Linux iptables package as its firewall, which uses routing chains and policies to facilitate control over inbound and outbound traffic.

This chapter of the user manual provides an overview of the Firewall page for {{{name}}} devices.

General Settings

The General Settings section is used to configure the main policies of the device's firewall. The figure below is an example of the General Settings section and the table below provides information on the fields contained in that section:

Field Value Description
Drop invalid packets off | on; default: off If enabled, a "Drop" action will be performed on packets that are determined to be invalid.
Automatic helper assignment off | on; default: on Automatically assigns conntrack helpers based on traffic protocol and port. If turned off, conntrack helpers can be selected for each zone.
Input Reject | Drop | Accept; default: Reject Default action* of the INPUT chain if a packet does not match any existing rule on that chain.
Output Reject | Drop | Accept; default: Accept Default action* of the OUTPUT chain if a packet does not match any existing rule on that chain.
Forward Reject | Drop | Accept; default: Reject Default action* of the FORWARD chain if a packet does not match any existing rule on that chain.

* When a packet goes through a firewall chain it is matched against all the rules of that specific chain. If no rule matches said packet, an according Action (Drop, Reject or Accept) is performed:

  • Accept – packet gets to continue to the next chain.
  • Drop – packet is stopped and deleted.
  • Reject – packet is stopped, deleted and, differently from Drop, a message of rejection is sent to the source from which the packet came.

Routing/NAT Offloading


The Routing/NAT Offloading is used to turn software flow offloading on or off.

The device checks whether the flow (sequence of related packets) is received and packed. Packets of unknown flow are forwarded to the networking stack. Meanwhile, if the flow is known, NAT is applied (if matched) and the packet is forwarded to the correct destination port (fast path) to bypass certain layers or packet processing process. As a result, we have a higher throughput and reduced the CPU load. This process is called software flow offloading.

Field Value Description
Software flow offloading off | on; default: on Software based offloading for routing/NAT.
IPsec software flow offload off | on; default: off Software based offloading for IPsec.

Zones

The Zones section is used to manage default traffic forwarding policies between different device zones. The figure below is an example of the Zones section and the table below provides information on the fields contained in that section:


You can change a zone's settings from this page by interacting with entries in the zones table. For a more in-depth configuration click the edit button next to a zone.

Zones: General Settings


Field Value Description
Name string; default: none A custom name for the zone. Used for easier management purposes.
Input Accept | Drop | Reject; default: Accept Default policy for traffic entering the zone.
    Possible variants:
  • ACCEPT: packet gets to continue to the next chain.
  • DROP: packet is stopped and deleted.
  • REJECT: packet is stopped, deleted and, differently from Drop, an ICMP packet containing a message of rejection is sent to the source from which the dropped packet came.
Output Accept | Drop | Reject; default: Accept Default policy for traffic originating from and leaving the zone.
    Possible variants:
  • ACCEPT: packet gets to continue to the next chain.
  • DROP: packet is stopped and deleted.
  • REJECT: packet is stopped, deleted and, differently from Drop, an ICMP packet containing a message of rejection is sent to the source from which the dropped packet came.
Forwarding inside zone Accept | Drop | Reject; default: Accept Default policy for traffic forwarded between the networks belonging to the zone.
    Possible variants:
  • ACCEPT: packet gets to continue to the next chain.
  • DROP: packet is stopped and deleted.
  • REJECT: packet is stopped, deleted and, differently from Drop, an ICMP packet containing a message of rejection is sent to the source from which the dropped packet came.
Masquerading off | on; default: off Turns Masquerading off or on. MASQUERADE is an iptables target that can be used instead of the SNAT (source NAT) target when the external IP of the network interface is not known at the moment of writing the rule (when the interface gets the external IP dynamically).
MSS clamping off | on; default: off Turns MSS clamping off or on. MSS clamping is a workaround used to change the maximum segment size (MSS) of all TCP connections passing through links with an MTU lower than the Ethernet default of 1500.
Covered networks network interface(s); default: depends on zone Network or networks that belong to the zone.

Zones: Advanced Settings


Field Value Description
Restrict to address family IPv4 and IPv6 | IPv4 only | IPv6 only; default: IPv4 and IPv6 IP address family to which to zone will apply.
Restrict Masquerading to given source subnets network/subnet; default: none Applies Masquerading only to the specified source network/subnet.
Restrict Masquerading to given destinations subnets network/subnet; default: none Applies Masquerading only to the specified destination network/subnet.
Force connection tracking off | on; default: off Always maintains connection state (NEW, ESTABLISHED, RELATED) information.
Enable logging off | on; default: off Log dropped and rejected packets.
Limit log messages integer/minute; default: none Limit how many messages can be logged in the span of 1 minute. For example, to log 50 packets per minute use: 50/minute.
Conntrack helpers Amanda backup and archiving proto (AMANDA) | FTP passive connection tracking (FTP) | RAS proto tracking (RAS) | Q.931 proto tracking (Q.931) | IRC DCC connection tracking (IRC) | PPTP VPN connection tracking (PPTP) | SIP VoIP connection tracking (SIP) | SNMP monitoring connection tracking (SNMP) | TFTP connection tracking (TFTP); default: none Explicitly choses allowed connection tracking helpers for zone traffic.

Forwarding between zones


The options below control the forwarding policies between this zone (lan) and other zones. Destination zones cover forwarded traffic originating from lan. Source zones match forwarded traffic from other zones targeted at lan. The forwarding rule is unidirectional e.g., a forward from lan to wan does not imply a permission to forwad from wan to lan as well.

Field Value Description
Allow forward to destination zones zone(s); default: none Allows forward traffic to specified destination zones. Destination zones cover forwarded traffic originating from this source zone.
Allow forward from source zones zone(s); default: none Allows forward traffic to specified source zones. Source zones match forwarded traffic originating from other zones that is targeted at this zone.

Port Forwards

Port forwarding is a way of redirecting an incoming connection to another IP address, port or the combination of both:


The Port forwards table displays configured port forwarding rules currently configured on the device.

Field Value Description
Name string; default: none The name of the rule. This is used for easier management purposes.
Match Only match traffic using the given rules.
Forward Forward traffic to the given location.
Status Displays the status of NAT rule.
Counter Only the first packet of connection is usually counted due to stateful packet inspection (SPI). This also affects connectionless protocols.
Enabled off | on; default none Enables port forward rule.
Actions clone | Edit | Delete; default - Performs the selected action.

Add new instance


The Add new instance section is used to quickly add additional port forwarding rules.

Field Value Description
Name string; default: none Name of the rule. This is used for easier management purposes.
External port Any | FTP data (20) | FTP cmd (21) | SSH (22) | Old SMTP (25) | DNS (53) | HTTP (80) | NTP (123) | BGP (179) | HTTPS (443) | ISAKMP (500) | Modern SMTP (587) | RDP (3389) | + Add new; default: none Only match traffic coming to the given port.
    Possible variants:
  • Any: Match everything
  • Port: 422
  • Port range: 1000-2000
  • All except value: !value
Internal IP address IP | + Add new; default: first IP from the list Forward traffic to the given network address.
    Possible variants:
  • Any: Match everything
  • IP address: 192.168.1.1
  • Subnet: 192.168.1.0/24
Internal port No rewrite | FTP data (20) | FTP cmd (21) | SSH (22) | Old SMTP (25) | DNS (53) | HTTP (80) | NTP (123) | BGP (179) | HTTPS (443) | ISAKMP (500) | Modern SMTP (587) | RDP (3389) | + Add new; default: No rewrite Forward traffic to the given port.
    Possible variants:
  • No rewrite: Keep External port
  • Port: 422
  • Port range: 1000-2000
  • All except value: !value

Port Forwards Configuration


While the New port forward section provides the possibility to add port forwarding rules fast, it does not contain all possible configuration options to customize a rule. In order to create a more complicated rule, add one using the New port forward section and click the edit button next to it:

You will be redirected to that rule's configuration general settings page:

Field Value Description
Enable off | on ; default: on Turns the rule on or off
Name string; default: none Name of the rule. This is used for easier management purposes.
Protocol TCP | UDP | ICMP | All | +Add new; default: TCP+UDP Only match traffic using the given internet communication protocol.
    Possible variants:
  • TCP: used by most applications (e.g., web browsing, file downloads, games).
  • UDP: used by real-time applications that can accept packet loss (e.g., voice calls, video streaming).
  • ICMP: used for diagnostic, control and error transfers in networks (e.g., ping).
  • All: Accept all protocols
  • Custom protocol: sctp
Source zone Unspecified | firewall zone name | framed; default: wan Only match traffic coming to the given firewall zone.
External port Any | FTP data (20) | FTP cmd (21) | SSH (22) | Old SMTP (25) | DNS (53) | HTTP (80) | NTP (123) | BGP (179) | HTTPS (443) | ISAKMP (500) | Modern SMTP (587) | RDP (3389) | + Add new; default: none Only match traffic coming to the given port.
    Possible variants:
  • Any: Match everything
  • Port: 422
  • Port range: 1000-2000
  • All except value: !value
Internal zone Unspecified | firewall zone name | framed; default: lan Forward traffic to the given firewall zone.
Internal IP address Any | IP | + Add new; default: first IP from the list Forward traffic to the given network address.
    Possible variants:
  • IP address: 192.168.1.1
  • Subnet: 192.168.1.0/24
Internal port No rewrite | FTP data (20) | FTP cmd (21) | SSH (22) | Old SMTP (25) | DNS (53) | HTTP (80) | NTP (123) | BGP (179) | HTTPS (443) | ISAKMP (500) | Modern SMTP (587) | RDP (3389) | + Add new; default: No rewrite Forward traffic to the given port.
    Possible variants:
  • No rewrite: Keep External port
  • Port: 422
  • Port range: 1000-2000
  • All except value: !value

Advanced settings:

Field Value Description
Source MAC address mac | + Add new; default: Any Only match traffic coming from the given MAC address.
    Possible variants:
  • Any: Match everything
  • Mac address: 01:23:45:56:78:9a
  • All except value: !value
Source IP address IP | + Add new; default: Any Only match traffic coming from the given network address.
    Possible variants:
  • Any: Match everything
  • IP address: 192.168.1.1
  • Subnet: 192.168.1.0/24
  • All except value: !value
Source port FTP data (20) | FTP cmd (21) | SSH (22) | Old SMTP (25) | DNS (53) | HTTP (80) | NTP (123) | BGP (179) | HTTPS (443) | ISAKMP (500) | Modern SMTP (587) | RDP (3389) | + Add new; default: Any Only match traffic coming from the given port.
    Possible variants:
  • Any: Match everything
  • Port: 422
  • Port range: 1000-2000
  • All except value: !value
External IP address Any | IP | + Add new; default: Any Only match traffic coming to the given network address.
    Possible variants:
  • Any: Match everything
  • IP address: 192.168.1.1
  • Subnet: 192.168.1.0/24
  • All except value: !value
Enable NAT loopback off | on ; default: on NAT loopback a.k.a. NAT reflection a.k.a. NAT hairpinning is a method of accessing an internal server using a public IP. NAT loopback enables your local network (i.e., behind your NAT device) to connect to a forward-facing IP address of a machine that it also on your local network.
Extra arguments string; default: none Passes additional arguments to iptables. Use with care!

Traffic Rules

The Traffic rules tab is used to set firewall rules that filter traffic moving through the device. The figure below is an example of the Traffic rules table:

Field Value Description
Name string; default: - The name of the rule. This is used for easier management purposes.
Match Only match traffic using the given rules.
Action Take given action when traffic matches all conditions.
Status Displays the status of NAT rule.
Counter Only the first packet of connection is usually counted due to stateful packet inspection (SPI). This also affects connectionless protocols.
Enabled off | on; default none Enables traffic rule.
Actions clone | Edit | Delete; default - Performs the selected action.

Traffic Rule Configuration


In order to begin editing a traffic rule, click the edit button next to it:

You will be redirected to that rule's configuration page:

General settings


Field Value Description
Enable off | on; default on Turns the rule on or off.
Name string; default none Name of the rule. This is used for easier management purposes.
Protocol TCP | UDP | ICMP | All | +Add new; default: depends on the rule Only match traffic using the given internet communication protocol.
    Possible variants:
  • TCP: used by most applications (e.g., web browsing, file downloads, games)
  • UDP: used by real-time applications that can accept packet loss (e.g., voice calls, video streaming)
  • ICMP: used for diagnostic, control and error transfers in networks (e.g., ping)
  • All: Accept all protocols
  • Custom protocol: sctp
Match ICMP type Any | ICMP-type (list) | + Add new; default: Any Only match traffic having the given ICMP type.
Source zone firewall zone; default: wan Only match traffic coming to the given firewall zone.
Source IP address ip address; default: Any Only match traffic coming from the given network address.
    Possible variants:
  • Any: Match everything
  • IP address: 192.168.1.1
  • Subnet: 192.168.1.0/24
  • IPv6 address: 123:1::5:6:7
  • IPv6 Subnet: 123:1:5:6::0/64
  • All except value: !value
Source port FTP data (20) | FTP cmd (21) | SSH (22) | Old SMTP (25) | DNS (53) | HTTP (80) | NTP (123) | BGP (179) | HTTPS (443) | ISAKMP (500) | Modern SMTP (587) | RDP (3389) | + Add new; default: Any Only match traffic coming from the given port.
    Possible variants:
  • Any: Match everything
  • Port: 422
  • Port range: 1000-2000
  • All except value: !value
Destination zone firewall zone; default: Device (input) Only match traffic being forwarded to to the given firewall zone.
Destination address ip address; default: Any Only match traffic being forwarded to the given network address.
    Possible variants:
  • Any: Match everything
  • IP address: 192.168.1.1
  • Subnet: 192.168.1.0/24
  • IPv6 address: 123:1::5:6:7
  • IPv6 Subnet: 123:1:5:6::0/64
  • All except value: !value
Destination port FTP data (20) | FTP cmd (21) | SSH (22) | Old SMTP (25) | DNS (53) | HTTP (80) | NTP (123) | BGP (179) | HTTPS (443) | ISAKMP (500) | Modern SMTP (587) | RDP (3389) | + Add new; default: Any Only match traffic being forwarded to the given port.
    Possible variants:
  • Any: Match everything
  • Port: 422
  • Port range: 1000-2000
  • All except value: !value
Action Drop | Accept | Reject | Do not track | Change DSCP | Mark | Change TTL; default: Accept Take given action when traffic matches all conditions.
    Possible variants:
  • Accept – packet gets to continue to the next chain.
  • Drop – packet is stopped and deleted.
  • Reject – packet is stopped, deleted and, differently from Drop, an ICMP packet containing a message of rejection is sent to the source from which the dropped packet came.
  • Change DSCP: – packet is marked with specified DiffServ Code Point value.
  • Do not track – packet gets excluded from connection tracking (conntrack).
  • Mark – packet is marked with specified firewall mark.
  • Change TTL – packet's TTL value is adjusted based on the selected action.
  • Clamp MSS – packet's MSS will be clamped to improve compatability with other networks. Only available if protocol is TCP.
DSCP value Default | CS1 | AF11 | AF12 | AF13 | CS2 | AF21 | AF22 | AF23...; default: Default DSCP value to use for actions.
Mark value hexadecimal string; default: empty Mark value to use for actions.
TTL action Set | Increment | Decrement; default: Set TTL action to apply to packets.
TTL value integer [1..255]; default: none TTL value to use for actions.

Advanced settings


Restrict to address family IPv4 and IPv6 | IPv4 only | IPv6 only; default: IPv4 and IPv6 Only match traffic using the given IP family.
Source MAC address mac | + Add new; default: Any Only match traffic coming from the given MAC address.
    Possible variants:
  • Any: Match everything
  • Mac address: 01:23:45:56:78:9a
  • All except value: !value
Match DSCP | Mark; default: none Match traffic against the given DSCP value or firewall mark
DSCP: Set Match value Default | DSCP values; default: Default Match traffic against the given firewall DSCP value.
Mark: Set Match value hexadecimal string; default: none If specified, match traffic against the given firewall mark, e.g. FF or ff to match mark 255.
Extra arguments string; default: none Adds extra .iptables options to the rule.

Time restrictions


Week days days of the week [Monday..Sunday]; default: none Specifies on which days of the week the rule is valid.
Month days days of the month [1..31]; default: none Specifies on which days of the month the rule is valid.
Start Time (hh:mm:ss) time [0..23:0..59:0..59]; default: none Indicates the beginning of the time period during which the rule is valid.
Stop Time (hh:mm:ss) time [0..23:0..59:0..59]; default: none Indicates the end of the time period during which the rule is valid.
Start Date (yyyy-mm-dd) date [0000..9999:1..12:1..31]; default: none Indicates the first day of the date of the period during which the rule is valid.
Stop Date (yyyy-mm-dd) date [0000..9999:1..12:1..31]; default: none Indicates the last day of the date of the period during which the rule is valid.
Time in UTC off | on; default: no Specifies whether the device should use UTC time. If this is disabled, the time zone specified in the System → Administration → [[{{{name}}}_Administration#NTP|NTP]] page will be used.

Open Ports on Router


In the Add new instance section, select Open ports on router. This provides a quick way to set simple rules that allow traffic on specified ports of the device. The figure below is an example of the Open ports on device section and the table below provides information on the fields contained in that section:

Field Value Description
Name string; default: none Name of the rule. This is only used for easier management purposes.
Protocol TCP | UDP | ICMP | All | +Add new; default: depends on the rule Only match traffic using the given internet communication protocol.
    Possible variants:
  • TCP: used by most applications (e.g., web browsing, file downloads, games)
  • UDP: used by real-time applications that can accept packet loss (e.g., voice calls, video streaming)
  • ICMP: used for diagnostic, control and error transfers in networks (e.g., ping)
  • All: Accept all protocols
  • Custom protocol: sctp

Add New Forward Rule


In the Add new instance section, select Add new forward rule. This is used to create firewall rules that control traffic on the FORWARD chain. The figure below is an example of the Add New Forward Rule section and the table below provides information on the fields contained in that section:

Field Value Description
Name string; default: none The name of the rule. This is used for easier management purposes.
Source zone firewall zone; default: lan Only match traffic coming to the given firewall zone.
Destination zone firewall zone; default: lan Only match traffic being forwarded to the given firewall zone.
Add - (interactive button) Creates the rule and redirects you to the rule's configuration page

NAT Rules

NAT rules allow fine grained control over the source IP to use for outbound or forwarded traffic.

The NAT section displays currently existing NAT rules.

Field Value Description
Name string; default: none The name of the rule. This is used for easier management purposes.
Match Only match traffic using the given rules.
Action Modify traffic with the given rules.
Status Displays the status of NAT rule.
Counter Only the first packet of connection is usually counted due to stateful packet inspection (SPI). This also affects connectionless protocols.
Enabled off | on; default none Enables NAT rule.
Actions clone | Edit | Delete; default - Performs the selected action.

Add new instance


The Add new instance section is used to create new NAT rules.

Field Value Description
Name string; default: none The name of the rule. This is used for easier management purposes.
Source zone firewall zone; default: lan Only match traffic coming to the given firewall zone.
Rewrite IP IP | + Add new; default: first IP from the list Rewrite matched traffic to the given source network address.
    Possible variants:
  • IP address: 192.168.1.1
  • Subnet: 192.168.1.0/24
Rewrite Port integer [0..65335] | port inversion [!0..!65535] | do not rewrite; default: none Rewrite matched traffic to the given source port.
    Possible variants:
  • No rewrite: Keep Source port
  • Port: 422
  • Port range: 1000-2000
Add - (interactive button) Creates the rule in accordance with the given parameter and redirects you to the rule's configuration page.

NAT Configuration


After adding new rule, you will be redirected to that rule's configuration page:

Field Value Description
Enable off | on; default on Turns the rule on or off.
Name string; default none Name of the rule. This is used for easier management purposes.
Protocol TCP | UDP | ICMP | All | +Add new; default: All Only match traffic using the given internet communication protocol.
    Possible variants:
  • TCP: used by most applications (e.g., web browsing, file downloads, games).
  • UDP: used by real-time applications that can accept packet loss (e.g., voice calls, video streaming).
  • ICMP: used for diagnostic, control and error transfers in networks (e.g., ping).
  • All: Accept all protocols
  • Custom protocol: sctp
Outband zone firewall zone; default: lan Only match traffic leaving the given firewall zone.
Source IP address ip address; default: Any Only match traffic coming from the given network address.
    Possible variants:
  • Any: Match everything
  • IP address: 192.168.1.1
  • Subnet: 192.168.1.0/24
  • IPv6 address: 123:1::5:6:7
  • IPv6 Subnet: 123:1:5:6::0/64
  • All except value: !value
Source port FTP data (20) | FTP cmd (21) | SSH (22) | Old SMTP (25) | DNS (53) | HTTP (80) | NTP (123) | BGP (179) | HTTPS (443) | ISAKMP (500) | Modern SMTP (587) | RDP (3389) | + Add new; default: Any Only match traffic coming from the given port.
    Possible variants:
  • Any: Match everything
  • Port: 422
  • Port range: 1000-2000
  • All except value: !value
Destination IP address ip address; default: Any Only match traffic being forwarded to the given network address.
    Possible variants:
  • Any: Match everything
  • IP address: 192.168.1.1
  • Subnet: 192.168.1.0/24
  • All except value: !value
Destination port FTP data (20) | FTP cmd (21) | SSH (22) | Old SMTP (25) | DNS (53) | HTTP (80) | NTP (123) | BGP (179) | HTTPS (443) | ISAKMP (500) | Modern SMTP (587) | RDP (3389) | + Add new; default: Any Only match traffic being forwarded to the given port.
    Possible variants:
  • Any: Match everything
  • Port: 422
  • Port range: 1000-2000
  • All except value: !value
Action SNAT | MASQUERADE | ACCEPT; default SNAT NAT action to use on matched traffic.
    Possible variants:
  • SNAT: rewrite to specific source IP or port.
  • MASQUERADE: automatically rewrite to outbound interface IP.
  • ACCEPT: blacklist from having IP or port rewritten.
Rewrite IP address ip address; default: Any Only match traffic being forwarded to the given network address.
    Possible variants:
  • Any: Match everything
  • IP address: 192.168.1.1
  • Subnet: 192.168.1.0/24
  • All except value: !value

Field Value Description
Extra arguments string; default: none Passes additional arguments to iptables. Use with care!

Field Value Description
Week days days of the week [Monday..Sunday]; default: none Specifies on which days of the week the rule is valid.
Month days days of the month [1..31]; default: none Specifies on which days of the month the rule is valid.
Start Time (hh:mm:ss) time [0..23:0..59:0..59]; default: none Indicates the beginning of the time period during which the rule is valid.
Stop Time (hh:mm:ss) time [0..23:0..59:0..59]; default: none Indicates the end of the time period during which the rule is valid.
Start Date (yyyy-mm-dd) date [0000..9999:1..12:1..31]; default: none Indicates the first day of the date of the period during which the rule is valid.
Stop Date (yyyy-mm-dd) date [0000..9999:1..12:1..31]; default: none Indicates the last day of the date of the period during which the rule is valid.
Time in UTC off | on; default: no Specifies whether the device should use UTC time. If this is disabled, the time zone specified in the System → Administration → [[{{{name}}}_Administration#NTP|NTP]] page will be used.

Attack Prevention

The Attack Prevention menu tab provides the possibility to configure protections against certain types of online attacks.

Field Value Description
Attack type Name of attack prevention type.
Enable off | on Enable attack from WAN zone prevention (except SYN flood which applies to all zones).
Advanced settings -interactive button (Edit) Opens attack prevention configuration window.

Note: the individual attack prevention configuration windows are shown below.

SYN flood


SYN Flood attack prevention allows you to protect yourself from attacks that exploit part of the normal TCP three-way handshake to consume resources on the targeted server and render it unresponsive. Essentially, with SYN flood DDOS, the offender sends TCP connection requests faster than the targeted machine can process them, causing network over-saturation.

Field Value Description
Enable attack prevention off | on; default: on Enable new connection throttle for the "SYN flood" to prevent flood attacks from all zones. It uses token bucket algorithm.
Limit integer [1..10000]; default: 25 The maximum theoretical rate. It represents how quickly the burst refills.
Burst integer [1..10000]; default: 50 Sets burst limit for SYN packets above which the traffic is considered flooded if it exceeds the allowed rate
TCP SYN cookies off | on; default: on Enables the use of SYN cookies (particular choices of initial TCP sequence numbers by TCP servers)

Ping flood


Some attackers use ICMP echo request packets directed to IP broadcast addresses from remote locations to generate denial-of-service attacks. You can set up some custom restrictions to help protect your router from ICMP bursts.

Field Value Description
Enable remote ping requests off | on; default: on Allows remote (WAN zone) ICMP echo-request type.
Enable attack prevention off | on; default: off Enable new connection throttle for the "Ping flood" to prevent flood attacks from WAN zone. It uses token bucket algorithm.
Limit integer [1..10000]; default: 60 The maximum theoretical rate. It represents how quickly the burst refills.
Limit period Second | Minute | Hour | Day; default: Second Period length for matching the conditions of the rule.
Burst integer [1..10000]; default: 60 The maximum number of new connections that can occur in a short time. This is the token bucket, which is depleted with each new connection. It refills at the rate defined by the limit, and if empty, new connections are blocked.
Enable logging off | on; default: off Flood detection events will be logged to [[{{{name}}}__Maintenance#Troubleshoot_Logs|System log]].

SSH flood


This protection prevent SSH attacks by limiting connections in a defined period.

Field Value Description
Enable attack prevention off | on; default: off Enable new connection throttle for the "SSH flood" to prevent flood attacks from WAN zone. It uses token bucket algorithm.
Limit integer [1..10000]; default: 100 The maximum theoretical rate. It represents how quickly the burst refills.
Limit period Second | Minute | Hour | Day; default: Second Period length for matching the conditions of the rule.
Burst integer [1..10000]; default: 100 The maximum number of new connections that can occur in a short time. This is the token bucket, which is depleted with each new connection. It refills at the rate defined by the limit, and if empty, new connections are blocked.
Enable logging off | on; default: off Flood detection events will be logged to [[{{{name}}}__Maintenance#Troubleshoot_Logs|System log]].

HTTP flood


An HTTP attack sends a complete, legitimate HTTP header, which includes a 'Content-Length' field to specify the size of the message body to follow. However, the attacker then proceeds to send the actual message body at an extremely slow rate (e.g. 1 byte/100 seconds.) Due to the entire message being correct and complete, the target server will attempt to obey the 'Content-Length' field in the header, and wait for the entire body of the message to be transmitted, hence slowing it down.

Field Value Description
Enable attack prevention off | on; default: off Enable new connection throttle for the "HTTP flood" to prevent flood attacks from WAN zone. It uses token bucket algorithm.
Limit integer [1..10000]; default: 120 The maximum theoretical rate. It represents how quickly the burst refills.
Limit period Second | Minute | Hour | Day; default: Second Period length for matching the conditions of the rule.
Burst integer [1..10000]; default: 120 The maximum number of new connections that can occur in a short time. This is the token bucket, which is depleted with each new connection. It refills at the rate defined by the limit, and if empty, new connections are blocked.
Enable logging off | on; default: off Flood detection events will be logged to [[{{{name}}}__Maintenance#Troubleshoot_Logs|System log]].

HTTPS flood


This section allows you to enable protection against HTTPS attacks, also known as "man-in-the-middle" attacks (MITM).

In cryptography and computer security, a man-in-the-middle attack (MITM) is an attack where the perpetrator secretly relays and possibly alters the communication between two parties who believe they are directly communicating with each other. One example of man-in-the-middle attacks is active eavesdropping, in which the attacker makes independent connections with the victims and relays messages between them to make them believe they are talking directly to each other over a private connection, when in fact the entire conversation is controlled by the attacker.

Field Value Description
Enable attack prevention off | on; default: off Enable new connection throttle for the "HTTPS flood" to prevent flood attacks from WAN zone. It uses token bucket algorithm.
Limit integer [1..10000]; default: 120 The maximum theoretical rate. It represents how quickly the burst refills.
Limit period Second | Minute | Hour | Day; default: Second Period length for matching the conditions of the rule.
Burst integer [1..10000]; default: 120 The maximum number of new connections that can occur in a short time. This is the token bucket, which is depleted with each new connection. It refills at the rate defined by the limit, and if empty, new connections are blocked.
Enable logging off | on; default: off Flood detection events will be logged to [[{{{name}}}__Maintenance#Troubleshoot_Logs|System log]].

Port Scan


Port Scan attacks scan which of the targeted host's ports are open. Network ports are the entry points to a machine that is connected to the Internet. A service that listens on a port is able to receive data from a client application, process it and send a response back. Malicious clients can sometimes exploit vulnerabilities in the server code so they gain access to sensitive data or execute malicious code on the machine remotely. Port scanning is usually done in the initial phase of a penetration test in order to discover all network entry points into the target system. The Port Scan section provides you with the possibility to enable protection against port scanning software. The Defending Type section provides the possibility for the user to enable protections from certain types of online attacks. These include SYN-FIN, SYN-RST, X-Mas, FIN scan and NULLflags attacks.

Field Value Description
Enable port scan prevention off | on; default: off Enable brute force port scan prevention from WAN zone. If there is too much TCP packets from same host without responses they start to be rejected.
Scan count integer [5..255]; default: 5 Port scan (TCP packet without response) count before packets are rejected.
Interval integer [10..1000]; default: 10 Time span (in seconds) in which 'scan count' has to be reached before packets are rejected.
SYN-FIN attack off | on; default: off Turns protection from SYN-FIN attacks on or off.
SYN-RST attack off | on; default: off Turns protection from SYN-RST attacks on or off.
X-Mas attack off | on; default: off Turns protection from X-Mas attacks on or off.
FIN scan off | on; default: off Protect from nmap FIN scan.
NULLflags attack off | on; default: off Turns protection from NULLflags attacks on or off.

Custom Rules

The Custom rules tab provides you with the possibility to execute iptables commands which are not otherwise covered by the device's firewall framework. The commands are executed after each firewall restart, right after the default rule set has been loaded.

Note: Custom rules are not recommended to be used with hostnames. The rules will not remain active after reboot due to security reasons.

The figure below is an example of the Custom rules tab:

The rules added here are saved in the /etc/firewall.user file. Feel free to edit that file instead for the same effect in case you don't have access to the device's WebUI.

The Save button restarts the firewall service. Thus, adding the custom rules specified in this section to the device's list of firewall rules.

The Reset button resets the custom rules field to its default state.

DMZ

The DMZ is a security concept. It comprises the separation of the LAN-side network into at least two networks: the user LAN and the DMZ. Generally the DMZ is imprisoned: only access to certain ports from the Internet are allowed into the DMZ, while the DMZ is not allowed to establish new connections to the WAN-side or LAN-side networks. That way, if a server inside of the DMZ is hacked the potential damage that can be done remains restricted! The whole point of the DMZ is to cleanly create a unique firewall rule set that dramatically restricts access in to, and out of the, DMZ.

Field Value Description
Enable off | on; default: off Enables the DMZ configuration.
Status state; default: Displays the status of the DMZ.
Counter count of packets; default: Only the first packet of connection is usually counted due to stateful packet inspection (SPI). This also affects connectionless protocols.
Host IP ipv4; default: none Specifies the IP address of the DMZ host.
Protocol All | TCP | UDP | ICMP; default: None Specifies for which protocols the DMZ will be used.
Ports 0..65535 | port range | port negation; default: none Match incoming traffic directed at the given destination port or port range on DMZ host IP.

[[Category:{{{name}}} Network section]]