如何 在windows添加一条静态路由

如何 在windows添加一条静态路由

1、添加一条路由表
Route add 60.232.142.40 mask 255.255.255.248 192.168.100.250 metric3 if 2
添加一条路由记录,所有到60.232.142.40/29网段的数据包,都通过2号接口卡(网卡)走192.168.100.250的网关,优先级为3。(结果会怎样?)
Route add –p 60.232.142.40 mask 255.255.255.248 192.168.100.250metric 3 if 2
作用同上,只是这是一条长久路由,不会因为重启机器而丢失。

2、删除一条路由表
Route delete 60.232.142.40
请留心:如果有两条路由记录有着相同的“目的网络号”,则会将两条记录同时删除。如果只想删除其中某一条的话,请在删除后用routeadd命令再添加上其中一条。
From:http://whatislinux.net/how-to-add-a-static-ip-route-in-windows

3、修改一条路由记录
Route change 157.0.0.0 mask 255.0.0.0 157.55.80.5 metric 2 if2
Change参数只能修改“网关”和“跳数”

 

 

linux添加路由

路由, linux

linux路由的添加对于我们来说很重要,有的时候网络不通,也许就是你路由没加,发出来,希望对大家有所帮助!

服务器ip(eth0)
[root@localhost net]# ifconfig
eth0    Linkencap:Ethernet   HWaddr00:0C:29:E3:9A:15  
     inetaddr:172.18.3.205  Bcast:172.18.3.255  Mask:255.255.255.0
     inet6 addr:fe80::20c:29ff:fee3:9a15/64 Scope:Link
     UP BROADCAST RUNNINGMULTICAST  MTU:1500   Metric:1
     RX packets:4776 errors:0dropped:0 overruns:0 frame:0
     TX packets:3348 errors:0dropped:0 overruns:0 carrier:0
     collisions:0txqueuelen:1000
     RX bytes:439384 (429.0KiB)   TX bytes:390425 (381.2KiB)
     Interrupt:11 Baseaddress:0x1400
lo       Linkencap:Local Loopback  
     inetaddr:127.0.0.1  Mask:255.0.0.0
     inet6 addr: ::1/128Scope:Host
     UP LOOPBACKRUNNING  MTU:16436   Metric:1
     RX packets:254 errors:0dropped:0 overruns:0 frame:0
     TX packets:254 errors:0dropped:0 overruns:0 carrier:0
     collisions:0txqueuelen:0
     RX bytes:22128 (21.6KiB)   TX bytes:22128 (21.6KiB)
  
  
查看原始路由信息
[root@localhost net]# route -n
Kernel IP routing table
Destination    Gateway      Genmask     Flags Metric Ref UseIface
172.18.3.0    0.0.0.0     255.255.255.0 U    0   0      0 eth0
169.254.0.0    0.0.0.0      255.255.0.0    U    0   0      0 eth0
==========================================================
  
  
  
添加默认网关
[root@localhost net]# route add default gw 172.18.3.50
[root@localhost net]# route
Kernel IP routing table
Destination    Gateway      Genmask     Flags Metric Ref UseIface
172.18.3.0    *         255.255.255.0 U    0   0      0 eth0
169.254.0.0    *          255.255.0.0    U    0   0      0 eth0
default      172.18.3.50    0.0.0.0     UG 0   0      0 eth0
=======================================================
  
  
添加一个ip(eth0:1)
[root@localhost net]# ifconfig eth0:1 192.168.168.119 netmask255.255.255.0 up
[root@localhost net]# ifconfig
eth0    Linkencap:Ethernet   HWaddr00:0C:29:E3:9A:15  
     inetaddr:172.18.3.205  Bcast:172.18.3.255  Mask:255.255.255.0
     inet6 addr:fe80::20c:29ff:fee3:9a15/64 Scope:Link
     UP BROADCAST RUNNINGMULTICAST  MTU:1500   Metric:1
     RX packets:5071 errors:0dropped:0 overruns:0 frame:0
     TX packets:3569 errors:0dropped:0 overruns:0 carrier:0
     collisions:0txqueuelen:1000
     RX bytes:466532 (455.5KiB)   TX bytes:416538 (406.7KiB)
     Interrupt:11 Baseaddress:0x1400
eth0:1 Link encap:Ethernet  HWaddr 00:0C:29:E3:9A:15  
     inetaddr:192.168.168.119  Bcast:192.168.168.255  Mask:255.255.255.0
     UP BROADCAST RUNNINGMULTICAST  MTU:1500   Metric:1
     Interrupt:11 Baseaddress:0x1400
