CMD command: Route
subcommand 1:route Print View routing table
Child command 2:route add static route
subcommand 3:route Delete static routes
View
Use subcommand 1 results as shown below
(Note: Red box for dynamic routing [by System management, no need for manual management], green box for static route [can be added or deleted by artificial freedom])
You can see that the routing table consists of the following parts: Network address, network mask, gateway address, metric, here we are mainly concerned about the network address and gateway address, refers to the local access to the target IP use of the gateway (that is, the network card), so we need to configure the XXX address using the XXX gateway can achieve our purpose.
For example: 192.168.1.0 => 192.168.1.1, 0.0.0.0 =>192.168.0.1
The above example refers to the use of a gateway-192.168.1.1 NIC when accessing a 192.168.1.x network, using a gateway-192.168.0.1 NIC when accessing other networks (x.x.x.x). It is worth noting that 0 represents any number, so 0.0.0.0 represents any IP. The subnet mask is a regional molecular network, that is, the IP phase is different when the subnet mask is not the same.
Add to
Using Command 2
Route Add-p Network Address mask Subnet Mask gateway address
You can add a route that you add to your path in a permanent route (also known as a static route)
Use the command effect chart as follows:
Delete
Using Command 3
Rotue Delete network Address
You can delete a route
In general, the system will automatically add a static route to all the network address to a gateway (local connection), so we can only connect the LAN network, so we need to use this command to remove the default route.
Practice
1. First use the ipconfig command to view all connected IP and gateway information
From the above figure we can find that my local connection gateway for 192.168.1.1 (intranet), wireless network connection gateway for 192.168.163.254 (extranet)
2. Then we start to operate the route
The above 3 commands are: Delete default route, add external network by, add intranet route
3. Add complete, test the connection situation
Ping Baidu (External network) and the intranet of a machine, ping results connected, done!