mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-05-25 02:50:36 +00:00

2007-05-01 David L Stevens <dlstevens@us.ibm.com> * (general) These changes collectively add route-map and prefix-list support to zebra and fix a bug in "show route-map" (with no argument). * doc/main.texi: added route-map, prefix-list, ip protocol and set src documentation * lib/command.h: added PROTOCOL_NODE type * lib/log.c: (proto_name2num) new function, protocol name to number translation. * lib/routemap.c: (vty_show_route_map) fixed "show route-map" without route-map name * lib/routemap.h: added RMAP_ZEBRA type * lib/zebra.h: added proto_name2num() prototype * vtysh/extract.pl.in: added VTYSH_ZEBRA flag for route-map and plist * vtysh/Makefile.am: added zebra_routemap.c * vtysh/vtysh.h: added VTYSH_ZEBRA flag to VTYSH_RMAP * zebra/connected.c: (connected_up_ipv4) added src preference argument to rib_add_ipv4() * zebra/kernel_socket.c: (rtm_read) ditto * zebra/main.c: added prefix list initialization * zebra/Makefile.am: added zebra_routemap.c source file * zebra/rib.h: added generic address union "g_addr" and use in existing places that had an explicit union. Added "src" to struct nexthop. Added preferred src arg to nexthop_ipv4_add and rib_add_ipv4. * zebra/rt_netlink.c: (netlink_routing_table) set preferred source on netlink messages. (netlink_route_change) ditto (netlink_route_multipath) ditto. * zebra/rtread_getmsg.c: (handle_route_entry) added (NULL) src to rib_add_ipv4() call. * zebra/rtread_proc.c: (proc_route_read) ditto * zebra/zebra_rib.c: (nexthop_ipv4_add) add src argument. (nexthop_ipv4_ifindex_add) ditto (rib_add_ipv4) ditto (nexthop_active_check) Add route-map processing. * zebra/zebra_routemap.c: new file for zebra route-map commands. * zebra/zebra_vty.c: (ip_protocol_cmd) Apply route-map to protocol (vty_show_ip_route_detail) added "src" printing (vty_show_ip_route) ditto (show_ip_protocol_cmd) new command, list routemaps. (config_write_protocol) write out routemap protocl config. (zebra_vty_init) Install the new routemap protocol commands. * zebra/zserv.c: (zread_ipv4_add) added (NULL) src arg (zebra_init) init zebra route-maps. * zebra/zserv.h: add zebra_route_map_init
274 lines
8.0 KiB
Plaintext
274 lines
8.0 KiB
Plaintext
@node Zebra
|
|
@chapter Zebra
|
|
|
|
@c SYNOPSIS
|
|
@command{zebra} is an IP routing manager. It provides kernel routing
|
|
table updates, interface lookups, and redistribution of routes between
|
|
different routing protocols.
|
|
|
|
@menu
|
|
* Invoking zebra:: Running the program
|
|
* Interface Commands:: Commands for zebra interfaces
|
|
* Static Route Commands:: Commands for adding static routes
|
|
* zebra Route Filtering:: Commands for zebra route filtering
|
|
* zebra Terminal Mode Commands:: Commands for zebra's VTY
|
|
@end menu
|
|
|
|
|
|
@node Invoking zebra
|
|
@section Invoking zebra
|
|
|
|
Besides the common invocation options (@pxref{Common Invocation Options}), the
|
|
@command{zebra} specific invocation options are listed below.
|
|
|
|
@table @samp
|
|
@item -b
|
|
@itemx --batch
|
|
Runs in batch mode. @command{zebra} parses configuration file and terminates
|
|
immediately.
|
|
|
|
@item -k
|
|
@itemx --keep_kernel
|
|
When zebra starts up, don't delete old self inserted routes.
|
|
|
|
@item -r
|
|
@itemx --retain
|
|
When program terminates, retain routes added by zebra.
|
|
|
|
@end table
|
|
|
|
@node Interface Commands
|
|
@section Interface Commands
|
|
|
|
@deffn Command {interface @var{ifname}} {}
|
|
@end deffn
|
|
|
|
@deffn {Interface Command} {shutdown} {}
|
|
@deffnx {Interface Command} {no shutdown} {}
|
|
Up or down the current interface.
|
|
@end deffn
|
|
|
|
@deffn {Interface Command} {ip address @var{address/prefix}} {}
|
|
@deffnx {Interface Command} {ip6 address @var{address/prefix}} {}
|
|
@deffnx {Interface Command} {no ip address @var{address/prefix}} {}
|
|
@deffnx {Interface Command} {no ip6 address @var{address/prefix}} {}
|
|
Set the IPv4 or IPv6 address/prefix for the interface.
|
|
@end deffn
|
|
|
|
@deffn {Interface Command} {ip address @var{address/prefix} secondary} {}
|
|
@deffnx {Interface Command} {no ip address @var{address/prefix} secondary} {}
|
|
Set the secondary flag for this address. This causes ospfd to not treat the
|
|
address as a distinct subnet.
|
|
@end deffn
|
|
|
|
@deffn {Interface Command} {description @var{description} ...} {}
|
|
Set description for the interface.
|
|
@end deffn
|
|
|
|
@deffn {Interface Command} {multicast} {}
|
|
@deffnx {Interface Command} {no multicast} {}
|
|
Enable or disables multicast flag for the interface.
|
|
@end deffn
|
|
|
|
@deffn {Interface Command} {bandwidth <1-10000000>} {}
|
|
@deffnx {Interface Command} {no bandwidth <1-10000000>} {}
|
|
Set bandwidth value of the interface in kilobits/sec. This is for
|
|
calculating OSPF cost. This command does not affect the actual device
|
|
configuration.
|
|
@end deffn
|
|
|
|
@deffn {Interface Command} {link-detect} {}
|
|
@deffnx {Interface Command} {no link-detect} {}
|
|
Enable/disable link-detect on platforms which support this. Currently
|
|
only Linux and Solaris, and only where network interface drivers support reporting
|
|
link-state via the IFF_RUNNING flag.
|
|
@end deffn
|
|
|
|
@node Static Route Commands
|
|
@section Static Route Commands
|
|
|
|
Static routing is a very fundamental feature of routing technology. It
|
|
defines static prefix and gateway.
|
|
|
|
@deffn Command {ip route @var{network} @var{gateway}} {}
|
|
@var{network} is destination prefix with format of A.B.C.D/M.
|
|
@var{gateway} is gateway for the prefix. When @var{gateway} is
|
|
A.B.C.D format. It is taken as a IPv4 address gateway. Otherwise it
|
|
is treated as an interface name. If the interface name is @var{null0} then
|
|
zebra installs a blackhole route.
|
|
|
|
@example
|
|
ip route 10.0.0.0/8 10.0.0.2
|
|
ip route 10.0.0.0/8 ppp0
|
|
ip route 10.0.0.0/8 null0
|
|
@end example
|
|
|
|
First example defines 10.0.0.0/8 static route with gateway 10.0.0.2.
|
|
Second one defines the same prefix but with gateway to interface ppp0. The
|
|
third install a blackhole route.
|
|
@end deffn
|
|
|
|
@deffn Command {ip route @var{network} @var{netmask} @var{gateway}} {}
|
|
This is alternate version of above command. When @var{network} is
|
|
A.B.C.D format, user must define @var{netmask} value with A.B.C.D
|
|
format. @var{gateway} is same option as above command
|
|
|
|
@example
|
|
ip route 10.0.0.0 255.255.255.0 10.0.0.2
|
|
ip route 10.0.0.0 255.255.255.0 ppp0
|
|
ip route 10.0.0.0 255.255.255.0 null0
|
|
@end example
|
|
|
|
These statements are equivalent to those in the previous example.
|
|
@end deffn
|
|
|
|
@deffn Command {ip route @var{network} @var{gateway} @var{distance}} {}
|
|
Installs the route with the specified distance.
|
|
@end deffn
|
|
|
|
Multiple nexthop static route
|
|
|
|
@example
|
|
ip route 10.0.0.1/32 10.0.0.2
|
|
ip route 10.0.0.1/32 10.0.0.3
|
|
ip route 10.0.0.1/32 eth0
|
|
@end example
|
|
|
|
If there is no route to 10.0.0.2 and 10.0.0.3, and interface eth0
|
|
is reachable, then the last route is installed into the kernel.
|
|
|
|
If zebra has been compiled with multipath support, and both 10.0.0.2 and
|
|
10.0.0.3 are reachable, zebra will install a multipath route via both
|
|
nexthops, if the platform supports this.
|
|
|
|
@example
|
|
zebra> show ip route
|
|
S> 10.0.0.1/32 [1/0] via 10.0.0.2 inactive
|
|
via 10.0.0.3 inactive
|
|
* is directly connected, eth0
|
|
@end example
|
|
|
|
@example
|
|
ip route 10.0.0.0/8 10.0.0.2
|
|
ip route 10.0.0.0/8 10.0.0.3
|
|
ip route 10.0.0.0/8 null0 255
|
|
@end example
|
|
|
|
This will install a multihop route via the specified next-hops if they are
|
|
reachable, as well as a high-metric blackhole route, which can be useful to
|
|
prevent traffic destined for a prefix to match less-specific routes (eg
|
|
default) should the specified gateways not be reachable. Eg:
|
|
|
|
@example
|
|
zebra> show ip route 10.0.0.0/8
|
|
Routing entry for 10.0.0.0/8
|
|
Known via "static", distance 1, metric 0
|
|
10.0.0.2 inactive
|
|
10.0.0.3 inactive
|
|
|
|
Routing entry for 10.0.0.0/8
|
|
Known via "static", distance 255, metric 0
|
|
directly connected, Null0
|
|
@end example
|
|
|
|
@deffn Command {ipv6 route @var{network} @var{gateway}} {}
|
|
@deffnx Command {ipv6 route @var{network} @var{gateway} @var{distance}} {}
|
|
These behave similarly to their ipv4 counterparts.
|
|
@end deffn
|
|
|
|
|
|
@deffn Command {table @var{tableno}} {}
|
|
Select the primary kernel routing table to be used. This only works
|
|
for kernels supporting multiple routing tables (like GNU/Linux 2.2.x
|
|
and later). After setting @var{tableno} with this command,
|
|
static routes defined after this are added to the specified table.
|
|
@end deffn
|
|
|
|
@node zebra Route Filtering
|
|
@section zebra Route Filtering
|
|
Zebra supports @command{prefix-list} and @command{route-map} to match
|
|
routes received from other quagga components. The
|
|
@command{permit}/@command{deny} facilities provided by these commands
|
|
can be used to filter which routes zebra will install in the kernel.
|
|
|
|
@deffn Command {ip protocol @var{protocol} route-map @var{routemap}} {}
|
|
Apply a route-map filter to routes for the specified protocol. @var{protocol}
|
|
can be @b{any} or one of
|
|
@b{system},
|
|
@b{kernel},
|
|
@b{connected},
|
|
@b{static},
|
|
@b{rip},
|
|
@b{ripng},
|
|
@b{ospf},
|
|
@b{ospf6},
|
|
@b{isis},
|
|
@b{bgp},
|
|
@b{hsls}.
|
|
@end deffn
|
|
|
|
@deffn {Route Map} {set src @var{address}}
|
|
Within a route-map, set the preferred source address for matching routes
|
|
when installing in the kernel.
|
|
@end deffn
|
|
|
|
@example
|
|
The following creates a prefix-list that matches all addresses, a route-map
|
|
that sets the preferred source address, and applies the route-map to all
|
|
@command{rip} routes.
|
|
|
|
@group
|
|
ip prefix-list ANY permit 0.0.0.0/0 le 32
|
|
route-map RM1 permit 10
|
|
match ip address prefix-list ANY
|
|
set src 10.0.0.1
|
|
|
|
ip protocol rip route-map RM1
|
|
@end group
|
|
@end example
|
|
|
|
@node zebra Terminal Mode Commands
|
|
@section zebra Terminal Mode Commands
|
|
|
|
@deffn Command {show ip route} {}
|
|
Display current routes which zebra holds in its database.
|
|
|
|
@example
|
|
@group
|
|
Router# show ip route
|
|
Codes: K - kernel route, C - connected, S - static, R - RIP,
|
|
B - BGP * - FIB route.
|
|
|
|
K* 0.0.0.0/0 203.181.89.241
|
|
S 0.0.0.0/0 203.181.89.1
|
|
C* 127.0.0.0/8 lo
|
|
C* 203.181.89.240/28 eth0
|
|
@end group
|
|
@end example
|
|
@end deffn
|
|
|
|
@deffn Command {show ipv6 route} {}
|
|
@end deffn
|
|
|
|
@deffn Command {show interface} {}
|
|
@end deffn
|
|
|
|
@deffn Command {show ip prefix-list [@var{name}]} {}
|
|
@end deffn
|
|
|
|
@deffn Command {show route-map [@var{name}]} {}
|
|
@end deffn
|
|
|
|
@deffn Command {show ip protocol} {}
|
|
@end deffn
|
|
|
|
@deffn Command {show ipforward} {}
|
|
Display whether the host's IP forwarding function is enabled or not.
|
|
Almost any UNIX kernel can be configured with IP forwarding disabled.
|
|
If so, the box can't work as a router.
|
|
@end deffn
|
|
|
|
@deffn Command {show ipv6forward} {}
|
|
Display whether the host's IP v6 forwarding is enabled or not.
|
|
@end deffn
|