Windows系统CMD命令行添加或删除路由
原文地址:https://www.cnblogs.com/dianchaozhang/p/16985395.html
1,按Win键 输入“CMD”,右键“以管理员身份运行”
2,在CMD窗口输入“ipconfig”并按Enter键
3,找到自己的网卡对应的“默认网关”,执行如下命令添加路由:
route add {网段} mask {子网掩码} {网关} –p
例如图中有线网络“以太网2”的默认网关是 “172.18.60.1”,想让 172开头的请求都走这个网卡,则可以输入如下命令来实现:
route add 172.0.0.0 mask 255.0.0.0 172.18.60.1 –p
其中变量 {子网掩码} 255.0.0.0 不能照抄 “以太网2” 的子网掩码,而是要根据“{网段}” 的值来写,具体的规则是:{网段}中不为零的则填255,为0的则填0,
例如:
{网段} 172 .0 .0 .0 172 .18 .88 .12
{子网掩码} 255 .0 .0 .0 255 .255 .255 .255
4,以下是几条示例命令:
route add 172.0.0.0 mask 255.0.0.0 172.18.60.1 -p
route add 172.18.88.12 mask 255.255.255.255 172.24.130.1 -p
route add 0.0.0.0 mask 0.0.0.0 172.24.130.1 -p
5,如果需要删除路由,执行:
route delete {网段} mask {子网掩码} {网关}
例如:
route delete 172.0.0.0 mask 255.0.0.0 172.18.60.1
route delete 172.18.88.12 mask 255.255.255.255 172.24.130.1
route delete 0.0.0.0 mask 0.0.0.0 172.24.130.1
标签:网段,Windows,0.0,route,CMD,mask,172.18,路由,255 From: https://www.cnblogs.com/leavind/p/17829973.html