XP multi-Nic static route setting method

Source: Internet
Author: User

XP multi-Nic static route setting method

One, multiple IPs are in the same network segment or VALN. There's nothing to say about this, but you can set the IP address, subnet mask, and default gateway in the local connection properties of each NIC.

Two, multiple IPs belong to different network segment or VLAN. At this point, if you set the IP address in the usual way, fill in the subnet mask and default gateway of each network segment, you will find that the server is located in multiple network segments, only one network segment can communicate properly.

I have only recently met this problem. After Google and Baidu, the reason: routing conflicts.

We know that the default gateway for network Connections under Windows system equals a default static route added to the native. Open "Local Area Connection Properties"--"Internet Protocol (TCP/IP) Properties", click "Advanced", you will see the default gateway in the column has a "metric", which is the number of hops (the default is automatic, the value is 20), can be understood as the priority of the gateway, that is, the priority of the route, The higher the path, the higher the priority of this number. For example, assume that your network card 1 IP address is set to address 1 (192.168.1.2, mask 255.255.255.0, default gateway 192.168.1), at this point, open cmd, enter route print, you can see the native routing table. We can see a route with the next-hop address as the default gateway.
The meaning of this route is: as long as the destination address of the package is not in the network segment, regardless of the destination address is what, the packet is thrown to the default gateway, the gateway is responsible for forwarding. Since we have not modified the metric, we can see that metric is 20, that is, the priority of this route is 20.

Similarly, if you plug in another NIC 2,ip address is set to address 2 (172.30.0.2, mask 255.255.255.0, default gateway 172.30.0.1), the system also adds a static route to the native routing table:

0.0.0.0 0.0.0.0 172.30.0.1

Obviously these two routing conflicts, only one will be effective, so there must be only one network segment can communicate properly.

Now that we know the cause is a routing conflict, I'll try not to let it conflict. Add the route manually by not filling out the default gateway. Take the dual network card as an example, you can either not fill in, or can only fill one, in short, the purpose is to set up the route, so that the package is sent to the correct gateway. Let's first delete the default gateways for Nic 1 and 2, and then look at the routing table, where both routes are gone. We then use the route Add command to add the route manually. First add to the 192 segment: For example, when we send packets to other segments in the whole 192.168.0.0 network segment, we need to be forwarded via the Gateway 192.168.1.1 of this network segment, then we enter the following command in CMD:

Route-p Add 192.168.0.0 Mask 255.255.0.0 192.168.1.1 metric 1

Where the-p parameter is the meaning of adding long-acting routes; 192.168.0.0 is the destination address; Mask 255.255.0.0 is the address of the destination; 192.168.1.1 is the next-hop address, the gateway. After adding this route, the 192-segment communication can be performed normally.

The next step is to add 172 segments: For example, when we send packets to other segments in the entire 172.30.0.0 network segment, we need to be forwarded via the Gateway 172.30.0.1 of this network segment, then we enter the following command in CMD:

Route-p Add 172.30.0.0 Mask 255.255.0.0 172.30.0.1 metric 1

After adding this route, the 172-segment communication can be performed normally.

The two routes we have just added indicate routes for packets that are sent to 192 and 172 segments, which are the same as the default gateways, but do not conflict, so two network segments can be simultaneously communicated.

There is another situation, such as: In the above example, the network card 1 is used to connect the intranet, the scope of the intranet is 192.168.0.0 255.255.255.0; NIC 2 172.30.0.1 Sisu network via an extranet router. At this point we manually add the two routes, the first one does not need to change, is still

Route-p Add 192.168.0.0 Mask 255.255.0.0 192.168.1.1 metric 1

Article II needs to be changed to

Route-p Add 0.0.0.0 Mask 0.0.0.0 172.30.0.1 metric 1 is the equivalent of a default gateway for local connection 2.

Although these two routes have conflicting parts, they can still be used together because of the longest matching principle of routing: packets destined for 192 segments, after routing matching found that Route 1 is best for themselves, will not be matched with Route 2, and packets destined for other network segments (extranet) will be forwarded through Route 2.

OK, the above is the multi-NIC routing configuration. The following is the use of routing commands, directly copied over, interested to see it

Detailed route command

