Linux command: route – show or manipulate the IP routing table.
Running route at the command line without any options will display the routing table entries:
Kernel IP routing table Destination Gateway Genmask Flags Metric Ref Use Iface default 192.168.1.2 0.0.0.0 UG 1024 0 0 eth0 192.168.1.0 * 255.255.255.0 U 0 0 0 eth0
This shows how the system is currently configured. If a packet comes into the system and has a destination in the range 192.168.2.0 through 192.168.2.255, then it is forwarded to the gateway *, which is 0.0.0.0 — a special address which represents an invalid or non-existent destination. So, in this case, our system will not route these packets.
If the destination is not in this IP address range, it is forwarded to the default gateway (in this case, 192.168.1.2, and that system will determine how to forward the traffic on to the next step towards its destination.
Windows Route:
Parameter
Purpose
-f
This option clears gateway entries from the routing table. If this option is used with another option, the clearing of gateways from the routing table occurs before any other specified action.
-p
This option can be used with the add command to make a statically configured route persistent, meaning that the route will remain in a PC’s routing table even after a reboot.
command
Supported commands include print, add, delete, and change. The print option lists entries in a PC’s routing table. The add option adds a route entry. The delete option removes a route from the routing table, while the change option can modify an existing route.
destination
This option specifies the destination host or subnet to add to a PC’s routing table.
mask netmask
This option, used in conjunction with the destination option, specifies the subnet mask of the destination. If the destination is the IP address of a host, the netmask parameter is 255.255.255.255.
gateway
This option specifies the IP address of the next-hop router used to reach the specified destination.
metric metric
This option specifies the cost to reach a specified destination. If a routing table contains more than one route to reach the destination, the route with the lowest cost is selected.
if interface
If you want to forward traffic to a specified destination out of a specific interface, use this option.