You can use per-route metrics to associate some properties with IPv4 and IPv6 routing table entries.
For example, a system has two different network interfaces, a fast Ethernet interface and a gigabit Ethernet interface. The system default recv_maxbuf is 128,000 bytes. This default is sufficient for the fast Ethernet interface, but may not be sufficient for the gigabit Ethernet interface.
Instead of increasing the system's default for recv_maxbuf, you can associate a different default TCP receive window size to the gigabit Ethernet interface routing entry. By making this association, all TCP connections going through the route will have the increased receive window size.
For example, the following is in the routing table (netstat -rn), assuming IPv4:
Routing Table: IPv4 Destination Gateway Flags Ref Use Interface -------------------- ----------------- ------- ------- ------- --------- 192.0.2.0/27 192.0.2.4/27 U 1 4 net0 192.0.2.32/27 192.0.2.36/27 U 1 4 net1 default 192.0.2.1/27 UG 1 8
In this example, do the following:
# route change -net 192.0.2.32/27 -recvpipe x
Then, all connections going to the 192.0.2.32/27 network, which is on the net1 link, use the receive buffer size buff-size, instead of the default 128,000 receive window size.
If the destination is in the a.b.c.d network, and no specific routing entry exists for that network, you can add a prefix route to that network and change the metric. For example:
# route add -net a.b.c.d 192.0.2.1/27 -netmask a.b.c.d-netmask # route change -net a.b.c.d -recvpipe buff-size
Note that the prefix route's gateway is the default router. Then, all connections going to that network use the receive buffer size y. If you have more than one interface, use the –ifp argument to specify which interface to use. This way, you can control which interface to use for specific destinations. To verify the metric, use the route get command.