Generally, your computer will have a default gateway and all the packets are sent through default gateway when no other routes to the destination are known.
But did you know what each computer have a local routing tables which allow your to perform routing from the computer itself instead of doing routing at router. The routing table is used by TCP/IP to make decisions on whether to send the packet to a computer on the same segment, or to forward it to the default gateway.
To add a route we use the route ADD command to tell Windows which Network to add and then we enter the Subnet mask and Gateway.
For example, we’re on the 22.214.171.124 network and the default gateway is 126.96.36.199 and we want to add static route to our management server 10.10.8.28
Show routing tables
Usage of Windows route command
|ROUTE [-fp] [command [destination] [MASK netmask] [gateway]]|
|-f||Clears the routing tables of all gateway entries. If this is used in conjunction with one of the commands, the tables are cleared prior to running the command.|
|-p||When used with the ADD command, makes a route persistent across boots of the system. By default, routes are not preserved when the system is restarted. When used with the PRINT command, displays the list of registered persistent routes. Ignored for all other commands, which always affect the appropriate persistent routes.|
|command||Specifies one of four commands:
PRINT Prints a route ADD Adds a route
DELETE Deletes a route
CHANGE Modifies an existing route
|destination||Specifies the host to send command.|
|MASK||If the MASK keyword is present, the next parameter is interpreted as the netmask parameter.|
|netmask||If provided, specifies a sub-net mask value to be associated with this route entry. If not specified, if defaults to 255.255.255.255.|