 search for a matching network address
- search for a default entry (usually specifed as a network entry with a network ID of 0)
IP performs the routing mechanisism (searching the routing table to decide which interface to send a packet out) while routing policy is set by a routing daemon.
netstat -rn // -r displays the routing table, -n prints IP addresses in numeric format not names.
u the route is up.
g the route is a gateway(route). if not set, the destination is directly connected.
h the route is to a host - the destination is a complete host. If not set, the destination is to a network and the destination is a network address.
d the route was created by ICMP redirect.
m the route was modified by ICMP redirect.
Use displays the number of packets sent through that route.
lo0 is the loopback interface.
Whenever an interface is initialised a direct route is automatically created for that interface. Routes to hosts or networks must be entered into the routing table. The
route command may be executed from initialisation files at system boot.
route add <destination> <gateway/router> 1 // final argument is routing metric: if 0 set without g flag, if greater than 0 set with g flag.
Routing tables are also initialised by running routing daemon or via routing discovery protocol.
The ICMP "host unreachable" error message is sent by a router when it receives an IP datagram that it cannot deliver or forward.
Hosts are not supposed to forward IP datagrams unless they have been specifically configured as a router. On unix systems this is via the
ipforwarding kernal variable.
ICMP redirect errors allow a host with minimal routing knowledge to build up a better routing table over time.
Chapter 10: Dynamic Routing Protocols
There are two basic types of routing protocols: Interior Gateway Protocols (IGPs), for routers within an autonomous system, and Exterior Gateway Protocols (EGPs), for routers to communicate with routers in other autonomous systems.
Dynamic Routing Protocols are used by routers to communicate with each other. The most common is the Routing Information Protocol (RIP). The process running the routing protocol is called a routing daemon.
Dynamic routing occurs when routers talk to adjacent routers, informing each other of what networks each router is currently connected to.
Many different routing protocols are used on the internet. The internet is organized into a collection of autonomous systems (ASs), each of which is normally administered by a single entity. A corporation or university campus often defines an autonomous system.
The unix routing daemon is usually
routed. This daemon uses RIP exclusively and is intended for small to medium sized networks. An alternative is
gated which supports IGPs and EGPs.
RIP is usually UDP port 520.
ripquery can be used to query routers for their routing table.
Open Shortest Path First: OSPF is a newer alternative to RIP as an interior gateway protocol. It overcomes all the limitations of RIP.
Border Gateway Protocol: BGP is an exterior gateway protocol for communication between routers in different autonomous systems.
Chapter 11: User Datagram Protocol (UDP)
UDP is a simple, datagram-oriented, transport layer protocol: each output operation by a process produces exactly one UDP datagram, which causes one IP datagram to be sent.
This is different from a stream-oriented protocol such as TCP where the amount of data written by an application may have little relationship to what actually gets sent in a single IP datagram.
UDP provides no reliability: it sends the datagrams that the application writes to the IP layer, but there is no guarantee that they ever reach their destination.
The application needs to worry about the size of the resulting IP datagram. If it exceeds the network's MTU (path MTU) the IP datagram is fragmented.
The UDP checksum covers the UDP header and the UDP data. The checksum is optional in UDP (not TCP).
If the sender did compute a checksum and the receiver detects a checksum error, the UDP datagram is silently discarded. no error message is generated. (This i