[ Contents] [ Prev] [ Next] [ Index] [ Report an Error]

Example: SYN Flood Protection

In this example, you protect four Web servers in the DMZ zone from SYN flood attacks originating in the external zone by enabling the SYN flood protection SCREEN option for the external zone.

Before You Begin

For background information, read Understanding SYN Flood Attacks.

Note: We recommend that you augment the SYN flood protection that JUNOS software with enhanced services provides with device-level SYN flood protection on each of the Web servers. In this example, the Web servers are running UNIX, which also provides some SYN flood defenses, such as adjusting the length of the connection request queue and changing the timeout period for incomplete connection requests.

Figure 48: Device-Level SYN Flood Protection

Image ex_SYN_flood.gif

To configure the SYN flood protection parameters with appropriate values for your network, you must first establish a baseline of typical traffic flows. For one week, you run a sniffer on ethernet3—the interface bound to zone_external—to monitor the number of new TCP connection requests arriving every second for the four Web servers in the DMZ zone. Your analysis of the data accumulated from one week of monitoring produces the following statistics:

Based on this information, you set the following SYN flood protection parameters for zone_external, as shown in Table 43.

Table 43: SYN Flood Protection Parameters

Parameter

Value

Reason for Each Value

Attack Threshold

625 packets per second (pps)

This is 25% higher than the average peak number of new connection requests per second per server, which is unusual for this network environment. When the number of SYN packets per second for any one of the four Web servers exceeds this number, the device begins proxying new connection requests to that server. (In other words, beginning with the 626th SYN packet to the same destination address and port number in one second, the device begins proxying connection requests to that address and port number.)

Alarm Threshold

250 pps

When the device proxies 251 new connection requests in one second, it makes an alarm entry in the event log. By setting the alarm threshold somewhat higher than the attack threshold, you can avoid alarm entries for traffic spikes that only slightly exceed the attack threshold.

Source Threshold

25 pps

When you set a source threshold, the device tracks the source IP address of SYN packets, regardless of the destination address and port number. (Note that this source-based tracking is separate from the tracking of SYN packets based on destination address and destination port number that constitutes the basic SYN flood protection mechanism.)

In the one week of monitoring activity, you observed that no more than 1/25 of new connection requests for all servers came from any one source within a one-second interval. Therefore, connection requests exceeding this threshold are unusual and provide sufficient cause for the device to execute its proxying mechanism. (25 pps is 1/25 of the attack threshold, which is 625 pps.)

If the device tracks 25 SYN packets from the same source IP address, beginning with the 26th packet, it rejects all further SYN packets from that source for the remainder of that second and the next second as well.

Destination Threshold

0 pps

When you set a destination threshold, the device runs a separate tracking of only the destination IP address, regardless of the destination port number. Because the four Web servers only receive HTTP traffic (destination port 80)—no traffic to any other destination port number reaches them—setting a separate destination threshold offers no additional advantage.

Timeout

20 seconds

The default value of 20 seconds is a reasonable length of time to hold incomplete connection requests.

Parameter

Value

Reason for Each Value

Attack Threshold

625 packets per second (pps)

This is 25% higher than the average peak number of new connection requests per second per server, which is unusual for this network environment. When the number of SYN packets per second for any one of the four Web servers exceeds this number, the device begins proxying new connection requests to that server. (In other words, beginning with the 626th SYN packet to the same destination address and port number in one second, the device begins proxying connection requests to that address and port number.)

* Half-completed connection requests are incomplete three-way handshakes. A three-way handshake is the initial phase of a TCP connection. It consists of a TCP segment with the SYN flag set, a response with the SYN and ACK flags set, and a response to that with the ACK flag set.

To configure SYN flood protection parameters:

  1. Set interfaces.
    user@host# set interfaces ge-0/0/0 unit 0 family inet address 1.2.2.1/24
    user@host# set interfaces fe-1/0/0 unit 0 family inet address 1.1.1.1/24
    user@host# set security zones security-zone zone_dmz interfaces ge-0/0/0.0
    user@host# set security zones security-zone zone_external interfaces fe-1/0/0.0
  2. Define addresses.
    user@host# set security zones security-zone zone_dmz address-book address ws1 1.2.2.10/32
    user@host# set security zones security-zone zone_dmz address-book address ws2 1.2.2.20/32
    user@host# set security zones security-zone zone_dmz address-book address ws3 1.2.2.30/32
    user@host# set security zones security-zone zone_dmz address-book address ws4 1.2.2.40/32
    user@host# set security zones security-zone zone_dmz address-book address-set web_servers address ws1
    user@host# set security zones security-zone zone_dmz address-book address-set web_servers address ws2
    user@host# set security zones security-zone zone_dmz address-book address-set web_servers address ws3
    user@host# set security zones security-zone zone_dmz address-book address-set web_servers address ws4
  3. Configure policy.
    user@host# set security policies from-zone zone_external to-zone zone_dmz policy id_1 match source-address any
    user@host# set security policies from-zone zone_external to-zone zone_dmz policy id_1 match destination-address web_servers
    user@host# set security policies from-zone zone_external to-zone zone_dmz policy id_1 match application junos-http
    user@host# set security policies from-zone zone_external to-zone zone_dmz policy id_1 then permit
  4. Configure SCREEN options.
    user@host# set security screen zone_external-syn-flood tcp syn-flood alarm-threshold 250
    user@host# set security screen zone_external-syn-flood tcp syn-flood attack-threshold 625
    user@host# set security screen zone_external-syn-flood tcp syn-flood source-threshold 25
    user@host# set security screen zone_external-syn-flood tcp syn-flood timeout 20></statement>
    user@host# set security zones security-zone zone_external screen zone_external-syn-flood

[ Contents] [ Prev] [ Next] [ Index] [ Report an Error]