Sunday, 9 June 2013

Two Noticeable Routing Changes

Technote (FAQ)

Two Noticeable Routing Changes

Answer

Two new types of routes were added to the routing table - loopback routes and broadcast routes. These are added to the system automatically when an interface is configured.
  • Loopback routes
  • Broadcast routes

Loopback routes

Loopback routes were added for each IP address that is configured on the system. You will see a route with a UGHS flag that is automatically added to your routing table.
Example:
#netstat -rn
Destination      Gateway           Flags   Refs     Use  If   PMTU Exp Groups
Route Tree for Protocol Family 2 (Internet):
default          9.3.58.1          UGc       0        0  en4     -   -   
9.3.58.0         9.3.58.5          UHSb      0        0  en4     -   - 
9.3.58.255       9.3.58.5          UHSb      0        0  en4     -   -
9.3.58/24        9.3.58.5          U         2    13360  en4     -   -
9.3.58.5         127.0.0.1         UGHS      2       44  lo0     -   -
127/8            127.0.0.1         U         6     3262  lo0     -   -
The first column (destination address) is your own IP address. The second column (gateway address) will always be 127.0.0.1 (the loopback address). The interface column will always be lo0. The S flag is set to indicate that these are static routes added by the system.

The purpose of the loopback routes is to avoid checking each outgoing packet to determine whether it is being sent to one of your own addresses. With these routes in place, the loopback interface, lo0, will automatically be chosen for all packets sent to your own address. Also, the MTU of the loopback interface, which is typically higher than the MTU of many network interfaces, will be used.

Broadcast routes

For each subnet that the system has an IP address on, two broadcast routes will be added to the system. One to the subnet address and one to the broadcast address of the subnet.
Example:
#netstat -rn
Destination      Gateway           Flags   Refs     Use  If   PMTU Exp Groups
Route Tree for Protocol Family 2 (Internet):
default          9.3.58.1          UGc       0        0  en4     -   -   
9.3.58.0         9.3.58.5          UHSb      0        0  en4     -   - 
9.3.58.255       9.3.58.5          UHSb      0        0  en4     -   -
9.3.58/24        9.3.58.5          U         2    13360  en4     -   -
9.3.58.5         127.0.0.1         UGHS      2       44  lo0     -   -
In the destination column (first column), notice the 9.3.58.0 (network address) and a 9.3.58.255 (broadcast address). The gateway column (second column) for these routes will always contain your own IP address and the interface column will contain the name of the interface the address is configured on. The b flag is set on these routes to indicate that they are broadcast routes.

The purpose of these routes is to avoid checking each outgoing packet to determine whether it is a broadcast packet. With these routes in place, they can be looked up once per connection and then cached so it is not necessary to check on a per-packet basis. This improves routing performance.

0 blogger-disqus:

Post a comment