Template:Networking rutos manual firewall: Difference between revisions

From Teltonika Networks Wiki
No edit summary
Line 68: Line 68:
[[File:Networking_rutos_manual_firewall_general_settings_zones_edit_button.png|border|class=tlt-border]]
[[File:Networking_rutos_manual_firewall_general_settings_zones_edit_button.png|border|class=tlt-border]]


====Zones: general settings====
====Zones: General Settings====
----
----
[[File:Networking_rutos_manual_firewall_general_settings_zones_general_settings.png|border|class=tlt-border]]
[[File:Networking_rutos_manual_firewall_general_settings_zones_general_settings.png|border|class=tlt-border]]
Line 115: Line 115:
</table>
</table>


====Zones: advanced settings====
====Zones: Advanced Settings====
----
----
[[File:Networking_rutos_manual_firewall_general_settings_zones_advanced_settings.png|border|class=tlt-border]]
[[File:Networking_rutos_manual_firewall_general_settings_zones_advanced_settings.png|border|class=tlt-border]]
Line 157: Line 157:
</table>
</table>


====Zones: inter-zone forwarding====
====Zones: Inter-zone Forwarding====
----
----
The <b>Inter-zone forwarding</b> options control the forwarding policies between the currently edited zone and other zones.  
The <b>Inter-zone forwarding</b> options control the forwarding policies between the currently edited zone and other zones.  
Line 181: Line 181:
</table>
</table>


==Port forwards==
==Port Forwards==


<b>Port forwarding</b> is a way of redirecting an incoming connection to another IP address, port or the combination of both:  
<b>Port forwarding</b> is a way of redirecting an incoming connection to another IP address, port or the combination of both:  
Line 191: Line 191:
[[File:Networking_rutos_manual_firewall_port_forwards_port_forwards.png|border|class=tlt-border]]
[[File:Networking_rutos_manual_firewall_port_forwards_port_forwards.png|border|class=tlt-border]]


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


[[File:Networking_rutos_manual_firewall_port_forwards_add_new_port_forward.png|border|class=tlt-border]]
[[File:Networking_rutos_manual_firewall_port_forwards_add_new_port_forward.png|border|class=tlt-border]]
Line 240: Line 240:
</table>
</table>


===Port forwards configuration===
===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 button that looks like a pencil [[File:Networking_rutx_trb14x_manual_edit_button_v1.png|20px]] next to it:
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 button that looks like a pencil [[File:Networking_rutx_trb14x_manual_edit_button_v1.png|20px]] next to it:
Line 328: Line 328:
</table>
</table>


==Traffic rules==
==Traffic Rules==


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:
Line 334: Line 334:
[[File:Networking_rutos_manual_firewall_traffic_rules.png|border|class=tlt-border]]
[[File:Networking_rutos_manual_firewall_traffic_rules.png|border|class=tlt-border]]


===Traffic rules configuration===
===Traffic Rule Configuration===
----
----
In order to begin editing a traffic rule, click the button that looks like a pencil [[File:Networking_rutx_trb14x_manual_edit_button_v1.png|20px]] next to it:
In order to begin editing a traffic rule, click the button that looks like a pencil [[File:Networking_rutx_trb14x_manual_edit_button_v1.png|20px]] next to it:
Line 488: Line 488:
</table>
</table>


===New forward rule===
===Add New Forward Rule===
----
----
The <b>New forward rule</b> section is used to create firewall rules that control traffic on the FORWARD chain. The figure below is an example of the New forward rule section and the table below provides information on the fields contained in that section:
The <b>Add New Forward Rule</b> section 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.png|border|class=tlt-border]]
[[File:Networking_rutos_manual_firewall_traffic_rules_add_new_forward_rule.png|border|class=tlt-border]]
Line 575: Line 575:
         <td>- (interactive button)</td>
         <td>- (interactive button)</td>
         <td>Creates the rule in accordance with the given parameter and redirects you to the rule's configuration page.</td>
         <td>Creates the rule in accordance with the given parameter and redirects you to the rule's configuration page.</td>
    </tr>
