Note : All these command are executed on Command Prompt
View the IP routing table:
route print
Add a static IP route:
route add destination mask subnetmask gateway metric costmetric if interface
. . . . ..
. . . .
. . . ....................
. . .
. . .........................................
. .
. .........................................................
.
.................................................................................
destination : Specifies either an IP address or host name for the network or host.
subnetmask : Specifies a subnet mask to be associated with this route entry. If subnetmask is not specified, 255.255.255.255 is used.
gatway : Specifies either an IP address or host name for the gateway or router to use when forwarding.
costmetric : Assigns an integer cost metric (ranging from 1 through 9,999) to be used in calculating the fastest, most reliable, and/or least expensive routes. If costmetric is not specified, 1 is used.
interface : Specifies the interface to be used for the route that uses the interface number. If an interface is not specified, the interface to be used for the route is determined from the gateway IP address.
Remove a static route:
route delete destination
.
...... specifies either an IP address or network name for the remote TCP/IP host computer or network.
Examples:
Double NIC--- one is wireless which can connect to intenet and another is wired which connect to another local area network
route print
# you may see tow destination like 0.0.0.0 which is the default router nomally the computer can choose the one whos metric is smaller to your destination(like www.google.com or 138.138.1.48) but you can assign it exactly by follow bat script.
@echo off
rem filename : setRoute.bat
rem author : bydgod
rem date : 20100705
rem version : v0.0
rem remove the two default route
route delete 0.0.0.0
rem add a default route which connect to the internet (wireless NIC)
route add 0.0.0.0 mask 0.0.0.0 172.172.0.254
rem add a route to one IP(IP like 172.172.0.100 for example ) in your local area network (wired NIC) gateway is 192.168.1.1
route add 172.172.0.100 mask 255.255.255.255 192.168.1.1
cls & echo route set suc:-)
echo. & pause