You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/content/docs/magic-wan/configuration/manually/third-party/juniper.mdx
+38-23Lines changed: 38 additions & 23 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,13 +9,15 @@ The configuration settings in this document are based on JUNOS 23.4R2.13.
9
9
10
10
## Prerequisites
11
11
12
-
Confirm that you have the two Cloudflare anycast IPs allocated to your account. You will establish IPsec tunnels to the two anycast IPs irrespective of the location of your Juniper SRX devices (hereon in "endpoint") - traffic will be routed via BGP Anycast to the closest Cloudflare Point-of-Presence.
12
+
Confirm that you have the two Cloudflare anycast IPs allocated to your account. You will establish IPsec tunnels to the two anycast IPs irrespective of the location of your Juniper SRX devices (hereon in "endpoint") - traffic will be naturally attracted to the closest Cloudflare colocation facility via BGP Anycast.
13
13
14
-
Cloudflare recommends customers configure two IPsec tunnels per Internet Service Provider per endpoint. This provides tunnel redundancy and tunnel diversity. Equal Cost Multipath Routing (ECMP) ensures traffic is load-balanced across the tunnels, and you can control traffic steering across the tunnels through route prioritization.
14
+
Cloudflare recommends customers configure two IPsec tunnels (one to each of the two Anycast IPs allocated to you Cloudflare account) per Internet Service Provider per endpoint. This provides tunnel redundancy diversity.
15
15
16
-
Cloudflare supports Route-Based site-to-site IPsec tunnels, which require the creation of Virtual Tunnel Interfaces (VTIs). We recommend you select one subnet with either a /30 or /31 netmask (the latter makes more efficient use of IP addresses).
16
+
Equal Cost Multipath Routing (ECMP) ensures traffic is load-balanced across the tunnels, and you can control traffic steering across the tunnels through route prioritization.
17
17
18
-
The interface naming convention for VTI interfaces in Junos is st0.x.
18
+
Cloudflare supports Route-Based site-to-site IPsec tunnels, which require the creation of Virtual Tunnel Interfaces (VTIs). We recommend you select one subnet per Magic IPsec Tunnel with either a /30 or /31 netmask.
19
+
20
+
Using a /31 netmask makes more efficient use of IP addresses as it doubles the number of available subnets as it is unnecessary to reserve IPs for the subnet and broadcast addreses as there would be if you opt to use a /30 netmask. Additional details can be found in [RFC3021 - Using 31-Bit Prefixes on IPv4 Point-to-Point Links](https://datatracker.ietf.org/doc/html/rfc3021).
19
21
20
22
## Cloudflare Magic WAN configuration
21
23
@@ -24,6 +26,15 @@ This section of the document will cover the configuration of:
24
26
- Magic IPsec Tunnels
25
27
- Magic Static Routes
26
28
29
+
### Magic WAN Topology
30
+
31
+
This documentation assumes there are two locations connected via Magic WAN:
1. Start by [creating the IPsec tunnels](/magic-wan/configuration/manually/how-to/configure-tunnels/#add-tunnels) in the Cloudflare dashboard with the following values:
@@ -48,17 +59,18 @@ This section of the document will cover the configuration of:
48
59
8. Expand the first tunnel's properties and note the **Tunnel ID** and **FQDN ID** values.
49
60
9. Repeat the previous steps for the second tunnel.
50
61
:::note
51
-
These values are unique per tunnel and remain the same even if you update the pre-shared key. These values change only if you delete and recreate the tunnel.
62
+
The **Tunnel ID** and **FQDN ID**values are unique per tunnel and remain unchanged unless you delete and recreate the tunnel. Generating a new Pre-Shared Key will not change the values.
52
63
:::
53
64
54
-
### Magic static routes
65
+
### Magic Static Routes
55
66
56
-
This document assumes that the **trust zone** behind the Juniper SRX firewall has a single subnet:
57
-
-`10.1.20.0/24`
67
+
Refer to the Magic WAN Topology section above for more details on the IP subnet scheme.
58
68
59
-
[Magic Static Routes](/magic-wan/configuration/manually/how-to/configure-static-routes/)define which tunnel(s) to route traffic through for a subnet. Since two tunnels are configured to each endpoint, it is necessary to configure two static routes.
69
+
[Magic Static Routes](/magic-wan/configuration/manually/how-to/configure-static-routes/)effectively tell Magic WAN which tunnels to route traffic destined for a given Magic WAN site.
60
70
61
-
Cloudflare leverages [Equal-Cost Multi-Path](/magic-wan/reference/traffic-steering/#equal-cost-multi-path-routing) routing to control traffic steering across the tunnels. The default priority for each route is 100 — traffic will be load-balanced across the two tunnels equally via ECMP. You can modify the priorities as needed.
71
+
Since two tunnels are configured to each endpoint, it is necessary to configure two static routes.
72
+
73
+
Cloudflare leverages [Equal-Cost Multi-Path](/magic-wan/reference/traffic-steering/) routing to control traffic steering across the tunnels. The default priority for each route is 100 — traffic will be load-balanced across the two tunnels equally via ECMP. You can modify the priorities as needed, however best practices dictate leaving the default values in place.
62
74
63
75
1. Create a static route with the following values. Make sure you select the first tunnel in **Tunnel/Next hop**:
64
76
-**Description:** The description for the static route assigned to your first tunnel.
3. Select **Test Routes** to ensure the settings are accepted, then select **Add Routes**.
71
83
4. Confirm the routes were added correctly in **Magic WAN** > **Configuration** > **Static Routes**.
72
84
73
-
## Juniper SRX configuration
85
+
## Juniper SRX Configuration
74
86
75
87
There may be some differences in the syntax of the commands in the version on your SRX devices; however, the principles are the same. Please refer to the Juniper product documentation for more information.
76
88
89
+
The interface naming convention for VTI interfaces (aka Secure Tunnel Interfaces) in Junos is st0.x.
90
+
91
+
[Secure Tunnel Interface in a Virtual Router - Juniper IPsec VPN User Guide](https://www.juniper.net/documentation/us/en/software/junos/vpn-ipsec/topics/topic-map/security-secure-tunnel-interface-in-a-virtual-router.html)
92
+
77
93
The following elements will be configured on the Juniper SRX firewall(s):
78
94
79
-
- Add tunnel interfaces (`st0.x`)
80
-
- Assign tunnel interfaces to a security zone
95
+
- Ensure the LAN interface is in the `trust` zone ()
96
+
- Add Virtual Tunnel Interfaces (`st0.0` and `st0.1`)
97
+
- Assign tunnel interfaces to the `cloudflare` security zone
81
98
- Allow required protocols to both the tunnel and untrust security zones
82
99
- IKE configuration
83
100
- IPsec configuration
@@ -93,8 +110,6 @@ set interfaces st0 unit 0 family inet address 10.252.2.21/31
93
110
set interfaces st0 unit 1 family inet address 10.252.2.23/31
94
111
```
95
112
96
-
2. Confirm settings:
97
-
98
113
```txt
99
114
admin@srx300> show configuration interfaces st0
100
115
```
@@ -113,7 +128,7 @@ unit 1 {
113
128
114
129
### Security Zone (Cloudflare) - tunnel interfaces
115
130
116
-
Define a security zone and add both tunnel interfaces to it. At a minimum, the interfaces should allow ping, but this zone only contains point-to-point connections between the firewall and the customer network namespace. You can always set the values for systemservices and protocols to all, as the intrazone traffic is from a trusted network.
131
+
Define a security zone and add both tunnel interfaces to it. At a minimum, the interfaces should allow `ping`, but this zone only contains point-to-point connections between the firewall and the customer network namespace. Setting it to `all`for system-services and protocols should be fine.
117
132
118
133
```txt
119
134
set security zones security-zone cloudflare interfaces st0.0 host-inbound-traffic system-services all
@@ -123,7 +138,7 @@ set security zones security-zone cloudflare interfaces st0.1 host-inbound-traffi
123
138
```
124
139
125
140
```txt
126
-
admin@srx300> show configuration security zones security-zone cloudflare
141
+
admin@srx220> show configuration security zones security-zone cloudflare
127
142
```
128
143
```txt output
129
144
interfaces {
@@ -152,7 +167,7 @@ interfaces {
152
167
153
168
### Security zone (untrust) - `host-inbound-traffic`
154
169
155
-
Add ike to the security zone containing the external interface used to establish the IPsec tunnels to Cloudflare.
170
+
Add ping and ike to the security zone containing the external interface used to establish the IPsec tunnels to Cloudflare.
156
171
157
172
```txt
158
173
set security zones security-zone untrust interfaces ge-0/0/0.0 host-inbound-traffic system-services ike
@@ -203,7 +218,7 @@ lifetime-seconds 28800;
203
218
204
219
Define two IKE policies — one for each of the two Magic IPsec tunnels:
205
220
206
-
**Tunnel 1 (SRX300_IPSEC_01)**
221
+
***Tunnel 1 (SRX300_IPSEC_01)**
207
222
208
223
```txt
209
224
set security ike policy cf_magic_wan_tun_01_pol mode main
@@ -289,6 +304,8 @@ version v2-only;
289
304
290
305
Add an IPsec proposal that specifies the [Phase 2 Configuration Parameters](/magic-wan/reference/tunnels/#supported-configuration-parameters):
291
306
307
+
Add an IPsec proposal that specifies the [Phase 2 Configuration Parameters](/magic-wan/reference/tunnels/#supported-configuration-parameters):
308
+
292
309
```txt
293
310
set security ipsec proposal cf_magic_wan_ipsec_prop protocol esp
294
311
set security ipsec proposal cf_magic_wan_ipsec_prop authentication-algorithm hmac-sha-256-128
@@ -328,7 +345,7 @@ Define two IPsec policies — one for each of the two Magic IPsec tunnels. It is
328
345
-[Anti-replay](/magic-wan/reference/anti-replay-protection/) protection is disabled.
329
346
- Use the [`no-anti-replay`](https://www.juniper.net/documentation/us/en/software/junos/interfaces-adaptive-services/topics/ref/statement/no-anti-replay-edit-services.html) option.
330
347
- The SRX is the tunnel initiator:
331
-
- Cloudflare will not initiate the tunnel
348
+
- Cloudflare will not instantiate the tunnel
332
349
- If the SRX does not initiate the tunnel, then the tunnel will not be established until there is an attempt to connect to resources through the tunnel
333
350
- Use [`establish-tunnels immediately`](https://www.juniper.net/documentation/us/en/software/junos/interfaces-adaptive-services/topics/ref/statement/establish-tunnels-edit-services-ipsec-vpn.html) to ensure the SRX is the tunnel initiator.
@@ -412,7 +428,6 @@ While it is possible to be more prescriptive in terms of the destination subnets
412
428
413
429
Leaving the destination subnet as 0.0.0.0/0 eases some administrative burden as you only need to modify the Firewall Filter to specify which traffic is destined for Magic WAN.
414
430
415
-
416
431
```txt
417
432
set routing-instances MAGIC_WAN_RI instance-type forwarding
418
433
set routing-instances MAGIC_WAN_RI routing-options static route 0.0.0.0/0 next-hop 10.252.2.20
0 commit comments