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

1、添加一条路由表
Route add 60.232.142.40 mask 255.255.255.248 192.168.100.250 metric 3 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.250 metric 3 if 2
作用同上,只是这是一条长久路由,不会因为重启机器而丢失。

2、删除一条路由表
Route delete 60.232.142.40
请留心:如果有两条路由记录有着相同的“目的网络号”,则会将两条记录同时删除。如果只想删除其中某一条的话,请在删除后用route add命令再添加上其中一条。
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 if 2
Change参数只能修改“网关”和“跳数”

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

服务器ip(eth0)
[root@localhost net]# ifconfig
eth0 Link encap:Ethernet HWaddr 00:0C:29:E3:9A:15
inet addr: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 RUNNING MULTICAST MTU:1500 Metric:1
RX packets:4776 errors:0 dropped:0 overruns:0 frame:0
TX packets:3348 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:439384 (429.0 KiB) TX bytes:390425 (381.2 KiB)
Interrupt:11 Base address:0x1400
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:254 errors:0 dropped:0 overruns:0 frame:0
TX packets:254 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:22128 (21.6 KiB) TX bytes:22128 (21.6 KiB)

查看原始路由信息
[root@localhost net]# route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
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 Use Iface
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 netmask 255.255.255.0 up
[root@localhost net]# ifconfig
eth0 Link encap:Ethernet HWaddr 00:0C:29:E3:9A:15
inet addr: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 RUNNING MULTICAST MTU:1500 Metric:1
RX packets:5071 errors:0 dropped:0 overruns:0 frame:0
TX packets:3569 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:466532 (455.5 KiB) TX bytes:416538 (406.7 KiB)
Interrupt:11 Base address:0x1400
eth0:1 Link encap:Ethernet HWaddr 00:0C:29:E3:9A:15
inet addr:192.168.168.119 Bcast:192.168.168.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
Interrupt:11 Base address:0x1400
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:258 errors:0 dropped:0 overruns:0 frame:0
TX packets:258 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:22480 (21.9 KiB) TX bytes:22480 (21.9 KiB)

在查看路由信息
[root@localhost net]# route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
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 dev eth0:1
[root@localhost net]# route
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
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 gw 192.168.168.119
[root@localhost net]# route
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
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 netmask 255.255.255.0 dev eth0
[root@localhost net]# route
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
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 netmask 255.255.255.0 gw 172.18.3.50
[root@localhost net]# route
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
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表示路由所发送的包的目的网络

转载于:https://blog.51cto.com/nba20717zcx/462510

Windows/Linux中手动添加路由相关推荐

  1. Linux中命令添加路由

    第一种 #route add -net 192.168.1.0 netmask 255.255.255.0 gw 192.168.1.254 dev eth0/* 增加一条网络192.168.1.0/ ...

  2. Linux中增加软路由的两种方法

    Linux中增加软路由的两种方法 第一种: route add -net 172.16.6.0 netmask 255.255.255.0 gw 172.16.2.254 dev eth0 /* 增加 ...

  3. linux中ftp用户,linux中怎么添加ftp用户

    Linux下创建用户是很easy的事情了,只不过不经常去做这些操作,时间久了就容易忘记.那么linux中怎么添加ftp用户,下面跟着学习啦小编一起来了解一下吧. linux中怎么添加ftp用户 在li ...

  4. Windows XP中手动安装驱动程序的方法

    Windows XP中手动安装驱动程序的方法 参考网址:https://jingyan.baidu.com/article/cdddd41c44cb1b53ca00e15f.html 今天小编教大家如 ...

  5. linux在目录前加前缀,linux中批量添加文件前缀的操作方法

    需要在文件夹内所有txt文件的文件名前面添加"gt_"; 就是由原来的文件"xxx.txt"变成"gt_xxx.txt": 网上搜来的脚本如 ...

  6. linux批量在文件名前面加前缀,linux中批量添加文件前缀的操作

    linux中批量添加文件前缀的操作 需要在文件夹内所有txt文件的文件名前面添加"gt_"; 就是由原来的文件"xxx.txt"变成"gt_xxx.t ...

  7. linux服务器怎么添加路由,linux系统中添加路由的方法

    linux系统中添加路由的方法 发布时间:2020-06-17 11:38:59 来源:亿速云 阅读:95 作者:Leah 这篇文章将为大家详细讲解有关linux系统中添加路由的方法,小编觉得挺实用的 ...

  8. linux中把路由添加到开机,Linux中增加软路由的方法介绍

    第一种:route add -net 172.16.6.0 netmask 255.255.255.0 gw 172.16.2.254 dev eth0route del gw 172.16.2.25 ...

  9. Linux中增加软路由的两种方法,Linux中增加软路由的三种方法

    # route add –net IP netmask MASK eth0 # route add –net IP netmask MASK gw IP # route add –net IP/24 ...

最新文章

  1. GDUT1169:Krito的讨伐(树 + 优先队列)
  2. 标准粒子群算法(PSO)及其Matlab程序和常见改进算法
  3. 如何使用 ClickHouse 每天玩转千亿数据,纯PPT干货
  4. 网站架构相关PPT、文章整理
  5. c++模板显示实例化,显示具体化,隐式实例化
  6. mac上配置mysql与redis server,并结合Pydev准备某爬虫环境
  7. file watchers怎么默认打开_python怎么打印字符
  8. python编程从入门到实战16章x轴刻度_PYTHON编程:从入门到实践之数据可视化
  9. 【渝粤教育】国家开放大学2018年秋季 8181-22T (1)老年保健按摩 参考试题
  10. TTS 语音修复 ,缺少文件的,没注册类的
  11. Java400 道面试题通关宝典助你进大厂,Java 后端工程师需要掌握的知识
  12. python爬取豆瓣电影名称与评分进行分析
  13. 二维otsu算法python_图像二值化与otsu算法介绍
  14. 有意思的atoll函数
  15. 快速排序(填坑法的两种写法以及交换法)
  16. redis持久化底层原理-RDB与AOF
  17. 恢复ubuntu20.04默认桌面管理器
  18. 苹果税要崩溃了!又一国家做出判决:iOS必须开放第三方支付
  19. 2021年电工(初级)考试报名及电工(初级)免费试题
  20. 2022年湖北省企业吸纳就业补贴申请条件及具体奖励标准

热门文章

  1. 3月30日作业:采购管理、信息管理和配置管理
  2. 分布式系统学习资料(ing)
  3. FFmpeg资料来源简单分析:libswscale的sws_getContext()
  4. 碎片化趋势下手机浏览器或成赢家
  5. ASP.NET:页面保存为WORD出现的问题!
  6. Moonlight已经可以下载,目前是0.6版
  7. oracle学习--循环语句
  8. [转贴]Integrating FrontPage and VS .NET
  9. hexo博客修改博文中日期的颜色
  10. 命令行中只用scala来运行一个spark应用