</table>
===Source NAT Configuration===
----
In order to begin editing a traffic rule, click the button that looks like a pencil [[File:Networking_rutx_trb14x_manual_edit_button_v1.png|20px]] next to it:
{{#ifeq: {{{series}}} | TRB1
| [[File:Networking_trb1_manual_firewall_nat_rules_source_nat_edit_button.png|border|class=tlt-border]]
| [[File:Networking_rutos_manual_firewall_nat_rules_source_nat_edit_button.png|border|class=tlt-border]]
}}
You will be redirected to that rule's configuration page:
[[File:Networking_rutos_manual_firewall_nat_rules_configuration_mobile_{{{mobile}}}_dualsim_{{{dualsim}}}_wired_{{{wired}}}.png|border|class=tlt-border]]
<table class="nd-mantable">
    <tr>
        <th>Field</th>
      <th>Value</th>
      <th>Description</th>
    </tr>
    <tr>
      <td>Enable</td>
      <td>off | on; default <b>on</b></td>
      <td>Turns the rule on or off.</td>
    </tr>
    <tr>
      <td>Name</td>
      <td>string; default <b>none</b></td>
      <td>Name of the rule. This is used for easier management purposes.</td>
    </tr>
    <tr>
    <td>Protocol</td>
        <td>All protocols | TCP+UDP | TCP | UDP | ICMP | -- custom --; default: <b>All protocols</b></td>
        <td>Specifies to which protocols the rule should apply.</td>
    </tr>
    <tr>
    <td>Source zone</td>
        <td>firewall zone; default: <b>lan</b></td>
        <td>Matches traffic originated from the specified zone.</td>
    </tr>
    <tr>
        <td>Source IP address</td>
        <td>ip | ip/netmask; default: <b>Any</b></td>
        <td>Mathes traffic originated from specified IP address or network segment.</td>
    </tr>
    <tr>
        <td>Source port</td>
        <td>integer [0..65535] | range of integers [0..65534] - [1..65535]; default: <b>none</b></td>
        <td>Mathes traffic originated from specified port number.<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>
    <td>Destination IP address</td>
        <td>ip | ip/netmask; default: <b>any</b></td>
        <td>Matches traffic destined for the specified IP address or network segment.</td>
    </tr>
    <tr>
    <td>Destination port</td>
        <td>integer [0..65535] | range of integers [0..65534] - [1..65535]; default: <b>none</b></td>
        <td>Matches traffic destined for the specified port number.</td>
    </tr>
    <tr>
        <td>SNAT address</td>
        <td>ip; default: <b>none</b></td>
        <td>Changes matched traffic packet source IP address to the value specified in this field.</td>
    </tr>
    <tr>
        <td>SNAT port</td>
        <td>integer [0..65535] | range of integers [0..65534] - [1..65535]; default: <b>none</b></td>
        <td>Changes matched traffic packet source port number to the value specified in this field.</td>
    </tr>
    <tr>
    <td>Extra arguments</td>
        <td>string; default: <b>none</b></td>
        <td>Adds extra .iptables options to the rule.</td>
    </tr>
    <tr>
    <td>Week days</td>
        <td>days of the week [Sunday..Saturday]; default: <b>none</b></td>
        <td>Specifies on which days of the week the rule is valid.</td>
    </tr>
    <tr>
    <td>Month days</td>
        <td>days of the month [1..31]; default: <b>none</b></td>
        <td>Specifies on which days of the month the rule is valid.</td>
    </tr>
    <tr>
    <td>Start Time (hh:mm:ss)</td>
        <td>time [0..23:0..59:0..59]; default: <b>none</b></td>
        <td>Indicates the beginning of the time period during which the rule is valid.</td>
    </tr>
    <tr>
    <td>Stop Time (hh:mm:ss)</td>
        <td>time [0..23:0..59:0..59]; default: <b>none</b></td>
        <td>Indicates the end of the time period during which the rule is valid.</td>
    </tr>
    <tr>
    <td>Start Date (yyyy-mm-dd)</td>
        <td>date [0000..9999:1..12:1..31]; default: <b>none</b></td>
        <td>Indicates the first day of the date of the period during which the rule is valid.</td>
    </tr>
    <tr>
    <td>Stop Date (yyyy-mm-dd)</td>
        <td>date [0000..9999:1..12:1..31]; default: <b>none</b></td>
        <td>Indicates the last day of the date of the period during which the rule is valid.</td>
    </tr>
    <tr>
    <td>Time in UTC</td>
        <td>yes | no; 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>
     </tr>
     </tr>
</table>
</table>
Line 584: Line 700:
The figure below is an example of the Custom rules tab:
The figure below is an example of the Custom rules tab:


[[File:Networking_rutx_manual_firewall_custom_rules_v1.png]]
[[File:Networking_rutos_manual_firewall_custom_rules.png|border|class=tlt-border]]


The rules added here are saved in the <b>/etc/firewall.user</b> 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 rules added here are saved in the <b>/etc/firewall.user</b> file. Feel free to edit that file instead for the same effect in case you don't have access to the device's WebUI.
Line 591: Line 707:


