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