Add static routes in Windows

Source: Internet
Author: User
Tags print print

In Windows, love is like a pair of shoes on your feet. When you lose your foot, you will know what it is like to walk barefoot. it is risky to lie and be cautious when talking about it. Don't fall in love with a young man. He will treat you as a school of love. Once the apprenticeship is successful, he will leave you without hesitation. Add static routes in Windows

[Tag: Windows, Static Routing]

In Windows XP, how does one add static routes?

Tao Sheng still replied: 2 popularity: 75 solution time:

Satisfactory answers: 100%

Static Routing is set in the device. After you set it in the vro, you can enter the same IP address as the one set in your vro on your computer.

FAQ

When there is a route print under cmd, isn't there a persistent routes? Isn't this a permanent route? If so, how can I add it?

Respondent's supplement

Do you want to use this computer as a soft router in windows. in this case, only ICS in Win2000 can achieve software routing through third-party software in XP. the persistent routes you mentioned is only the route address dynamically allocated. Once the address is rented or restarted, your IP address is automatically changed randomly.

FAQ

That is, there is no temporary route or permanent route in Linux in windows?

Respondent's supplement

In Win2000, ICS. XP in 2000 does not exist.

FAQ

What is the use of persistent routes in XP? If you want to add a route under XP, do you have to add it after each restart?

Respondent's supplement

Most of this is anti-arp, that is, it is used to bind your Mac,

Respondent's supplement

Windows route table command

Display and modify entries in the local IP address routing table.

Syntax