The <b>Reset</b> button resets the custom rules field to its default state.
The <b>Reset</b> button resets the custom rules field to its default state.
{{#ifeq: {{{series}}} | RUTX|
{{#ifeq: {{{series}}} | RUTX |
==NAT helpers==
==Helpers==


The <b>NAT Helpers</b> section provides you with the possibility to add firewall exceptions for some VoIP protocols, namely SIP and H.323. In other words, these functions provide a pass-through for VoIP communications between the device's LAN and WAN.
The <b>Helpers</b> section provides you with the possibility to add firewall exceptions for some VoIP protocols, namely SIP and H.323. In other words, these functions provide a pass-through for VoIP communications between the device's LAN and WAN.


<b>Technical explanation:</b>
<b>Technical explanation:</b>
Line 618: Line 734:
       <td>Turns SIP filtering on or off.</td>
       <td>Turns SIP filtering on or off.</td>
     </tr>
     </tr>
</table>
</table>|}}
}}
 
==Attack Prevention==
==Attack Prevention==


===SYN Flood Protection===
===SYN Flood Protection===
----
----
'''SYN Flood Protection''' 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 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.


[[File:Networking_rutos_manual_firewall_attack_prevention_syn.PNG|border|class=tlt-border]]
[[File:Networking_rutos_manual_firewall_attack_prevention_syn.PNG|border|class=tlt-border]]

Revision as of 10:17, 19 August 2020

Template:Networking rutos manual fw disclosure

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 is an overview of the Firewall section for {{{name}}} devices.

If you're having trouble finding this page or some of the parameters described here on your device's WebUI, you should turn on "Advanced WebUI" mode. You can do that by clicking the "Advanced" button, located at the top of the WebUI.

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
Enable SYN flood protection off | on; Default: on Enables protection from SYN flood type attacks. A SYN flood is a type of denial-of-service (DOS) attack where an attacker sends bursts of SYN requests in an attempt to make the target host machine consume enough resources and become unresponsive.
Drop invalid packets off | on; Default: off If enabled, a "Drop" action will be performed on packets that are determined to be invalid.
Input Reject | Drop | Accept; Default: Accept 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.

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 button that looks like a pencil next to a zone:

Zones: General Settings


Field Value Description
Name string; default: newzone A custom name for the zone. Used for easier management purposes.
Input Reject | Drop | Accept; Default: Accept Default policy for traffic entering the zone.
Output Reject | Drop | Accept; Default: Accept Default policy for traffic originating from and leaving the zone.
Forward Reject | Drop | Accept; Default: Reject Default policy for traffic forwarded between the networks belonging to the zone.
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: none 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 rule 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 on this zone off | on; default: off Logs packets that hit this rule.
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.

Zones: Inter-zone Forwarding


The Inter-zone forwarding options control the forwarding policies between the currently edited zone and other zones.

[[File:Networking_rutos_manual_firewall_general_settings_zones_inter-zone_forwarding_mobile_{{{mobile}}}_dualsim_{{{dualsim}}}_wired_{{{wired}}}.png|border|class=tlt-border]]

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.

Add New Port Forward


The Add New Port Forward 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:

Field Value Description
Name string; default: none Name of the rule. This is used for easier management purposes.
Protocol TCP+UDP | TCP | UDP | Other; default: TCP+UDP Specifies to which protocols the rule should apply.
External zone firewall zone name; default: wan The zone to which hosts will be connecting.
External port integer [0..65535] | range of integers [0..65534] - [1..65535]; default: none The port number to which hosts will be connecting.
Internal zone firewall zone name; default: lan The zone to which the incoming connection will be redirected.
Internal IP address ip; default: none The IP address to which the incoming connection will be redirected.
Internal port integer [0..65535] | range of integers [0..65534] - [1..65535]; default: none The port number to which the incoming connection will be redirected.

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 button that looks like a pencil next to it:

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

