]> git.proxmox.com Git - mirror_frr.git/blame - doc/user/static.rst
Merge pull request #6557 from opensourcerouting/zlogbuf-litter
[mirror_frr.git] / doc / user / static.rst
CommitLineData
614aa5c1
DS
1.. _static:
2
3******
4STATIC
5******
6
7:abbr:`STATIC` is a daemon that handles the installation and deletion
8of static routes.
9
10.. _starting-static:
11
4c97fd1a 12Starting STATIC
614aa5c1
DS
13===============
14
15Default configuration file for *staticd* is :file:`staticd.conf`. The typical
16location of :file:`staticd.conf` is |INSTALL_PREFIX_ETC|/staticd.conf.
17
18If the user is using integrated config, then :file:`staticd.conf` need not be
19present and the :file:`frr.conf` is read instead.
20
21If the user has not fully upgraded to using the staticd.conf and still has
22a non-integrated config with zebra.conf holding the static routes, *staticd*
23will 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
28documented elsewhere.
29
30.. _static-route-commands:
31
32Static Route Commands
33=====================
34
35Static routing is a very fundamental feature of routing technology. It defines
36a 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
66Multiple nexthop static route
67=============================
68
69To create multiple nexthops to the same NETWORK, just reenter the same
70network 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
79If there is no route to 10.0.0.2 and 10.0.0.3, and interface eth0
80is reachable, then the last route is installed into the kernel.
81
82If zebra has been compiled with multipath support, and both 10.0.0.2 and
8310.0.0.3 are reachable, zebra will install a multipath route via both
84nexthops, 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
101This will install a multihop route via the specified next-hops if they are
102reachable, as well as a high-distance blackhole route, which can be useful to
103prevent traffic destined for a prefix to match less-specific routes (e.g.
104default) 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
118Also, if the user wants to configure a static route for a specific VRF, then
119a specific VRF configuration mode is available. After entering into that mode
120with :clicmd:`vrf VRF` the user can enter the same route command as before,
121but this time, the route command will apply to the VRF.
122
123.. code-block:: frr
124
125 # case with VRF
982589a3 126 configure
614aa5c1
DS
127 vrf r1-cust1
128 ip route 10.0.0.0/24 10.0.0.2
129 exit-vrf
130