10.8. Managing Routes
You want to view the routing table on a server or possibly configure static routes. Configuring static routes generally isn't needed with today's networks, but it can be necessary especially when working in restricted lab environments that are not fully routed.
Using a command-line interface
The following command displays all the static and dynamic routes on a system:
> route print
For a good overview of what each column represents in the route print output, see MS KB 140859.
This command only shows routes that start with 64:
> route print 64.*
To add a temporary route (one that is erased after the system reboots), use this command:
> route ADD
> route ADD 188.8.131.52 MASK 255.0.0.0 184.108.40.206 METRIC 3 IF 2
To add a permanent route, use the same command as before
except include the
-p switch. To
delete a route, use this command:
> route DELETE
> route DELETE 220.127.116.11
' This code prints similar information to the "route print" command. ' Since the Win32_IP4RouteTable class was first introduced in ' Windows Server 2003, this script does not work against a ' Windows 2000 server. ' ------ SCRIPT CONFIGURATION ------ strComputer = "." ' ------ END CONFIGURATION --------- set objWMI = GetObject("winmgmts:\\" & strComputer & "\root\cimv2") set colRoutes = objWMI.InstancesOf("Win32_IP4RouteTable") for each objRoute in colRoutes set colNetworkAdapters ...