Route [-F] [-p] [Command [destination] [mask netmask] [gateway] [metric] [If interface]

Parameters

-F

Clear all routes that are not the primary route (the network mask is 255.255.255.255), back-to-network route (the target is 127.0.0.0, and the network mask is 255.255.255.0), or Multicast Route (the target is 224.0.0.0, the route table of the route entry whose network mask is 240.0.0.0. If it is used with one of the commands (such as ADD, change, or delete), the table is cleared before running the command.

-P

When used together with the Add command, specify that the route is added to the Registry and initialize the IP route table when starting the TCP/IP protocol. By default, the added route is not saved when the TCP/IP protocol is enabled. When used with the print command, the permanent route list is displayed. All other commands ignore this parameter. The permanent route is stored in the registry at HKEY_LOCAL_MACHINE \ SYSTEM \ CurrentControlSet \ Services \ Tcpip \ Parameters \ persistentroutes.

Command

Specify the command to run. The following table lists valid commands. Command Purpose

Add route entry

Change to change an existing route

Delete Delete route entries

Print print route destination

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 host route is an IP address, and the default route is 0.0.0.0.

Mask subnetmask

Specifies the netmask (also called the subnet mask) associated with the target network address ). The subnet mask can be an appropriate subnet mask for IP addresses, 255.255.255.255.255 for host routes, and 0.0.0.0 for default routes. If this parameter is ignored, the subnet mask 255.255.255.255 is used. When defining a route, the destination address cannot be more detailed than the corresponding subnet mask due to the relationship between the destination address and subnet mask. In other words, if one of the subnet masks is 0, the corresponding bit in the target address cannot be set to 1.

Gateway

Specify the previous or next hop IP address that exceeds the reachable address set defined by the Network target and subnet mask. For a local connection subnet route, the gateway address is the IP address assigned to the connection subnet interface. For a remote route that can be used only by one or more routers, the gateway address is an IP address that can be directly reached allocated to the adjacent router.

Metric

Specify the integer (range: 1 ~ 9999). It is used to select the route that best matches the destination address in the forwarding packet among multiple routes in the routing table. The selected route has the minimum number of hops. The number of hops reflects the quantity, speed, reliability, throughput, and management attributes of the hops.

If Interface

Specify the interface index of the interface that the target can reach. Use the route print command to display the index list of the interface and its corresponding interface. The interface index can be in decimal or hexadecimal format. For hexadecimal values, add 0x before the hexadecimal number. When the if parameter is ignored, the interface is determined by the gateway address.

/?

Display help at the command prompt.

Note

The value in the number of hops column in the route table is large because 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.. By default, the auto-determine interface hops determine the speed of each interface and adjust the route hops of each interface. Therefore, the routes created by the fastest interface have the lowest hops. To delete the number of hops, disable automatic interface hops 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 systemroot \ system32 \ drivers \ etc folder, the name can be used for destination. As long as the name can be resolved to an IP address through the standard host name resolution technology such as "Domain Name System" (DNS) query, it can be used for gateway, DNS query uses the local host file and NetBIOS name stored in the systemroot \ system32 \ drivers \ etc folder for resolution.

For the print or delete command, you can ignore the gateway parameter and use wildcards to indicate the target and gateway. The value of destination can be a wildcard specified by the asterisk. If the specified target contains an asterisk (*) or question mark (?), It is regarded as a wildcard and only prints or deletes matched target routes. An asterisk represents a sequence of any character, and a question mark represents any character. For example, 10. *. 1,192. 168. *, 127. *, and * 224 * are all effective use of the asterisk wildcard.

An error message "route: Bad gateway address netmask" is displayed when an invalid combination of target and subnet mask (netmask) values is used. This error occurs when one or more bits in the target are set to 1 and their corresponding bits in the subnet mask are set to 0. You can use binary notation to indicate the target and subnet mask to check this situation. The subnet mask in binary format includes a series of 1 representing the destination network address and a series of 0 representing the destination host address. Check whether some bits of the target host address (defined by the subnet mask) are set to 1.

Only the route commands of Windows NT 4.0, Windows 2000, Windows Millennium Edition, and Windows XP support the-p parameter. The route command of Windows 95 or Windows 98 does not support this parameter.

 

This command is available only when the Internet Protocol (TCP/IP) is installed as a component of the network adapter attribute in a network connection.

Example

To display the complete content of the IP route table, type:

Route print

To display routes starting with 10 in the IP route table, type:

Route print 10 .*

To add a default route entry whose default gateway address is 192.168.12.1, type:

Route add 0.0.0.0 mask 0.0.0.0 192.168.12.1

To add a route entry whose destination is 10.41.0.0, whose subnet mask is 255.255.0.0, and whose next hop address is 10.27.0.1, type:

Route add 10.41.0.0 mask 255.255.0.0 10.27.0.1

To add a permanent route whose destination is 10.41.0.0, The subnet mask is 255.255.0.0, And the next hop address is 10.27.0.1, type:

Route-P add 10.41.0.0 mask route 255.0.0 10.27.0.1

To add a route entry with the target 10.41.0.0, subnet mask 255.0.0, Next Hop address 10.27.0.1, and number of hops 7, type:

Route add 10.41.0.0 mask 255.255.0.0 10.27.0.1 metric 7

To add a route entry whose destination is 10.41.0.0, The subnet mask is 255.0.0, the next hop address is 10.27.0.1, and the interface index is 0x3, type:

Route add 10.41.0.0 mask route 0.0 10.27.0.1 if 0x3

To delete a route whose destination is 10.41.0.0 and subnet mask is 255.255.0.0, type:

Route Delete 10.41.0.0 mask 255.255.0.0

To delete all routes starting with 10 in the IP route table, type:

Route Delete 10 .*

To change the next hop address of the route whose destination is 10.41.0.0 and whose subnet mask is 255.255.0.0 from 10.27.0.1 to 10.27.0.25, type:

Route change 10.41.0.0 mask 255.255.0.0 10.27.0.25

Route command

Routing IP Add/delete/set/show interface add, delete, configure, or display general IP Route settings on the specified interface.

Routing IP Add/delete/set/show filter add, delete, configure, or display IP packet filters on the specified interface.

Routing IP Add/delete/show boundary add, delete, or display multicast boundary settings on the specified interface.

Routing IP Add/set ipiptunnel add or configure IP interfaces in the IP address.

Routing IP Add/delete/set/show rtmroute add, configure, or display the route table manager route.

Routing IP Add/delete/set/show persistentroute add, delete, configure, or display continuous routing.

Routing IP Add/delete/set/show preferenceforprotocol add, delete, configure, or display the priority of the routing protocol.

Routing IP Add/delete/set/show scope add, delete, or display multicast scope.

Routing IP Set/show loglevel configuration or display the Global IP record level.

Routing IP show helper displays all the netsh utilities of the IP.

Routing IP show protocol displays all running IP routing protocols.

Routing IP show MFE displays multicast forwarding items.

Routing IP show mfestats displays multicast forwarding item statistics.

Routing IP show boundarystats displays IP multicast boundary.

Routing IP show rtmdestinations displays the target in the route table manager route table.

Routing IP show rtmroutes displays the routes in the route table of the route table manager.

Routing ip nat set/show global configuration or display Global Network Address Translation (NAT) settings.

Routing ip nat Add/delete/set/show interface add, delete, configure, or display the NAT settings of the specified interface.

Routing ip nat Add/delete addressrange add or delete an address range in the public address pool of the NAT interface.

Routing ip nat Add/delete addressmapping add or delete Nat address ing.

Routing ip nat Add/delete portmapping add or delete Nat port ing.

Routing IP autodhcp set/show global configuration or display the global DHCP distributor parameters.

Routing IP autodhcp set/show interface configuration or display DHCP distributor settings for the specified interface.

Routing IP autodhcp Add/delete exclusion adds or deletes an exclusion range in the DHCP distributor address range.

Routing IP dnsproxy set/show global configuration or display global DNS proxy parameters.

Routing IP dnsproxy set/show interface configuration or display DNS proxy parameters of the specified interface.

Routing ip igmp set/show global configuration or display IGMP global settings.

Routing ip igmp Add/delete/set/show interface add, delete, configure, or display IGMP on the specified interface.

Routing ip igmp Add/delete staticgroup add or delete the static multicast group of the specified interface.

Routing ip igmp show grouptable displays the IGMP Host group table.

Routing ip igmp show ifstats displays IGMP statistics for each interface.

Routing ip igmp show iftable displays the IGMP Host group for each interface.

Routing ip igmp show proxygrouptable: displays the IGMP group table of the IGMP proxy interface.

Routing ip igmp show rasgrouptable displays the group table of the Internet interfaces used by the remote access server.

Routing ip ospf set/show global configuration or display global OSPF settings.

Routing ip ospf Add/delete/set/show interface add, delete, configure, or display OSPF on the specified interface.

Routing ip ospf Add/delete/set/show area add, delete, configure, or display the OSPF area.

Routing ip ospf Add/delete/show range add, delete, configure, or display a range in the specified OSPF area.

Routing ip ospf Add/delete/set/show virtif add, delete, configure, or display OSPF Virtual interfaces.

Routing ip ospf Add/delete/show neighbor add, delete, configure, or display OSPF neighbors.

Routing ip ospf Add/delete/show protofilter add, delete, configure, or display the routing information sources of OSPF external routes.

Routing ip ospf Add/delete/show routefilter add, delete, configure, or display the routing filtering of OSPF external routes.

Routing ip ospf show areastats displays OSPF region statistics.

Routing ip ospf show lsdb displays the OSPF link status database.

Routing ip ospf show virtifstats displays OSPF Virtual link statistics.

Routing IP relay set global configuration "DHCP relay agent" global settings.

Routing IP relay Add/delete/set interface add, delete, or configure "DHCP relay agent" settings on the specified interface.

Routing IP relay Add/delete dhcpserver add or delete the IP address of the DHCP server in the DHCP server address list.

Routing IP relay show ifbinding display interface IP Address binding.

Routing IP relay show ifconfig displays the "DHCP relay agent" configuration for each interface.

Routing IP relay show ifstats displays DHCP statistics for each interface.

Routing IP rip set/show global configure IP rip global settings.

Routing IP rip Add/delete/set/show interface add or configure IP rip settings on the specified interface.

Routing IP rip Add/delete peerfilter add or delete the rip peer filter.

Routing IP rip Add/delete acceptfilter add or delete rip route filters in the list of accepted routes.

Routing IP rip Add/delete announcefilter add or delete rip route filters in the published route list.

Routing IP rip Add/delete/show neighbor add or delete rip neighbors.

Routing IP rip set/show flags configure advanced IP rip settings on the specified interface.

Routing IP rip show globalstats displays global rip parameters.

Routing IP rip show ifbinding display interface IP Address binding.

Routing IP rip show ifstats displays the rip statistics for each interface.

IPX netsh routing command

Routing IPX Add/set staticroute add or configure a static IPX route in the IPX route table.

Routing IPX Add/set staticservice add or configure the static sap service in the SAP service table.

Routing IPX Add/set filter add or configure IPX packet filter on the specified interface.

Routing IPX Add/set interface enables IPX routing on the request dialing interface, or configures IPX settings on the specified interface.

Routing IPX set global configuration global IPX route settings.

Routing IPX rip Add/set filter add and configure the rip route filter.

Routing IPX rip set global configuration rip settings for global IPX.

The routing IPX rip set interface configures the rip settings of IPX on the specified interface.

Routing IPX sap Add/set filter add or configure the sap service filter.

Routing IPX sap set global configuration sap settings for global IPX.

Routing IPX sap set interface configure the sap settings of IPX on the specified interface.

Routing IPX NetBIOS add nbname Add the static NetBIOS name to the IPX NetBIOS name table.

Routing IPX NetBIOS set interface configure IPX-based NetBIOS settings on the specified interface.

Route help

Manipulates network routing tables.

Respondent's supplement

Route [-F] [-p] [Command [destination]

[Mask netmask] [gateway] [metric] [If interface]

-F clears the routing tables of all gateway entries. If this is

Used in conjunction with one of the commands, the tables are

Cleared prior to running the command.

-P when used with the Add command, makes a route persistent guest SS

Boots of the system. By default, routes are not preserved

When the system is restarted. Ignored for all other commands,

Which always affect the appropriate persistent routes. This

Option is not supported in Windows 95.

Command one of these:

Print prints a route

Add adds a route

Delete deletes a route

Change modifies an existing route

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.

All symbolic names used for destination are looked up in the Network Database

File networks. The symbolic names for gateway are looked up in the Host Name

Database file hosts.

If the command is print or delete. Destination or gateway can be a wildcard,

(Wildcard is specified as a star '*'), or the gateway argument may be omitted.

If DEST contains a * Or ?, It is treated as a shell pattern, and only

Matching destination routes are printed. The '*' matches any string,

And '? 'Matches any one Char. Examples: 157. *. 1,157. *, 127. *, * 224 *.

The print command will show both IPv4 and IPv6 routes, but the add, delete,

And change commands work only for IPv4 routes. for IPv6 routes, use

The 'interface ipv6' context in netsh.exe.

Diagnostic notes:

Invalid mask generates an error, that is when (DEST & Mask )! = DeST.

Example> route add 157.0.0.0 mask 155.0.0.0 157.55.80.1 if 1

The route addition failed: the specified mask parameter is invalid.

(Destination & Mask )! = Destination.

Examples:

> Route print

> Route add 157.0.0.0 mask route 0.0.0 157.55.80.1 metric 3 if 2

Destination ^ mask ^ gateway metric ^

Interface ^

If if is not given, it tries to find the best interface for a given

Gateway.

> Route print

> Route print 157 *... only prints those matching 157 *

> Route change 157.0.0.0 mask route 0.0.0 157.55.80.5 metric 2 if 2

Change is used to modify gateway and/or metric only.

> Route print

> Route Delete 157.0.0.0

> Route print

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.