> For the complete documentation index, see [llms.txt](https://jncia-workbook.gitbook.io/workbook/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://jncia-workbook.gitbook.io/workbook/junos-routing/2-null-routes.md).

# 2) Null Routes

### Pre-Work

Load the config called **null.routes.cfg** using the **load\_config\_on\_nodes.py** script.

```
python3 load_config_on_nodes.py --lab_dir three-routers --config_filename null.routes.cfg
```

### Lab

R1 has a static route for 200.200.200.200/32 via R2. Configure R2 so that it blackholes this traffic, and replies with an ICMP destination unreachable message.

```
admin@R1> ping 200.200.200.200 
PING 200.200.200.200 (200.200.200.200): 56 data bytes
36 bytes from 10.1.2.2: Destination Net Unreachable
Vr HL TOS  Len   ID Flg  off TTL Pro  cks      Src      Dst
 4  5  00 0054 df1c   0 0000  40  01 fdf9 10.1.2.1  200.200.200.200 

36 bytes from 10.1.2.2: Destination Net Unreachable
Vr HL TOS  Len   ID Flg  off TTL Pro  cks      Src      Dst
 4  5  00 0054 df47   0 0000  40  01 fdce 10.1.2.1  200.200.200.200 

^C
--- 200.200.200.200 ping statistics ---
2 packets transmitted, 0 packets received, 100% packet loss
```

### Answer

<details>

<summary>Expand to reveal</summary>

```
set routing-options static route 200.200.200.200/32 reject
```

</details>

### Explanation

<details>

<summary>Expand to reveal</summary>

We have two options when creating a null route in Junos: we can use `discard` or `reject`. `Discard` will silently drop the packet. `Reject` will send an ICMP unreachable.

\
The null route is configured just like a normal static route, except the next-hop is `discard` or `reject` instead of an IP next-hop.

\
We can see the reject next-hop in the RIB:

```
admin@R2> show route protocol static 

inet.0: 6 destinations, 6 routes (6 active, 0 holddown, 0 hidden)
+ = Active Route, - = Last Active, * = Both

200.200.200.200/32 *[Static/5] 00:00:04
                       Reject
```

\
As well as in the forwarding-table (`rjct`):

```
admin@R2> show route forwarding-table family inet destination 200.200.200.200 
Routing table: default.inet
Internet:
Destination        Type RtRef Next hop           Type Index    NhRef Netif
200.200.200.200/32 user     0                    rjct       36     2
```

</details>

### Further Reading

<https://www.juniper.net/documentation/us/en/software/junos/cli-reference/topics/ref/statement/discard-edit-routing-options.html>

<https://community.juniper.net/discussion/discard-reject-and-unilist-route-types-in-show-pfe-route-ip-output>

<https://www.networkfuntimes.com/junos-aggregate-routes-vs-generate-routes-how-to-summarise-on-juniper-routers/>
