Windows Networking Commands
Windows Networking Commands
DEPARTMENT OF COMPUTER
SCIENCE & TECHNOLOGY
FENDELL CAMPUS
Purpose: Assignment
1. ping Command:
The ping command checks network connectivity by sending ICMP echo
requests. Here are some common uses:
Ping an IP Address:
To test connectivity to an IP address:
ping [IP address]
Example: ping 8.8.8.8
Ping a website:
To check if a website responds:
ping [website]
Example: ping google.com
Continuous Ping:
To keep pinging continuously:
ping -t [IP address]
Example: ping -t 8.8.8.8
2. ipconfig Command:
The ipconfig command provides information about your network
configuration and allows you to refresh DHCP and DNS settings. Here
are some key points:
Basic Usage:
Open Command Prompt or PowerShell.
Type ipconfig and press Enter.
This displays basic network information, including your IP address, subnet
mask, and default gateway.
• Troubleshooting:
Use ipconfig /all to troubleshoot network issues.
• Refreshing Settings:
To reset or refresh network settings:
If DHCP is enabled, request a new IP address: ipconfig /release.
Renew IP addresses: ipconfig /renew.
3. Hostname Command
In windows, the hostname command allows you to view the host name
portion of the full computer name.
Basic Usage:
Open the Command Prompt (you can search for it in the Start menu).
Type hostname and press Enter.
The result will display the computer’s hostname without the domain.
Environment Variables:
The environment variable %COMPUTERNAME% usually prints the same string
as hostname, but in uppercase.
If the environment variable _CLUSTER_NETWORK_NAME_ is defined, hostname
will print its value.
Additional Information:
To get the actual domain on which the computer is connected, use the
ipconfig command and check the “Connection-specific DNS Suffix”
value1.
If you want to alter the hostname output, set the _CLUSTER_NETWORK_NAME_
variable and then run hostname. The hostname command is available
only if the Internet Protocol (TCP/IP) protocol is installed as a component
in the properties of a network adapter in Network.
4. getmac Command
The getmac command in Windows retrieves the media access control
(MAC) address and the list of network protocols associated with each
address for all network cards on a computer.
Basic Usage:
Open the Command Prompt (you can search for it in the Start menu).
Type getmac and press Enter.
You’ll see a list of physical addresses (MAC addresses) and transport
names used by each network adapter.
Parameters:
/s <computer>: Specifies the name or IP address of a remote computer
(default is the local computer).
/u <domain\\<user>>: Runs the command with specified user account
permissions.
/p <password>: Specifies the password for the user account.
/fo {table | list | csv}: Sets the output format (default is table).
/nh: Suppresses column headers in output.
/v: Displays verbose information.
/?: Shows help at the command prompt.
Examples:
To display a concise table: getmac /fo table /nh /v
To query a remote computer: getmac /s srvmain
To specify user credentials: getmac /s srvmain /u maindom\\hiropln /p p@ssW23
The getmac command provides essential network information, especially
when troubleshooting or analyzing network connections.
5. arp Command
Purpose:
ARP resolves IP addresses to MAC addresses within a Local Area
Network (LAN).
It operates between the Data Link Layer (Layer 2) and the Network
Layer (Layer 3).
The primary function is to map IP addresses to corresponding MAC
addresses.
Basic Usage:
To view the ARP cache, simply type arp in the Command Prompt (on
Windows) or the terminal (on Linux).
The output displays IP addresses, corresponding MAC addresses, and
interface information.
6. nslookup:
Basic Usage:
Open the Command Prompt or Terminal.
Type nslookup followed by the domain name or IP address you want to
query.
For example:
To find the IP address for www.googl.com, type: nslookup www.google.com.
To perform a reverse DNS lookup (find the domain associated with an IP
address), use: nslookup [ip-address].
Common Options:
-type=a: View information about DNS A (address) records.
-type=mx: View Mail Exchange server information.
-type=ns: View Name Server records.
-type=ptr: View Pointer records (used in reverse DNS lookups).
-type=soa: View Start of Authority records.
You can also change the default DNS name, set timeouts, and specify
ports.
Example:
To find the IP address for www.exanple.com, type:
nslookup www.example.com
To perform a reverse lookup for an IP address (e.g., 8.8.8.8), use:
nslookup 8.8.8.8
7. nbtstat Command:
Functionality:
Displays NetBIOS name tables (local and remote computers).
Shows NetBIOS name cache.
Refreshes NetBIOS name cache and WINS registrations.
Basic Usage:
nbtstat /n: Displays local NetBIOS name table.
nbtstat /a <remotename>: Shows remote NetBIOS name table.
nbtstat /c: Displays NetBIOS name cache.
Additional Options:
/r: NetBIOS name resolution statistics.
/R: Purges and reloads pre-tagged entries from Lmhosts file.
/RR: Releases and refreshes local NetBIOS names registered with WINS.
You can also disconnect mapped drives using net use /delete.
9. netstat Command:
Columns in Output:
Proto: Protocol of the connection (TCP or UDP).
Recv-Q: Receive queue (bytes received or ready to be received).
Send-Q: Send queue (bytes ready to be sent).
Local address: Address and port of the local connection.
Foreign address: Address and port of the remote end of the connection.
State: State of the local socket (e.g., ESTABLISHED, LISTENING).
Useful Options:
-a: Displays all active TCP connections and listening ports.
-t: Lists all TCP ports.
-u: Lists all UDP ports.
-l: Lists only listening ports.
nbtstat Command:
Purpose: nbtstat deals with NetBIOS over TCP/IP (NetBT) protocol.
Functionality:
Displays NetBIOS name tables (local and remote computers).
Shows NetBIOS name cache.
Refreshes NetBIOS name cache and WINS registrations.
Basic Usage:
nbtstat /n: Displays local NetBIOS name table.
nbtstat /a <remotename>: Shows remote NetBIOS name table.
nbtstat /c: Displays NetBIOS name cache.
Additional Options:
/r: NetBIOS name resolution statistics.
/R: Purges and reloads pre-tagged entries from Lmhosts file.
/RR: Releases and refreshes local NetBIOS names registered with WINS.
10.Taskkill Command
The taskkill command in Windows allows you to end one or more tasks or
processes. You can terminate processes either by their process ID (PID) or by
their image name. Here are the details:
Basic Usage:
Open the Command Prompt (you can search for it in the Start menu).
Type taskkill followed by the appropriate options.
You can use the tasklist command to find the process ID (PID) of the process you
want to terminate.
Parameters:
/s <computer>: Specifies the name or IP address of a remote computer (default is
the local computer).
/u <domain\\<username>>: Runs the command with the account permissions of the
specified user.
/p <password>: Specifies the password for the user account.
/fi <filter>: Applies a filter to select specific tasks (e.g., by status, image name,
PID, etc.).
/pid <processID>: Specifies the process ID of the process to be terminated.
/im <imagename>: Specifies the image name of the process to be terminated
(wildcard * allowed).
/f: Forces processes to be ended (ignored for remote processes).
/t: Ends the specified process and any child processes it started.
Examples:
To end processes with PIDs 1230, 1241, and 1253: taskkill
/pid 1230 /pid 1241 /pid 1253
To forcefully end the Notepad.exe
process: taskkill /im Notepad.exe
To terminate unresponsive tasks: taskkill /fi "STATUS eq NOT RESPONDING"
Taskkill is a powerful tool for managing processes, especially when
troubleshooting or dealing with unresponsive applications.