Take Linux Routing to the Next Level with iproute2 - Page 2
Routing with Linux: You may like your trusty old routing utilities, but stepping up to iproute2 may make your life easier. Here's how.
Display ARP Table
$ ip neigh show
192.168.1.1 dev eth0 lladdr 00:60:97:99:3f:21 nud reachable
192.168.1.10 dev eth0 lladdr 00:0a:e4:40:8b:fd nud stale
"nud" means "Neighbour Unreachability Detection." The first line of output tells you the IP, interface, and hardware (MAC) address, and that the host is up and reachable. On the second line "nud stale" means the host has not been contacted recently and the entry is ready to time out. Typically an entry in the cache has a lifetime of about 15 minutes. To refresh the ARP table entry simply ping the host.
Building A Router
To do actual routing requires that certain features are enabled in the kernel. All you need for basic routing is
CONFIG_NETLINK_DEV=m
This sample from /boot/config-2.6.8file shows a complete routing feature set enabled. This shows every routing-related option available:
# Networking options
#
CONFIG_PACKET=m
CONFIG_PACKET_MMAP=y
CONFIG_NETLINK_DEV=m
CONFIG_UNIX=m
CONFIG_NET_KEY=m
CONFIG_INET=y
CONFIG_IP_MULTICAST=y
CONFIG_IP_ADVANCED_ROUTER=y
CONFIG_IP_MULTIPLE_TABLES=y
CONFIG_IP_ROUTE_FWMARK=y
CONFIG_IP_ROUTE_NAT=y
CONFIG_IP_ROUTE_MULTIPATH=y
CONFIG_IP_ROUTE_TOS=y
CONFIG_IP_ROUTE_VERBOSE=y
# CONFIG_IP_PNP is not set
CONFIG_NET_IPIP=m
CONFIG_NET_IPGRE=m
CONFIG_NET_IPGRE_BROADCAST=y
CONFIG_IP_MROUTE=y
CONFIG_IP_PIMSM_V1=y
CONFIG_IP_PIMSM_V2=y
# CONFIG_ARPD is not set
CONFIG_SYN_COOKIES=y
CONFIG_INET_AH=m
CONFIG_INET_ESP=m
CONFIG_INET_IPCOMP=m
IP_PNP is for diskless terminals, and ARPD is obsolete and should not be used.
See how easy iproute2 is? You don't need to spend gobs of money on some expensive commercial thingy. Come back next week to learn how to build both static and dynamic routes.
Resources
- the Linux Advanced Routing & Traffic Control HOWTO
- See man (8) ip for complete ip command options and definitions of terms shown in the command outputs
- RFC 1123 - Requirements for Internet Hosts
- RFC 1812 - Requirements for IP Version 4 Routers
- A Spoonful Of CIDR Helps the Routing Tables Go Down
- IPCalc, for calculating IP addresses