paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1 | @node Zebra |
| 2 | @comment node-name, next, previous, up |
| 3 | @chapter Zebra |
| 4 | |
| 5 | @c SYNOPSIS |
| 6 | @command{zebra} is an IP routing manager. It provides kernel routing |
| 7 | table updates, interface lookups, and redistribution of routes between |
| 8 | different routing protocols. |
| 9 | |
| 10 | @menu |
| 11 | * Invoking zebra:: Running the program |
| 12 | * Interface Commands:: Commands for zebra interfaces |
| 13 | * Static Route Commands:: Commands for adding static routes |
| 14 | * zebra Terminal Mode Commands:: Commands for zebra's VTY |
| 15 | @end menu |
| 16 | |
| 17 | |
| 18 | @node Invoking zebra, Interface Commands, Zebra, Zebra |
| 19 | @comment node-name, next, previous, up |
| 20 | @section Invoking zebra |
| 21 | |
| 22 | Besides the common invocation options (@pxref{Common Invocation Options}), the |
| 23 | @command{zebra} specific invocation options are listed below. |
| 24 | |
| 25 | @table @samp |
| 26 | @item -b |
| 27 | @itemx --batch |
| 28 | Runs in batch mode. @command{zebra} parses configuration file and terminates |
| 29 | immediately. |
| 30 | |
| 31 | @item -k |
| 32 | @itemx --keep_kernel |
| 33 | When zebra starts up, don't delete old self inserted routes. |
| 34 | |
| 35 | @item -l |
| 36 | @itemx --log_mode |
| 37 | Set verbose logging on. |
| 38 | |
| 39 | @item -r |
| 40 | @itemx --retain |
| 41 | When program terminates, retain routes added by zebra. |
| 42 | |
| 43 | @end table |
| 44 | |
| 45 | @node Interface Commands, Static Route Commands, Invoking zebra, Zebra |
| 46 | @comment node-name, next, previous, up |
| 47 | @section Interface Commands |
| 48 | |
| 49 | @deffn Command {interface @var{ifname}} {} |
| 50 | @end deffn |
| 51 | |
| 52 | @deffn {Interface Command} {shutdown} {} |
| 53 | @deffnx {Interface Command} {no shutdown} {} |
| 54 | Up or down the current interface. |
| 55 | @end deffn |
| 56 | |
paul | 971a449 | 2003-06-20 01:18:07 +0000 | [diff] [blame^] | 57 | @deffn {Interface Command} {ip address @var{address/prefix}} {} |
| 58 | @deffnx {Interface Command} {ip6 address @var{address/prefix}} {} |
| 59 | @deffnx {Interface Command} {no ip address @var{address/prefix}} {} |
| 60 | @deffnx {Interface Command} {no ip6 address @var{address/prefix}} {} |
| 61 | Set the IPv4 or IPv6 address/prefix for the interface. |
| 62 | @end deffn |
| 63 | |
| 64 | @deffn {Interface Command} {ip address @var{address/prefix} secondary} {} |
| 65 | @deffnx {Interface Command} {no ip address @var{address/prefix} secondary} {} |
| 66 | Set the secondary flag for this address. This causes ospfd to not treat the |
| 67 | address as a distinct subnet. |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 68 | @end deffn |
| 69 | |
| 70 | @deffn {Interface Command} {description @var{description} ...} {} |
| 71 | Set description for the interface. |
| 72 | @end deffn |
| 73 | |
| 74 | @deffn {Interface Command} {multicast} {} |
| 75 | @deffnx {Interface Command} {no multicast} {} |
| 76 | Enable or disables multicast flag for the interface. |
| 77 | @end deffn |
| 78 | |
| 79 | @deffn {Interface Command} {bandwidth <1-10000000>} {} |
| 80 | @deffnx {Interface Command} {no bandwidth <1-10000000>} {} |
paul | 971a449 | 2003-06-20 01:18:07 +0000 | [diff] [blame^] | 81 | Set bandwidth value of the interface in kilobits/sec. This is for |
| 82 | calculating OSPF cost. This command does not affect the actual device |
| 83 | configuration. |
| 84 | @end deffn |
| 85 | |
| 86 | @deffn {Interface Command} {link-detect} {} |
| 87 | @deffnx {Interface Command} {no link-detect} {} |
| 88 | Enable/disable link-detect on platforms which support this. Currently |
| 89 | only linux and with certain drivers - those which properly support the |
| 90 | IFF_RUNNING flag. |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 91 | @end deffn |
| 92 | |
| 93 | @node Static Route Commands, zebra Terminal Mode Commands, Interface Commands, Zebra |
| 94 | @comment node-name, next, previous, up |
| 95 | @section Static Route Commands |
| 96 | |
| 97 | Static routing is a very fundamental feature of routing technology. It |
| 98 | defines static prefix and gateway. |
| 99 | |
| 100 | @deffn Command {ip route @var{network} @var{gateway}} {} |
| 101 | @var{network} is destination prefix with format of A.B.C.D/M. |
| 102 | @var{gateway} is gateway for the prefix. When @var{gateway} is |
| 103 | A.B.C.D format. It is taken as a IPv4 address gateway. Otherwise it |
paul | 971a449 | 2003-06-20 01:18:07 +0000 | [diff] [blame^] | 104 | is treated as an interface name. If the interface name is @var{null0} then |
| 105 | zebra installs a blackhole route. |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 106 | |
| 107 | @example |
| 108 | ip route 10.0.0.0/8 10.0.0.2 |
| 109 | ip route 10.0.0.0/8 ppp0 |
paul | 971a449 | 2003-06-20 01:18:07 +0000 | [diff] [blame^] | 110 | ip route 10.0.0.0/8 null0 |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 111 | @end example |
| 112 | |
| 113 | First example defines 10.0.0.0/8 static route with gateway 10.0.0.2. |
paul | 971a449 | 2003-06-20 01:18:07 +0000 | [diff] [blame^] | 114 | Second one defines the same prefix but with gateway to interface ppp0. The |
| 115 | third install a blackhole route. |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 116 | @end deffn |
| 117 | |
| 118 | @deffn Command {ip route @var{network} @var{netmask} @var{gateway}} {} |
| 119 | This is alternate version of above command. When @var{network} is |
| 120 | A.B.C.D format, user must define @var{netmask} value with A.B.C.D |
| 121 | format. @var{gateway} is same option as above command |
| 122 | |
| 123 | @example |
| 124 | ip route 10.0.0.0 255.255.255.0 10.0.0.2 |
| 125 | ip route 10.0.0.0 255.255.255.0 ppp0 |
paul | 971a449 | 2003-06-20 01:18:07 +0000 | [diff] [blame^] | 126 | ip route 10.0.0.0 255.255.255.0 null0 |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 127 | @end example |
| 128 | |
paul | 971a449 | 2003-06-20 01:18:07 +0000 | [diff] [blame^] | 129 | These statements are equivalent to those in the previous example. |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 130 | @end deffn |
| 131 | |
| 132 | @deffn Command {ip route @var{network} @var{gateway} @var{distance}} {} |
paul | 971a449 | 2003-06-20 01:18:07 +0000 | [diff] [blame^] | 133 | Installs the route with the specified distance. |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 134 | @end deffn |
| 135 | |
| 136 | Multiple nexthop static route |
| 137 | |
| 138 | @example |
| 139 | ip route 10.0.0.1/32 10.0.0.2 |
| 140 | ip route 10.0.0.1/32 10.0.0.3 |
| 141 | ip route 10.0.0.1/32 eth0 |
| 142 | @end example |
| 143 | |
| 144 | If there is no route to 10.0.0.2 and 10.0.0.3, and interface eth0 |
| 145 | is reachable, then the last route is installed into the kernel. |
| 146 | |
paul | 971a449 | 2003-06-20 01:18:07 +0000 | [diff] [blame^] | 147 | If zebra has been compiled with multipath support, and both 10.0.0.2 and |
| 148 | 10.0.0.3 are reachable, zebra will install a multipath route via both |
| 149 | nexthops, if the platform supports this. |
| 150 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 151 | @example |
| 152 | zebra> show ip route |
| 153 | S> 10.0.0.1/32 [1/0] via 10.0.0.2 inactive |
| 154 | via 10.0.0.3 inactive |
| 155 | * is directly connected, eth0 |
| 156 | @end example |
| 157 | |
paul | 971a449 | 2003-06-20 01:18:07 +0000 | [diff] [blame^] | 158 | @example |
| 159 | ip route 10.0.0.0/8 10.0.0.2 |
| 160 | ip route 10.0.0.0/8 10.0.0.3 |
| 161 | ip route 10.0.0.0/8 null0 255 |
| 162 | @end example |
| 163 | |
| 164 | This will install a multihop route via the specified next-hops if they are |
| 165 | reachable, as well as a high-metric blackhole route, which can be useful to |
| 166 | prevent traffic destined for a prefix to match less-specific routes (eg |
| 167 | default) should the specified gateways not be reachable. Eg: |
| 168 | |
| 169 | @example |
| 170 | zebra> show ip route 10.0.0.0/8 |
| 171 | Routing entry for 10.0.0.0/8 |
| 172 | Known via "static", distance 1, metric 0 |
| 173 | 10.0.0.2 inactive |
| 174 | 10.0.0.3 inactive |
| 175 | |
| 176 | Routing entry for 10.0.0.0/8 |
| 177 | Known via "static", distance 255, metric 0 |
| 178 | directly connected, Null0 |
| 179 | @end example |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 180 | |
| 181 | @deffn Command {ipv6 route @var{network} @var{gateway}} {} |
paul | 971a449 | 2003-06-20 01:18:07 +0000 | [diff] [blame^] | 182 | @deffnx Command {ipv6 route @var{network} @var{gateway} @var{distance}} {} |
| 183 | These behave similarly to their ipv4 counterparts. |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 184 | @end deffn |
| 185 | |
| 186 | |
| 187 | @deffn Command {table @var{tableno}} {} |
| 188 | Select the primary kernel routing table to be used. This only works |
| 189 | for kernels supporting multiple routing tables (like GNU/Linux 2.2.x |
| 190 | and later). After setting @var{tableno} with this command, |
| 191 | static routes defined after this are added to the specified table. |
| 192 | @end deffn |
| 193 | |
| 194 | @node zebra Terminal Mode Commands, , Static Route Commands, Zebra |
| 195 | @comment node-name, next, previous, up |
| 196 | @section zebra Terminal Mode Commands |
| 197 | |
| 198 | @deffn Command {show ip route} {} |
| 199 | Display current routes which zebra holds in its database. |
| 200 | |
| 201 | @example |
| 202 | @group |
| 203 | Router# show ip route |
| 204 | Codes: K - kernel route, C - connected, S - static, R - RIP, |
| 205 | B - BGP * - FIB route. |
| 206 | |
| 207 | K* 0.0.0.0/0 203.181.89.241 |
| 208 | S 0.0.0.0/0 203.181.89.1 |
| 209 | C* 127.0.0.0/8 lo |
| 210 | C* 203.181.89.240/28 eth0 |
| 211 | @end group |
| 212 | @end example |
| 213 | @end deffn |
| 214 | |
| 215 | @deffn Command {show ipv6 route} {} |
| 216 | @end deffn |
| 217 | |
| 218 | @deffn Command {show interface} {} |
| 219 | @end deffn |
| 220 | |
| 221 | @deffn Command {show ipforward} {} |
| 222 | Display whether the host's IP forwarding function is enabled or not. |
| 223 | Almost any UNIX kernel can be configured with IP forwarding disabled. |
| 224 | If so, the box can't work as a router. |
| 225 | @end deffn |
| 226 | |
| 227 | @deffn Command {show ipv6forward} {} |
| 228 | Display whether the host's IP v6 forwarding is enabled or not. |
| 229 | @end deffn |