Useful Windows Commands – PING, TRACERT, IPCONFIG, and NET USE

Below are some useful Windows networking commands and the Linux equivalent

PING

Have you ever wanted to know if your network is up and running but aren’t exactly sure how to tell. Maybe you know your network works, but you aren’t sure if you are entering your username wrong or if your mail server is off line. How can you tell?

Ping allows you to send a packet to a remote host which should be repeated back to you (pinged). When you ping a remote computer, you receive a response that tells how many packets you sent, and how many you received back. If you keep sending and hear nothing back, either the remote computer is not working, or you are not able to find a route to that remote host.

Syntax: PING [server address]

Example: PING 209.85.225.147

Example: PING www.google.com

Linux Equivalent: ping

As you can see, you can either ping by IP address or host name. If you can ping by IP address but not by name, there may be an issue in resolving names, such as a problem with your DNS server. If you are not able to ping by either, but you think that the remote device is working, check to make sure that your gateway and netmask are properly configured.

TRACERT

TRACERT will allow you to analyze the path by which information travels from your computer to a remote machine. It can be very useful in determining if and where there is a network failure. For instance, if you expect that you are connecting to an offsite host and you are never able to get out of your network, your connection may be down or the gateway may not be properly configured.

Syntax: TRACERT [host]

Example: TRACERT 209.85.225.147

Example: TRACERT www.google.com

Linux Equivalent: traceroute [host]

As you can see, TRACERT can also use either IP address or host name. Typically, either TRACERT or traceroute will follow the connection over a maximum of 30 “hops” or jumps from one network device to another before reaching its destination.

IPCONFIG

IPCONFIG will let you see what IP address has been assigned to each network interface on your computer. By looking at a more detailed IPCONFIG output, you can find out other useful information such as the netmask, gateway, and MAC (Hardware) address of each interface. This is an alternative to looking at the property section under the network controller’s TCP/IP settings (a very long and non-fun process).

Syntax: IPCONFIG

or for more information

Syntax: IPCONFIG /all

The important line is the one either labeled IP ADDRESS or IP_V4 Address.

Linux Equivalent: ifconfig

NET USE

The “NET” commands can be very useful for mapping and viewing windows shars from the command line. This is a useful alternative to browsing the network neighborhood. The following two commands are probably the most useful (or have been to me).

NET USE
NET VIEW

You can get information on all of the NET commands by typing: NET /? or specific information on either of hte above commans by typing NET USE /? or NET VIEW /?.

Note the use of /?. Actually, the /? switch can be very useful to get more information on the syntax and use of most MSDOS commands.
I’ll include some typical examples below:

Syntax: NET USE [devicename] [\\computername\sharename\volume\] [/user:[username@dotted domain name]]

Example: NET USE v: \\192.168.0.10\share /USER:Admin@mydomain.local

Keep in mind that it is typically a bad idea to mount drives as an administrator, unless you need full access to the shared device. You are best to mount with a user that has the least amount of access necessary to complete your tax. Don’t make a practice of always mounting as administrator (or root).

If you would like the mount to survive a reboot, make it PERSISTENT:

Example: NET USE v: \\192.168.0.10\share /USER:Admin@mydomain.local /PERSISTENT:YES

To unmount:

Syntax: NET USE [devicename] /DELETE

Example: NET USE v: /DELETE

To view the shares available on the computer (similar to browsing)

Syntax: NET VIEW [\\computername]

Example: NET VIEW \\192.168.0.10

Linux Equivalent: smbclient

Leave a Reply

Your email address will not be published. Required fields are marked *