Static route is a pre-determined path that network information must follow to reach a specific host or network.
ADDING A STATIC ROUTE
Sometimes, it is necessary to add a static route.
From TechNet: “During the routing process, the routing decisions of hosts and routers are aided by a database of routes known as the routing table. The routing table is not exclusive to a router. Depending on the routable protocol, hosts may also have a routing table that may be used to decide the best router for the packet to be forwarded. IP hosts have a routing table. IPX hosts do not have a routing table.”
Static routes are simple to manage and configure because they don’t participate in any kind of automatic discovery process. Static routes are very simple – they combine a destination network address with a subnet mask to provide a list of potential destinations.
Also check: UPTIME OF THE SERVER WITH POWERSHELL
This is the basic syntax:
route add DESTINATION-NETWORK mask SUBNET-MASK GATEWAY-IP
route add 192.168.1.0 mask 255.255.255.0 192.168.100.3
route add 192.168.1.0/24 192.168.100.3
This means that if you were on 192.168.100.0 network, and you have a gateway IP of 192.168.100.3 configured to access the 192.168.1.0/24 network, you would use the above to add a static route.
This route add change will be valid only until you reboot the server/client. If you want to add a permanent route, you need to use -p switch:
route add -p 192.168.1.0 mask 255.255.255.0 192.168.100.3
If you run netstat -rn, you’ll see your static route being added