lo       Linkencap:Local Loopback  
     inetaddr:127.0.0.1  Mask:255.0.0.0
     inet6 addr: ::1/128Scope:Host
     UP LOOPBACKRUNNING  MTU:16436   Metric:1
     RX packets:258 errors:0dropped:0 overruns:0 frame:0
     TX packets:258 errors:0dropped:0 overruns:0 carrier:0
     collisions:0txqueuelen:0
     RX bytes:22480 (21.9KiB)   TX bytes:22480 (21.9KiB)
  
在查看路由信息
[root@localhost net]# route -n
Kernel IP routing table
Destination    Gateway      Genmask     Flags Metric Ref UseIface
172.18.3.0    0.0.0.0     255.255.255.0 U    0   0      0 eth0
192.168.168.0 0.0.0.0      255.255.255.0 U    0   0      0 eth0
169.254.0.0    0.0.0.0      255.255.0.0    U    0   0      0 eth0
0.0.0.0      172.18.3.50    0.0.0.0     UG 0   0      0 eth0
===============================================================
  
  
添加一条到主机192.168.168.110的路由(通过eth0:1)
[root@localhost net]# route add-host   192.168.168.110 deveth0:1
[root@localhost net]# route
Kernel IP routing table
Destination    Gateway      Genmask     Flags Metric Ref UseIface
192.168.168.110 *          255.255.255.255 UH 0   0      0 eth0
172.18.3.0    *         255.255.255.0 U    0   0      0 eth0
192.168.168.0 *          255.255.255.0 U    0   0      0 eth0
169.254.0.0    *          255.255.0.0    U    0   0      0 eth0
default      172.18.3.50    0.0.0.0     UG 0   0      0 eth0
===============================================================
  
  
添加一条到主机192.168.168.120的路由(通过ip192.168.168.119)
[root@localhost net]# route add -host 192.168.168.120 gw192.168.168.119
[root@localhost net]# route
Kernel IP routing table
Destination    Gateway      Genmask     Flags Metric Ref UseIface
192.168.168.120 192.168.168.119 255.255.255.255 UGH 0   0      0 eth0
192.168.168.110 *   &nb

sp;      255.255.255.255 UH 0   0      0 eth0
172.18.3.0    *         255.255.255.0 U    0   0      0 eth0
192.168.168.0 *          255.255.255.0 U    0   0      0 eth0
169.254.0.0    *          255.255.0.0    U    0   0      0 eth0
default      172.18.3.50    0.0.0.0     UG 0   0      0 eth0
===========================================================
添加到网络的路由(通过eth0)
[root@localhost net]# route add -net 192.168.3.0 netmask255.255.255.0 dev eth0
[root@localhost net]# route
Kernel IP routing table
Destination    Gateway      Genmask     Flags Metric Ref UseIface
192.168.168.120 192.168.168.119 255.255.255.255 UGH 0   0      0 eth0
192.168.168.110 *          255.255.255.255 UH 0   0      0 eth0
192.168.3.0    *          255.255.255.0 U    0   0      0 eth0
172.18.3.0    *         255.255.255.0 U    0   0      0 eth0
192.168.168.0 *          255.255.255.0 U    0   0      0 eth0
169.254.0.0    *          255.255.0.0    U    0   0      0 eth0
default      172.18.3.50    0.0.0.0     UG 0   0      0 eth0
  
添加到网络的路由(通过ip172.18.3.50)
[root@localhost net]# route add -net 192.168.4.0 netmask255.255.255.0 gw 172.18.3.50
[root@localhost net]# route
Kernel IP routing table
Destination    Gateway      Genmask     Flags Metric Ref UseIface
192.168.168.120 192.168.168.119 255.255.255.255 UGH 0   0      0 eth0
192.168.168.110 *          255.255.255.255 UH 0   0      0 eth0
192.168.4.0    172.18.3.50    255.255.255.0 UG 0    0      0 eth0
192.168.3.0    *          255.255.255.0 U    0   0      0 eth0
172.18.3.0    *         255.255.255.0 U    0   0      0 eth0
192.168.168.0 *          255.255.255.0 U    0   0      0 eth0
169.254.0.0    *          255.255.0.0    U    0   0      0 eth0
default      172.18.3.50    0.0.0.0     UG 0   0      0 eth0
=======================================================================
参数区别-host跟主机ip,-net跟网络号
=======================================================================
  
输出结果中各个字段的含义是:
  
Destination表示路由的目标IP地址
Gateway表示网关使用的主机名或者是IP地址。上面输出的"*"表示没有网关
Genmask表示路由的网络掩码
Flags是表示路由的标志。可用的标志及其意义是:U表示路由在启动,H表示target是一台主机,G表示使用网关,R表示对动态路由进行复位设置;D表示动态安装路由,M表示修改路由,!表示拒绝路由。
Metric表示路由的单位开销量
Ref表示依赖本路由现状的其它路由数目
Use表示路由表条目被使用的数目
Iface表示路由所发送的包的目的网络

本文来自思进网www.52sijin.com 转载请注明出处!

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值