[[File:Networking_rutos_manual_firewall_port_forwards_configuration_mobile_{{{mobile}}}_dualsim_{{{dualsim}}}_wired_{{{wired}}}.png|border|class=tlt-border]]

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 | TCP | UDP | Other; default: TCP+UDP Specifies to which protocols the rule should apply.
Source zone firewall zone name; default: wan The zone to which the third party will be connecting. (Same thing as "External zone" in the New port forward section.)
Source MAC address mac; default: none MAC address(es) of connecting hosts.
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.
Source IP address ip | ip/netmask; default: any IP address or network segment used by connecting hosts.
The rule will apply only to hosts that connect from IP addresses specified in this field.
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, 10.0.0.0/8).
Source port integer [0..65535] | range of integers [0..65534] - [1..65535]; default: none Port number(s) used by the connecting host.
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.
External IP address ip | ip/netmask; default: any IP address or network segment to which hosts will be connecting.
The rule will apply only to hosts that connect to IP addresses specified in this field.
To specify a subnet instead of one IP, add a forward slash followed by the netmask length after the network indication (for example, 10.0.0.0/8).
External port integer [0..65535] | range of integers [0..65534] - [1..65535]; default: none Port number(s) to which hosts will be connecting.
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.
Internal zone firewall zone name; default: lan The zone to which the incoming connection will be redirected.
Internal IP address ip; default: none The IP address to which the incoming connection will be redirected.
Internal port integer [0..65535] | range of integers [0..65534] - [1..65535]; default: none The port number to which the incoming connection will be redirected.
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 Adds extra iptables options to the rule.

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:

Traffic Rule Configuration


In order to begin editing a traffic rule, click the button that looks like a pencil next to it:

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

[[File:Networking_rutos_manual_firewall_traffic_rules_configuration_mobile_{{{mobile}}}_dualsim_{{{dualsim}}}_wired_{{{wired}}}.png|border|class=tlt-border]]

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.
Restrict to address family IPv4 and IPv6 | IPv4 only | IPv6 only; default: IPv4 and IPv6 IP address family to which the rule will apply to.
Protocol TCP+UDP | TCP | UDP | ICMP | -- custom --; default: TCP+UDP Specifies to which protocols the rule should apply.
Source zone firewall zone name; default: wan The zone to which the third party will be connecting.
Source MAC address mac; default: none MAC address(es) of connecting hosts.
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.
Source address ip | ip/netmask; default: any IP address or network segment used by connecting hosts.
The rule will apply only to hosts that connect from IP addresses specified in this field.
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, 10.0.0.0/8).
Source port integer [0..65535] | range of integers [0..65534] - [1..65535]; default: none Port number(s) used by the connecting host.
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.
Destination zone firewall zone; default: Device (input) Target zone of the incoming connection.
Destination address ip | ip/netmask; default: any Tagert IP address or network segment of the incoming connection.
Destination port integer [0..65535] | range of integers [0..65534] - [1..65535]; default: none Tagert port or range of ports of the incoming connection.
Action Drop | Accept | Reject | Don't track; default: Accept Action that is to be taken when a packet matches the conditions of the rule.
  • Drop – packet is stopped and deleted.
  • Accept – packet gets to continue to the next chain.
  • 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.
  • Don't track – packet is no longer tracked as it moves forward.
Extra arguments string; default: none Adds extra .iptables options to the rule.
Week days days of the week [Sunday..Saturday]; 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 yes | no; default: no 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.

Open Ports on Router


The Open Ports on Router section 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 The name of the rule. This is used for easier management purposes.
The name field is filled automatically when port numbers are specified, unless the name was specified beforehand by the user.
Protocol TCP+UDP | TCP | UDP | Other; default: TCP+UDP Specifies to which protocols the rule should apply.
External port integer [0..65535] | range of integers [0..65534] - [1..65535]; default: none Specifies which port(s) should be opened.

Add New Forward Rule


The Add New Forward Rule section 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: wan The zone from which traffic has originated.
Destination zone firewall zone; default: lan The zone to which traffic will be forwarded to.
Add - (interactive button) Creates the rule and redirects you to the rule's configuration page

NAT Rules

Network address translation (NAT) is method of modifying the source/destination address and/or port information in a packet's IP header.

Source NAT


Source NAT (SNAT) 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.

Add New Source NAT


The Add New Source NAT section is used to create new source NAT rules.

Field Value Description
Name string; default: none The name of the rule. Used only for easier management purposes.
Source zone firewall zone; default: lan Matches traffic originated from the specified zone.
Destination Zone firewall zone; default: wan Matches traffic destined for the specified zone.
To source IP ip | do not rewrite; default: none Changes the source IP address in the packet header to the value specified in this field.
To Source Port integer [0..65335] | do not rewrite; default: none Changes the source port in the packet header to the value specified in this field.
Add - (interactive button) Creates the rule in accordance with the given parameter and redirects you to the rule's configuration page.

Source NAT Configuration


In order to begin editing a traffic rule, click the button that looks like a pencil next to it:

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

