php editor Baicao will introduce you in detail how to add temporary routes and permanent routes in Windows systems. In network configuration, routing settings are a very important part, which can help us realize network data transmission and access control. In Windows systems, we can add temporary routes and permanent routes through the command line or graphical interface to meet different network needs. Next, let’s learn how to do it!
1. Use the route command to add temporary routes
1、查看自己电脑IP地址(记录子网掩码和默认网关) 例:子网掩码:255.255.255.0 默认网关:192.168.50.1 2、将需要添加路由的地址套入该命令中 route add -p IP地址 mask 子网掩码 默认网关 例:route add -p 192.168.50.0 mask 255.255.255.0 192.168.50.13、以管理员身份运行CMD命令
2. Use the route command to add Permanent routing
仿照以上步骤,临时路由命令中去掉“-P”,永久路由命令中保留“-P”例:route add 192.168.50.0 mask 255.255.255.0 192.168.50.1
3. Use the route command to delete the route
仿照以上步骤,命令为route delete 192.168.50.0 mask 255.255.255.0 192.168.50.1
4. Add static routing
First, enter "cmd" in the taskbar search box, then right-click "Command Prompt" in the options that appear, and select "Run as administrator".
In the command prompt window that opens, use the command in the following format to add a static route:
For example, if the target network IP that needs to be added is 192.168 .1.0, the subnet mask is 255.255.255.0, and the gateway is 192.168.0.1, the command you need to enter is:
If you need a permanent static route, you need to add " after the above command -p" parameter, for example:
Note: These values need to be replaced according to your actual network environment.
After entering the command, press the "Enter" key. If no error message appears, the static route was added successfully.
5. Query the routing table
You can query the routing table information through the command route print
C:\Users\Administrator>route print===========================================================================接口列表 11...00 ff a5 91 f3 9f ......Array Networks TAP-Windows Adapter 5...04 d9 f5 21 63 a2 ......Realtek PCIe GBE Family Controller 4...00 50 56 c0 00 01 ......VMware Virtual Ethernet Adapter for VMnet1 6...00 50 56 c0 00 08 ......VMware Virtual Ethernet Adapter for VMnet8 1...........................Software Loopback Interface 1===========================================================================IPv4 路由表===========================================================================活动路由:网络目标 网络掩码 网关 接口 跃点数 0.0.0.0 0.0.0.0 192.168.188.2 192.168.188.12 291 0.0.0.0 0.0.0.0 192.168.1.1 192.168.1.8 35 127.0.0.0 255.0.0.0 在链路上 127.0.0.1 331 127.0.0.1 255.255.255.255 在链路上 127.0.0.1 331 127.255.255.255 255.255.255.255 在链路上 127.0.0.1 331
The above is the detailed content of How to add temporary and permanent routes in Windows. For more information, please follow other related articles on the PHP Chinese website!