main.texi 6.7 KB

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