howto/vyos1.4.x.md
... ...
@@ -7,18 +7,18 @@ It can be downloaded here <https://www.vyos.io/rolling-release/>.
7 7
We will configure firewall access lists for inbound connections on our peer Wireguard interfaces as well as block all inbound connections to our router with the exception of BGP. This should be a good baseline firewall ruleset to filter inbound traffic on your network's edge. Modifications may be needed depending on your specific goals. If your router has an uplink back to a larger internal network (outside of DN42), an outbound firewall ruleset will need to be applied to that interface.
8 8
9 9
By default, VyOS is a **stateless** firewall. To enable **stateful** packet inspection globally enter the following commands.
10
-```shell
10
+```sh
11 11
set firewall state-policy established action 'accept'
12 12
set firewall state-policy related action 'accept'
13 13
```
14 14
15 15
We also need to accept invalids on our network's edge. However, this should not become common practice elsewhere.
16
-```shell
16
+```sh
17 17
set firewall state-policy invalid action 'accept'
18 18
```
19 19
20 20
The below commands create **in** and **local** baseline templates to be applied to all Wireguard interfaces that are facing peers. In this example, **172.20.20.0/24** and **fd88:9deb:a69e::/48** are your assigned address spaces.
21
-```shell
21
+```sh
22 22
#Create Groups v4
23 23
set firewall group network-group Allowed-Transit-v4 network '10.0.0.0/8'
24 24
set firewall group network-group Allowed-Transit-v4 network '172.20.0.0/14'
... ...
@@ -127,14 +127,14 @@ vyos@vyos-home# show interfaces wireguard wg4242424242
127 127
To retrieve keys later, use the op-mode command `show interfaces wireguard wg4242424242 public-key`.
128 128
129 129
Example:
130
-```shell
130
+```sh
131 131
vyos@vyos$ show interfaces wireguard wg4242424242 public-key
132 132
UcqcZsJvq1MlYgo3gObjaJ8FH+N7wkfV+EH3YDAMyRE=
133 133
```
134 134
135 135
### Configure First Peer's tunnel
136 136
This example assumes that your ASN is 4242421234 and your peer's ASN is 4242424242
137
-```shell
137
+```sh
138 138
set interfaces wireguard wg4242424242 description 'AS4242424242 - My First Peer'
139 139
140 140
# Common practice on DN42 is for peers to use 2+the last four digits of your peer's ASN as the port.
... ...
@@ -173,7 +173,7 @@ set firewall interface wg4242424242 local name 'Tunnels_Local_v4'
173 173
## BGP
174 174
Now that we have a tunnel to our peer and theoretically can ping them, we can setup BGP.
175 175
### Initial Router Setup
176
-```shell
176
+```sh
177 177
# Set your ASN and IP blocks
178 178
set protocols bgp system-as '4242421234'
179 179
... ...
@@ -191,7 +191,7 @@ set protocols bgp parameters router-id '172.20.20.1'
191 191
### Neighbor Up With Peers
192 192
#### Option 1: MP-BGP (with Multi Protocol) - with Extended Next-Hop
193 193
MP-BGP peerings over IPv6 are recommended on DN42.
194
-```shell
194
+```sh
195 195
# For these examples, your peer's link-local address is fe80::4242
196 196
197 197
set protocols bgp neighbor fe80::4242 update-source 'wg4242424242'
... ...
@@ -204,7 +204,7 @@ set protocols bgp neighbor fe80::4242 address-family ipv6-unicast
204 204
205 205
```
206 206
#### Option 2: BGP (no Multi Protocol) - no Extended Next-Hop
207
-```shell
207
+```sh
208 208
# First, we set the ipv6 part.
209 209
set protocols bgp neighbor fe80::4242 remote-as '4242424242'
210 210
set protocols bgp neighbor fe80::4242 address-family ipv6-unicast
... ...
@@ -225,7 +225,7 @@ set protocols bgp neighbor 172.20.x.y ebgp-multihop 20
225 225
226 226
You can now check your BGP summary:
227 227
228
-```shell
228
+```sh
229 229
show ip bgp summary
230 230
231 231
IPv4 Unicast Summary (VRF default):
... ...
@@ -251,7 +251,7 @@ fe80::4242 4 4242424242 1031 6 0 0 0 00:04
251 251
252 252
Setting up peer-groups might help standardize multiple peerings:
253 253
254
-```shell
254
+```sh
255 255
# One peer group for all IPv6 MP-BGP link-local extended-nexthop peers
256 256
set protocols bgp peer-group dn42 address-family ipv4-unicast
257 257
set protocols bgp peer-group dn42 address-family ipv6-unicast
... ...
@@ -274,20 +274,20 @@ You can achieve this by running docker on a seperate server in the network but a
274 274
### Setup RPKI Caching Server on the Vyos machine
275 275
276 276
Run this command in operation mode to pull the container image to the vyos machine.
277
-```shell
277
+```sh
278 278
add container image cloudflare/gortr
279 279
```
280 280
281 281
Run the following commands in configuration mode:
282 282
283 283
To create the network for the prki container so it is only reachable on the vyos machine.
284
-```shell
284
+```sh
285 285
set container network rpki
286 286
set container network rpki prefix 172.16.2.0/24
287 287
```
288 288
289 289
To create the container itself
290
-```shell
290
+```sh
291 291
set container name gortr image cloudflare/gortr
292 292
set container name gortr command "-cache https://dn42.burble.com/roa/dn42_roa_46.json -verify=false -checktime=false -bind :8082"
293 293
set container name gortr network rpki address 172.16.2.10
... ...
@@ -298,20 +298,20 @@ set container name gortr restart on-failure
298 298
But its also possible to setup the container on a seperate machine.
299 299
Run the following docker command to setup the clouflare gortr container on a seperate server with docker installed.
300 300
301
-```shell
301
+```sh
302 302
docker run -ti -p 8082:8082 cloudflare/gortr -cache https://dn42.burble.com/roa/dn42_roa_46.json -verify=false -checktime=false -bind :8082
303 303
```
304 304
This will start a docker container that listens on the host server's IP at port 8082.
305 305
306 306
### Point VyOS Router at RPKI Caching Server
307 307
308
-```shell
308
+```sh
309 309
set protocols rpki cache <ip address of your GoRTR instance> port '8082'
310 310
set protocols rpki cache <ip address of your GoRTR instance> preference '1'
311 311
```
312 312
313 313
You can check the connection with `show rpki cache-connection` the output will look like this:
314
-```shell
314
+```sh
315 315
show rpki cache-connection
316 316
Connected to group 1
317 317
rpki tcp cache <ip address of your GoRTR instance> 8082 pref 1 (connected)
... ...
@@ -320,7 +320,7 @@ rpki tcp cache <ip address of your GoRTR instance> 8082 pref 1 (connected)
320 320
You can also see the received prefix-table with `show rpki prefix-table`.
321 321
322 322
### Create Route Map
323
-```shell
323
+```sh
324 324
set policy route-map DN42-ROA rule 10 action 'permit'
325 325
set policy route-map DN42-ROA rule 10 match rpki 'valid'
326 326
set policy route-map DN42-ROA rule 20 action 'permit'
... ...
@@ -334,7 +334,7 @@ You can also consider to "deny" the "notfound" prefixes, for better control.
334 334
You can also consider to combine within the same route-map the RPKI and one or more a prefix lists containing your internal network prefixes, as described later (The example "No RPKI/ROA and Internal Network Falls Into DN42 Range").
335 335
336 336
### Assign Route Map to Neighbor
337
-```shell
337
+```sh
338 338
set protocols bgp neighbor fe80::1234 address-family ipv4-unicast route-map export 'DN42-ROA'
339 339
set protocols bgp neighbor fe80::1234 address-family ipv4-unicast route-map import 'DN42-ROA'
340 340
set protocols bgp neighbor fe80::1234 address-family ipv6-unicast route-map export 'DN42-ROA'
... ...
@@ -344,7 +344,7 @@ _Remember to do that for all your new peerings!_
344 344
345 345
## Example Route Map
346 346
### No RPKI/ROA and Internal Network Falls Into DN42 Range
347
-```shell
347
+```sh
348 348
##Build prefix list to match personal internal network
349 349
set policy prefix-list BlockIPConflicts description 'Prevent Conflicting Routes'
350 350
set policy prefix-list BlockIPConflicts rule 10 action 'permit'
... ...
@@ -403,7 +403,7 @@ set protocols bgp peer-group dn42 address-family ipv6-unicast route-map import '
403 403
404 404
405 405
# Add your VyOS router to the [Global Route Collector](/services/Route-Collector)!
406
-```shell
406
+```sh
407 407
# The route collector should never export routes, so let's make a route-map to reject them if it does.
408 408
set policy route-map Deny-All rule 1 action deny
409 409
set protocols bgp neighbor fd42:4242:2601:ac12::1 address-family ipv4-unicast route-map import 'Deny-All'