route management

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

 

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值