When a system using IP receives a network data packet, it uses the routing table, managed using route(1M), to determine where to send the packet. A properly configured routing table helps the system:
Deliver packets locally if they are addressed to the system itself.
Send packets directly if they are addressed to other systems whose IP addresses it knows and with which it has direct connections.
Send other packets to the gateway system that allows communication with the rest of the Internet.
Drop any packets to which the above cases do not apply.
IP forwarding allows the system to forward packets to other systems, such as the gateway. IP forwarding is enabled using the sysctl(1M) command as shown below.
The following example sysadm.ini fragment uses
route to configure the routing table to deliver packets addressed
to the local system (184.108.40.206), and to forward other
packets to the Ethernet:
# # Enable IP forwarding (requires the sysctl.r actor) # arun /bin/sysctl -w IPCTL_FORWARDING=1 # arun /image/sys_bank/sysctl -w IPCTL_FORWARDING=1 # if built into system image # # Deliver packets addressed to the local system # route add -host 220.127.116.11 lo0 # # Send other packets back out to the Ethernet # route add default -interface ifeth0
Note that the first route command is unnecessary if the ChorusOS system IP address is assigned dynamically.
route is also available as a stand-alone actor, /bin/route.r.