FreeBSD 101 : Routing , IP forwarding, Static routes
Routing:

IP forwarding:
Is the ability to move traffic between interfaces (A--B) or (A--C) - (See the diagram above) - that belong to the same machine (router). The system will forward the packets to the appropriate interface according to the machine's routing table.
Because traffic between these interfaces doesn't happen automatically, we will need to enable IP forwarding using the below commands:

To enable the IP forwarding at boot time, we add it to the "/etc/rc.conf" file:
The routing table:
Adding elements to the routing table could be done either automatically or manually.
- Automatic: Routes for the networks that are connected directly will be added to the routing table.
- Manual: we use this method to add the route manually.
- Dynamic: A dynamic routing daemon (e.g. RIP, OSPF, etc) discovers routes from peers over the network and updates the local routing table accordingly.
Adding a gateway:
Adds an entry to the routing table that makes the gateway route packets for the destination 192.162.1.0/24 through the 10.25.1.5 address.
Adding a default gateway:
Any packet that couldn't be routed through the routing table entries go through the default gateway.
Listing the routing tables on a machine:
You can also use netstat –r to see the routing entries in the routing table:
link#N : refer to different network interfaces in the machine.
Static routes:
Comments