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