technology-note/网络/2.route命令实现内外网同时使用.md
2019-04-12 14:34:01 +08:00

18 lines
724 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
id: "2019-04-12"
date: 2019/04/12 10:58:00
title: "windows下实现内外网同时在线"
tags: ["windows","route","内外网"]
categories:
- "网络相关"
---
  通常会有这样的需求--公司内网在一个网段外网在一个网段如何实现在一台机器上同时访问呢通过route命令就能做到。
  需要两张网卡一个连外网一个连内网。这里假设内网网段是192.168.0.0内网网关为192.168.1.2,只需如下命令即可让192.168.*.*的访问全部走内网:
```bash
route add -p 192.168.0.0 mask 255.255.0.0 192.168.1.2
```
-p 永久保存,重启不失效
这样就能让指定的IP使用指定的网卡上网。