Route and ipconfig

Source: Internet
Author: User
Tags dns troubleshooting

Route

Display and modify entries in the local IP address routing table. Use a route without parameters to display help.

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 location of permanent routing stored in the registry is HKEY_LOCAL_MACHINE/system/CurrentControlSet/services/TCPIP/parameters/persistentroutes.

Command
The following table lists valid commands.
Add route entry
Change to change an existing route
Delete Delete route entries
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 an 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.
 
Note: 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

 

Ipconfig)
Ipconfig displays all current TCP/IP network configuration values, refresh Dynamic Host Configuration Protocol (DHCP), and Domain Name System (DNS) settings. You can use ipconfig without parameters to display the IP addresses, subnet masks, and default gateways of all adapters.

Syntax
Ipconfig [/all] [/renew [adapter> [/release [adapter> [/flushdns] [/displaydns] [/registerdns] [/showclassid adapter] [/setclassid adapter [classid>

Parameters
/All
Displays the complete TCP/IP configuration information for all adapters. Without this parameter, ipconfig only displays the IP address, subnet mask, and default gateway values of each adapter. An adapter can represent a physical interface (such as a network adapter installed) or a logical interface (such as a dial-up connection ).
/Renew [adapter]
Update DHCP configurations for all adapters (if no adapter is specified) or for a specific adapter (if the adapter parameter is included. This parameter is only available on computers with NICs configured to automatically obtain IP addresses. To specify an adapter name, type the name of the adapter displayed by using the ipconfig command without parameters.
/Release [adapter]
Send a dhcprelease message to the DHCP server to release the current DHCP configuration for all adapters (if no adapter is specified) or for a specific adapter (if the adapter parameter is included) and discard the IP Address Configuration. This parameter can disable the TCP/IP of the adapter configured to automatically obtain the IP address. To specify an adapter name, type the name of the adapter displayed by using the ipconfig command without parameters.
/Flushdns
Clear and reset the content cached by the DNS customer parser. If necessary, you can use this process to discard negative cache records and any other dynamically added records from the Cache during DNS troubleshooting.
/Displaydns
Displays the contents cached by the DNS customer parser, including records pre-loaded from the local host file and any resource records recently obtained by name queries parsed by the computer. DNS Customer Service uses this information to quickly resolve frequently-queried names before querying the configured DNS server.
/Registerdns
Initialize the manual Dynamic Registration of the DNS name and IP address configured on the computer. You can use this parameter to troubleshoot failed DNS name registration or solve the dynamic update problem between the customer and the DNS server, without restarting the customer's computer. The DNS settings in the TCP/IP protocol advanced attribute can determine which names are registered in the DNS.
/Showclassid Adapter
Displays the DHCP category ID of the specified adapter. To view the DHCP category IDs of all adapters, use the asterisk (*) wildcard instead of the adapter. This parameter is only available on computers with NICs configured to automatically obtain IP addresses.
/Setclassid adapter [classid]
Configure the DHCP category ID of a specific adapter. To set DHCP category IDs for all adapters, use the asterisk (*) wildcard instead of the adapter. This parameter is only available on computers with NICs configured to automatically obtain IP addresses. If no DHCP category ID is specified, the current category ID is deleted.
/?
Display help at the command prompt.
Note
Ipconfig is equivalent to winipcfg, which is available on Windows Millennium Edition, Windows 98, and Windows 95. Although Windows XP does not provide a graphical interface like the winipcfg command, you can use "network connection" to view and update IP addresses. To do this, open a network connection, right-click a network connection, click status, and then click the support tab.
This command is most suitable for computers configured to automatically obtain IP addresses. It allows you to determine which TCP/IP configuration values are configured by DHCP, automatic private IP address (apipa), and other configurations.
If the adapter name contains spaces, use quotation marks ("adapter name") on both sides of the adapter name ").
For the adapter name, ipconfig can use the asterisk (*) wildcard character to specify the name of the adapter starting with the specified string, or the name contains the adapter of the specified string. For example, local * can match all the adapters starting with the string local, while * con * can match all the adapters containing the string con.
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 basic TCP/IP configurations of all adapters, type:

Ipconfig

To display the complete TCP/IP configurations for all adapters, type:

Ipconfig/all

Update only the configuration of IP addresses allocated by DHCP for the "local connection" Adapter. Enter:

Ipconfig/renew "Local Area Connection"

To clear the DNS parser Cache during DNS resolution troubleshooting, type:

Ipconfig/flushdns

To display DHCP category IDs of all adapters whose names start with local, type:

Ipconfig/showclassid local *

To set the DHCP category ID of the local connection adapter to test, type:

Ipconfig/setclassid "Local Area Connection" Test

 

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.