1. Specific functions
This command is used to display and modify entries in the local IP routing table. Use a route without parameters to display help.
2. Explanation of grammar
Route [-F] [-p] [command [destination] [mask netmask] [gateway] [metric
Metric] [If interface]
3. Parameter description
-F
Clears all routes that are not the primary (the subnet mask is 255.255.255.255), the loopback network route (target is 127.0.0.0, the subnet mask is 255.255.255.0), or multicast routing ( The route table for the entry of the target is 224.0.0.0, the subnet mask is 240.0.0.0. If it is used in conjunction with one of the commands (for example, add, change, or delete), the table is cleared before the command is run.

-P
When used in conjunction with the Add command, specifies that the route is added to the registry and initializes the IP routing table when the TCP/IP protocol is started. By default, the added route is not saved when the TCP/IP protocol is started, and a permanent route list is displayed when used with the Print command. This parameter is ignored by all other commands. The location where the permanent route is stored in the registry is hkey_local_machsystemcurrentcontrolsetservicestcpipparameterspersistentroutes.

command to specify the commands to run. The following table lists the valid commands.
Destination
Specifies the network destination address of the route. The destination address can be an IP network address (where the host address bit of the network address is set to 0), the IP address for the host route, and 0.0.0.0 for the default route. Mask
SubnetMask
Specifies the netmask (also known as the subnet mask) associated with the network destination address. The subnet mask can be an appropriate subnet mask for the IP network address, which is 255.255.255.255 for host routing
For the default route is 0.0.0.0. If omitted, the subnet mask 255.255.255.255 is used. When defining a route, the destination address cannot be more detailed than its corresponding subnet mask due to the relationship between the destination address and the subnet mask. In other words, if one of the subnet masks is 0, the corresponding bit in the destination address cannot be set to 1.

Gateway
Specifies a previous or next hop IP address that exceeds the attainable set of addresses defined by the network destination and subnet mask. For locally connected subnets, the gateway address is the IP address assigned to the subnet interface. For remote routes to be available through one or more routers, the gateway address is a directly-accessible IP address assigned to the neighboring router.

Metric metric
Specifies the integer value of the required metric for the route (in the range 1~9999), which is used to select the route that most closely matches the destination address in the forwarding packet in multiple routes in the routing table. The selected route has a minimum number of hops. The metric can reflect the number of hops, the speed of the path, path reliability, path throughput, and administrative properties.

The If interface specifies the interface index of the interface to which the target can reach. Using the route
The Print command can display a list of interfaces and their corresponding interface indexes. You can use a decimal or hexadecimal value for an interface index. For hexadecimal values, precede the hexadecimal number with 0x. When the If parameter is ignored, the interface is determined by the gateway address.

Note: The larger value of the metric column in the routing table is due to the fact that TCP/IP is allowed to automatically determine the number of hops in the route table based on the IP address, subnet mask, and default gateway configuration of each LAN interface. The auto-determined interface metric that is started by default determines the speed of each interface, adjusts the number of route hops per interface, so the fastest interface creates a route with the lowest metric. To remove large hops, disable the automatic determination of the interface metric in the advanced properties of the TCP/IP protocol for each LAN connection.

If an appropriate entry exists in the local network file of the Systemrootsystem32driversetc folder, the name can be used for destination. As long as the name can be decomposed into an IP address through a standard hostname resolution technique such as a domain Name System (DNS) query, it can be used for GATEWAY,DNS queries that are stored in SYSTEMROOTSYSTEM32DRIVERSETC
Local host file and NetBIOS name resolution under the folder.
If it is a print or delete command, you can omit the gateway parameter and use wildcards to represent the target and the gateway. The value of the destination can be a wildcard character specified by an asterisk (*). If the specified target contains an asterisk (*) or a question mark (?), it is treated as a wildcard and only prints or deletes the matching destination route. The asterisk represents any one character sequence, and the question mark represents any one character. For example, 10.*.1, 192.168.*, 127.*, and *224* are all valid uses of Asterisk wildcard characters.

Using a combination of invalid target and subnet mask (netmask) values, the Route bad gateway address is displayed
Netmask "error message. This error occurs when one or more bits in the target are set to 1, and the corresponding bit in the subnet mask is set to 0. This can be checked by means of a binary notation for the target and subnet masks. The subnet mask in binary representation includes a series of 1 representing the destination network address portion and a series of 2 parts representing the destination host address portion. View the destination to determine the host address portion of the target (as defined by the subnet mask)

Whether some bits are set to 1.
The route command for Windows 98 does not support the-P parameter.
This command is available only if the TCP/IP protocol is installed as a component of the network adapter properties in a network connection.
4. Example Description
Example 1: To display the full contents of the IP routing table, execute the following command:
Route print
Example 2: To display the route in the IP routing table with the start of 10., execute the following command:
Route print 10.*
Example 3: To add a default route with a default gateway address of 192.168.12.1, execute the following command:
Route add 0.0.0.0 Mask 0.0.0.0 192.168.12.1
Example 4: To add a route with a target of 10.41.0.0, a subnet mask of 255.255.0.0, and the next hop address of 10.27.0.1, execute the following command:
Route add 10.41.0.0 Mask 255.255.0.0 10.27.0.1
Example 5: To add a permanent route with a target of 10.41.0.0, a subnet mask of 255.255.0.0, and the next hop address of 10.27.0.1, execute the following command:
Route-p Add 10.41.0.0 mask 255.255.0.0 10.27.0.1
Example 6: To add a destination of 10.41.0.0, the subnet mask is 255.255.0.0, the next hop address is 10.27.0.1, and the number of hops is 7, execute the following command:
Route add 10.41.0.0 Mask 255.255.0.0 10.27.0.1 metric 7
Example 7: To add a destination of 10.41.0.0, the subnet mask is 255.255.0.0, the next-hop address is 10.27.0.1, the interface is indexed as a 0x3 route, execute the following command:

Route add 10.41.0.0 Mask 255.255.0.0 10.27.0.1 if 0x3
Example 8: To remove a route with the target of 10.41.0.0, subnet mask 255.255.0.0, execute the following command:
Route Delete 10.41.0.0 Mask 255.255.0.0
Example 9: To remove all routes starting with 10 in the IP routing table, execute the following command:
Route Delete 10.*
Example 10: To target 10.41.0.0, the next-hop address of a route with a subnet mask of 255.255.0.0 is changed from 10.27.0.1 to 10.27.0.25, and the following command is executed:

Route change 10.41.0.0 Mask 255.255.0.0 10.27.0.25

Route Delete 0.0.0.0 Mask 0.0.0.0

Route-p Add 0.0.0.0 Mask 0.0.0.0 192.168.1.1 metric 1

XP multi-Nic static route setting method

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.