Specify a route to manually switch the gateway between Intranet and Internet

Source: Internet
Author: User

Experiment content: specify a route to solve the problem that the gateway needs to be manually switched between the Intranet and the Internet
Lab Student: Fan chenpeng
Environment: Windows XP
The company's network is configured with two gateways: 192.168.218.1 and 192.168.218.3. The former is used to access the Intranet, and the latter is used to access the Internet. Switching to switching is very troublesome.
When someone else fails to ping the network, he or she runs the route command on the command line. I also tried it and it worked really well.

You only need the following command:

C: \> route add 192.168.0.0 mask 255.255.0.0 192.168.218.1

Route command syntax:

 

> Route add 157.0.0.0 mask route 0.0.0 157.55.80.1 metric 3 if 2
Destination ^ mask ^ gateway ^ metric ^ interface ^

Destination specifies the host.
Mask specifies that the next parameter is the 'netmask' value.
Netmask specifies a subnet mask value for this route entry. If not specified, it defaults to limit 255.
Gateway specifies gateway.
Interface the interface number for the specified route.
Metric specifies the metric, ie. cost for the destination.

Route: The data packet to be sent to location A must be forwarded by location B.
Destination
A can be a host or a mask combination to specify an IP range.
Mask
Subnet Mask of region.
Gateway
B, your own gateway.
Interface
The interface to the gateway can be understood as the NIC or local IP address.
Metric
Hop count, which can be understood as network overhead or priority

When a is a host, the subnet mask is 255.255.255.255. In this case, the subnet mask can be omitted, that is, route add 202.194.15.12 192.168.218.1
When a is a gateway, the subnet mask specifies which hosts are sent to a through B.
For example, route add 202.194.15.0 mask created successfully 192 192.168.218.1
Then it is sent to 202.194.15.0 ~ Packets of 202.194.15.63 must be forwarded through 192.168.218.1.
Using tracert, we can see that they use different routes:

C: \> tracert 202.194.15.64

Tracing Route to 202.194.15.64 over a maximum of 30 hops

1 <1 MS <1 MS <1 MS 192.168.218.3
2 192.168.218.3 reports: Destination Protocol unreachable.

Trace complete.

C: \> tracert 202.194.15.63

Tracing Route to 202.194.15.63 over a maximum of 30 hops

1 <1 MS <1 MS <1 MS 192.168.218.1
2 4 MS 4 MS *.*.*.*
3 5 MS 3 MS 4 MS *.*.*.*
4 2 MS 2 MS *.*.*.*
............

When both gateways are designated as data transfer stations for data packets sent to a, metric can be used to specify the priority. Route with a few hops is used first.

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.