]> git.proxmox.com Git - mirror_frr.git/blob - doc/user/static.rst
Merge pull request #8148 from qlyoung/fix-pim-nb-static-mroute-loop-check
[mirror_frr.git] / doc / user / static.rst
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
12 Starting STATIC
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 .. clicmd:: ip route NETWORK GATEWAY table TABLENO nexthop-vrf VRFNAME DISTANCE vrf VRFNAME
39
40 .. clicmd:: ipv6 route NETWORK from SRCPREFIX GATEWAY table TABLENO nexthop-vrf VRFNAME DISTANCE vrf VRFNAME
41
42 NETWORK is destination prefix with a valid v4 or v6 network based upon
43 initial form of the command. GATEWAY is gateway for the prefix it currently
44 must match the v4 or v6 route type specified at the start of the command.
45 GATEWAY can also be treated as an interface name. If the interface name
46 is ``null0`` then zebra installs a blackhole route. TABLENO
47 is an optional parameter for namespaces that allows you to create the
48 route in a specified table associated with the vrf namespace. table will
49 be rejected if you are not using namespace based vrfs. ``nexthop-vrf``
50 allows you to create a leaked route with a nexthop in the specified VRFNAME
51 vrf VRFNAME allows you to create the route in a specified vrf.
52 ``nexthop-vrf`` cannot be currently used with namespace based vrfs
53 currently as well.
54 The v6 variant allows the installation of a static source-specific route
55 with the SRCPREFIX sub command. These routes are currently supported
56 on Linux operating systems only, and perform AND matching on packet's
57 destination and source addresses in the kernel's forwarding path. Note
58 that destination longest-prefix match is "more important" than source
59 LPM, e.g. ``2001:db8:1::/64 from 2001:db8::/48`` will win over
60 ``2001:db8::/48 from 2001:db8:1::/64`` if both match.
61
62 .. _multiple-route-command:
63
64 Multiple nexthop static route
65 =============================
66
67 To create multiple nexthops to the same NETWORK, just reenter the same
68 network statement with different nexthop information.
69
70 .. code-block:: frr
71
72 ip route 10.0.0.1/32 10.0.0.2
73 ip route 10.0.0.1/32 10.0.0.3
74 ip route 10.0.0.1/32 eth0
75
76
77 If there is no route to 10.0.0.2 and 10.0.0.3, and interface eth0
78 is reachable, then the last route is installed into the kernel.
79
80 If zebra has been compiled with multipath support, and both 10.0.0.2 and
81 10.0.0.3 are reachable, zebra will install a multipath route via both
82 nexthops, if the platform supports this.
83
84 ::
85
86 router> show ip route
87 S> 10.0.0.1/32 [1/0] via 10.0.0.2 inactive
88 via 10.0.0.3 inactive
89 * is directly connected, eth0
90
91
92 .. code-block:: frr
93
94 ip route 10.0.0.0/8 10.0.0.2
95 ip route 10.0.0.0/8 10.0.0.3
96 ip route 10.0.0.0/8 null0 255
97
98
99 This will install a multihop route via the specified next-hops if they are
100 reachable, as well as a high-distance blackhole route, which can be useful to
101 prevent traffic destined for a prefix to match less-specific routes (e.g.
102 default) should the specified gateways not be reachable. E.g.:
103
104 ::
105
106 router> show ip route 10.0.0.0/8
107 Routing entry for 10.0.0.0/8
108 Known via "static", distance 1, metric 0
109 10.0.0.2 inactive
110 10.0.0.3 inactive
111
112 Routing entry for 10.0.0.0/8
113 Known via "static", distance 255, metric 0
114 directly connected, Null0
115
116 Also, if the user wants to configure a static route for a specific VRF, then
117 a specific VRF configuration mode is available. After entering into that mode
118 with :clicmd:`vrf VRF` the user can enter the same route command as before,
119 but this time, the route command will apply to the VRF.
120
121 .. code-block:: frr
122
123 # case with VRF
124 configure
125 vrf r1-cust1
126 ip route 10.0.0.0/24 10.0.0.2
127 exit-vrf
128
129
130 SR-TE Route Commands
131 ====================
132
133 It is possible to specify a route using a SR-TE policy configured in Zebra.
134
135 e.g. to use the SR-TE policy with endpoint 6.6.6.6 and color 123 to reach the
136 network 9.9.9.9/24:
137
138 .. code-block:: frr
139
140 ip route 9.9.9.9/24 6.6.6.6 color 123