[[File:Networking_rutos_manual_firewall_nat_rules_configuration_mobile_{{{mobile}}}_dualsim_{{{dualsim}}}_wired_{{{wired}}}.png|border|class=tlt-border]]

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 All protocols | TCP+UDP | TCP | UDP | ICMP | -- custom --; default: All protocols Specifies to which protocols the rule should apply.
Source zone firewall zone; default: lan Matches traffic originated from the specified zone.
Source IP address ip | ip/netmask; default: Any Mathes traffic originated from specified IP address or network segment.
Source port integer [0..65535] | range of integers [0..65534] - [1..65535]; default: none Mathes traffic originated from specified port number.
Destination zone firewall zone; default: wan Matches traffic destined for the specified zone.
Destination IP address ip | ip/netmask; default: any Matches traffic destined for the specified IP address or network segment.
Destination port integer [0..65535] | range of integers [0..65534] - [1..65535]; default: none Matches traffic destined for the specified port number.
SNAT address ip; default: none Changes matched traffic packet source IP address to the value specified in this field.
SNAT port integer [0..65535] | range of integers [0..65534] - [1..65535]; default: none Changes matched traffic packet source port number to the value specified in this field.
Extra arguments string; default: none Adds extra .iptables options to the rule.
Week days days of the week [Sunday..Saturday]; 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 yes | no; default: no 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.

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.

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.

Attack Prevention

SYN Flood Protection


SYN Flood Protection 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.PNG

field name value description
Enable SYN flood protection yes | no; Default: yes Toggles the rule ON or OFF
SYN flood rate integer; Default: 5 Set rate limit (packets per second) for SYN packets above which the traffic is considered flooded
SYN flood burst integer; Default: 10 Set burst limit for SYN packets above which the traffic is considered flooded if it exceeds the allowed rate
TCP SYN cookies yes | no; Default: no Enable the use of SYN cookies (particular choices of initial TCP sequence numbers by TCP servers)

Remote ICMP Requests


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.

File:Networking rutos manual firewall attack prevention icmp.PNG


field name value description
Enable ICMP requests yes | no; Default: yes Toggles the rule ON or OFF
Enable ICMP limit yes | no; Default: no Toggles ICMP echo-request limit in selected period ON or OFF
Limit period Second | Minute | Hour | Day; Default: Second Select ICMP echo-request period limit
Limit integer; Default: 5 Maximum ICMP echo-request number during the period
Limit burst integer; Default: 10 Indicate the maximum burst before the above limit kicks in

SSH Attack Prevention


Prevent SSH (allows a user to run commands on a machine's command prompt without them being physically present near the machine) attacks by limiting connections in a defined period.

File:Networking rutos manual firewall attack prevention ssh.PNG


field name value description
Enable SSH limit yes | no; Default: no Toggles the rule ON or OFF
Limit period Second | Minute | Hour | Day; Default: Second The period in which SSH connections are to be limited
Limit integer; Default: 5 Maximum SSH connections during the set period
Limit burst integer; Default: 10 Indicate the maximum burst before the above limit kicks in

HTTP Attack Prevention


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.

File:Networking rutos manual firewall attack prevention http.PNG


field name value description
Enable HTTP limit yes | no; Default: no Toggles the rule ON or OFF
Limit period Second | Minute | Hour | Day; Default: Second The period in which HTTP connections are to be limited
Limit integer; Default: 5 Maximum HTTP connections during the set period
Limit burst integer; Default: 10 Indicate the maximum burst before the above limit kicks in

HTTPS Attack Prevention


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.

File:Networking rutos manual firewall attack prevention hhtps.PNG

field name value description
Enable HTTPS limit yes | no; Default: no Toggles the rule ON or OFF
Limit period Second | Minute | Hour | Day; Default: Second The period in which HTTPS connections are to be limited
Limit integer; Default: 5 Maximum HTTPS connections during the set period
Limit burst integer; Default: 10 Indicate the maximum burst before the above limit kicks in

Port Scan Prevention

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.


File:Networking rutos manual firewall attack prevention port scan def.PNG

field name value description
Enable yes | no; Default: no Toggles the function ON or OFF
Scan count integer [5..65534]; Default: 5 How many port scans before blocked
Interval integer [10..60]; Default: 10 Time interval in seconds in which port scans are counted
SYN-FIN attack yes | no; Default: no Toggles protection from SYN-FIN attacks ON or OFF
SYN-RST attack yes | no; Default: no Toggles protection from SYN-RST attacks ON or OFF
X-Mas attack yes | no; Default: no Toggles protection from X-Mas attacks ON or OFF
FIN scan yes | no; Default: no Toggles protection from FIN scan attacks ON or OFF
NULLflags attack yes | no; Default: no Toggles protection from NULLflags attacks ON or OFF

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