]>
Commit | Line | Data |
---|---|---|
614aa5c1 DS |
1 | .. _static: |
2 | ||
3 | ****** | |
4 | STATIC | |
5 | ****** | |
6 | ||
7 | :abbr:`STATIC` is a daemon that handles the installation and deletion | |
8 | of static routes. | |
9 | ||
10 | .. _starting-static: | |
11 | ||
4c97fd1a | 12 | Starting STATIC |
614aa5c1 DS |
13 | =============== |
14 | ||
15 | Default configuration file for *staticd* is :file:`staticd.conf`. The typical | |
16 | location of :file:`staticd.conf` is |INSTALL_PREFIX_ETC|/staticd.conf. | |
17 | ||
18 | If the user is using integrated config, then :file:`staticd.conf` need not be | |
19 | present and the :file:`frr.conf` is read instead. | |
20 | ||
21 | If the user has not fully upgraded to using the staticd.conf and still has | |
22 | a non-integrated config with zebra.conf holding the static routes, *staticd* | |
23 | will read in the :file:`zebrad.conf` as a backup. | |
24 | ||
25 | .. program:: staticd | |
26 | ||
27 | :abbr:`STATIC` supports all the common FRR daemon start options which are | |
28 | documented elsewhere. | |
29 | ||
30 | .. _static-route-commands: | |
31 | ||
32 | Static Route Commands | |
33 | ===================== | |
34 | ||
35 | Static routing is a very fundamental feature of routing technology. It defines | |
36 | a static prefix and gateway. | |
37 | ||
38 | .. index:: ip route NETWORK GATEWAY table TABLENO nexthop-vrf VRFNAME DISTANCE vrf VRFNAME | |
39 | .. clicmd:: ip route NETWORK GATEWAY table TABLENO nexthop-vrf VRFNAME DISTANCE vrf VRFNAME | |
40 | ||
41 | .. index:: ipv6 route NETWORK from SRCPREFIX GATEWAY table TABLENO nexthop-vrf VRFNAME DISTANCE vrf VRFNAME | |
42 | .. clicmd:: ipv6 route NETWORK from SRCPREFIX GATEWAY table TABLENO nexthop-vrf VRFNAME DISTANCE vrf VRFNAME | |
43 | ||
44 | NETWORK is destination prefix with a valid v4 or v6 network based upon | |
45 | initial form of the command. GATEWAY is gateway for the prefix it currently | |
46 | must match the v4 or v6 route type specified at the start of the command. | |
47 | GATEWAY can also be treated as an interface name. If the interface name | |
4c97fd1a | 48 | is ``null0`` then zebra installs a blackhole route. TABLENO |
614aa5c1 DS |
49 | is an optional parameter for namespaces that allows you to create the |
50 | route in a specified table associated with the vrf namespace. table will | |
51 | be rejected if you are not using namespace based vrfs. ``nexthop-vrf`` | |
4c97fd1a | 52 | allows you to create a leaked route with a nexthop in the specified VRFNAME |
614aa5c1 DS |
53 | vrf VRFNAME allows you to create the route in a specified vrf. |
54 | ``nexthop-vrf`` cannot be currently used with namespace based vrfs | |
55 | currently as well. | |
56 | The v6 variant allows the installation of a static source-specific route | |
57 | with the SRCPREFIX sub command. These routes are currently supported | |
58 | on Linux operating systems only, and perform AND matching on packet's | |
59 | destination and source addresses in the kernel's forwarding path. Note | |
60 | that destination longest-prefix match is "more important" than source | |
61 | LPM, e.g. ``2001:db8:1::/64 from 2001:db8::/48`` will win over | |
62 | ``2001:db8::/48 from 2001:db8:1::/64`` if both match. | |
63 | ||
64 | .. _multiple-route-command: | |
65 | ||
66 | Multiple nexthop static route | |
67 | ============================= | |
68 | ||
69 | To create multiple nexthops to the same NETWORK, just reenter the same | |
70 | network statement with different nexthop information. | |
71 | ||
72 | .. code-block:: frr | |
73 | ||
74 | ip route 10.0.0.1/32 10.0.0.2 | |
75 | ip route 10.0.0.1/32 10.0.0.3 | |
76 | ip route 10.0.0.1/32 eth0 | |
77 | ||
78 | ||
79 | If there is no route to 10.0.0.2 and 10.0.0.3, and interface eth0 | |
80 | is reachable, then the last route is installed into the kernel. | |
81 | ||
82 | If zebra has been compiled with multipath support, and both 10.0.0.2 and | |
83 | 10.0.0.3 are reachable, zebra will install a multipath route via both | |
84 | nexthops, if the platform supports this. | |
85 | ||
86 | :: | |
87 | ||
88 | router> show ip route | |
89 | S> 10.0.0.1/32 [1/0] via 10.0.0.2 inactive | |
90 | via 10.0.0.3 inactive | |
91 | * is directly connected, eth0 | |
92 | ||
93 | ||
94 | .. code-block:: frr | |
95 | ||
96 | ip route 10.0.0.0/8 10.0.0.2 | |
97 | ip route 10.0.0.0/8 10.0.0.3 | |
98 | ip route 10.0.0.0/8 null0 255 | |
99 | ||
100 | ||
101 | This will install a multihop route via the specified next-hops if they are | |
102 | reachable, as well as a high-distance blackhole route, which can be useful to | |
103 | prevent traffic destined for a prefix to match less-specific routes (e.g. | |
104 | default) should the specified gateways not be reachable. E.g.: | |
105 | ||
106 | :: | |
107 | ||
108 | router> show ip route 10.0.0.0/8 | |
109 | Routing entry for 10.0.0.0/8 | |
110 | Known via "static", distance 1, metric 0 | |
111 | 10.0.0.2 inactive | |
112 | 10.0.0.3 inactive | |
113 | ||
114 | Routing entry for 10.0.0.0/8 | |
115 | Known via "static", distance 255, metric 0 | |
116 | directly connected, Null0 | |
117 | ||
118 | Also, if the user wants to configure a static route for a specific VRF, then | |
119 | a specific VRF configuration mode is available. After entering into that mode | |
120 | with :clicmd:`vrf VRF` the user can enter the same route command as before, | |
121 | but this time, the route command will apply to the VRF. | |
122 | ||
123 | .. code-block:: frr | |
124 | ||
125 | # case with VRF | |
126 | configure terminal | |
127 | vrf r1-cust1 | |
128 | ip route 10.0.0.0/24 10.0.0.2 | |
129 | exit-vrf | |
130 |