Essential IP Commands
In our fast-paced digital world, knowing the
basics of networking can benefit everyone, not just IT professionals. Lately,
I’ve been exploring Windows IP commands, and they’re game-changers for
troubleshooting and enhancing network performance.
Why it matters:
Commands like ipconfig, ping, and tracert are
fundamental tools for identifying and resolving network issues effectively.
Key
takeaways:
• ipconfig: Quickly view your IP and DNS
configurations.
• ping: Test connectivity in seconds.
• tracert: Trace network routes to spot
bottlenecks.
Whether you’re managing a complex IT environment or solving a home network issue, these commands are invaluable additions to your skillset.
1. ipconfig
- Basic Command:
ipconfig- Displays basic information about all network interfaces, such as IP address, subnet mask, and default gateway.
- Show detailed information:
ipconfig /all- Provides a more detailed view, including the MAC address (Physical Address), DHCP status, DNS servers, etc.
- Release IP Address:
ipconfig /release- Releases the current DHCP lease for the network adapter.
- Renew IP Address:
ipconfig /renew- Renews the DHCP lease and obtains a new IP address.
- Flush DNS Cache:
ipconfig /flushdns- Clears the DNS resolver cache, which can help resolve DNS-related issues.
- Display DNS Cache:
ipconfig /displaydns- Displays the contents of the DNS resolver cache.
- Set DNS Search Suffix:
ipconfig /setclassid <adapter> <class_id>- Sets the DHCP class ID for a specific adapter.
2. ping
Ping an IP Address or Host:
ping <hostname or IP address>- Sends ICMP echo requests to a host to check if it's reachable.
Example:
ping google.comorping 8.8.8.8Ping with specific size:
ping <hostname or IP address> -l <size>- Example:
ping google.com -l 1000sends a ping with a 1000-byte packet.
- Example:
Set Ping Count:
ping <hostname or IP address> -n <count>- Example:
ping google.com -n 10will ping the destination 10 times.
- Example:
3. tracert
- Trace Route to a Host:
tracert <hostname or IP address>- Traces the route that packets take to reach the destination, showing each hop along the way. This can help identify network congestion or routing issues.
4. netstat
- View Active Connections:
netstat- Displays all active network connections, including the protocol (TCP/UDP), local address, foreign address, and state (e.g., ESTABLISHED, TIME_WAIT).
- Detailed Output with Process Info:
netstat -ano- Shows active connections and associated process IDs (PID).
- Listening Ports:
netstat -an | find "LISTEN"- Lists all ports in the "LISTENING" state on the machine.
5. nslookup
- DNS Lookup:
nslookup <hostname>- Queries DNS to get the IP address of a domain name.
- Reverse DNS Lookup:
nslookup <IP address>- Performs a reverse DNS lookup, returning the domain name associated with the given IP address.
6. route
- View Routing Table:
route print- Displays the current routing table of the computer, showing how packets are routed to different networks.
- Add a Route:
route add <destination> mask <subnet mask> <gateway>- Adds a new route to the routing table.
- Example:
route add 192.168.2.0 mask 255.255.255.0 192.168.1.1
- Delete a Route:
route delete <destination>- Removes a route from the routing table.
7. getmac
- Get MAC Address:
getmac- Displays the MAC (Media Access Control) addresses of all network interfaces on the computer.
8. netsh
Show Network Configuration:
netsh interface ip show config- Displays the configuration of all network interfaces (IP address, gateway, DNS, etc.).
Reset TCP/IP Stack:
netsh int ip reset- Resets the TCP/IP stack, useful for fixing network issues related to incorrect IP configuration.
Enable/Disable Network Adapter:
netsh interface set interface "<Interface Name>" admin=disable(disable) oradmin=enable(enable)Change IP Address:
netsh interface ip set address "<Interface Name>" static <IP Address> <Subnet Mask> <Default Gateway>- Manually sets a static IP address for an interface.
- Example:
netsh interface ip set address "Ethernet" static 192.168.1.100 255.255.255.0 192.168.1.1
9. arp
- Display ARP Table:
arp -a- Shows the ARP cache, which maps IP addresses to MAC addresses for devices on the local network.
10. netsh wlan
- View Wireless Network Profiles:
netsh wlan show profiles- Displays all saved Wi-Fi network profiles on the computer.
- Show Wi-Fi Configuration:
netsh wlan show interfaces- Displays detailed information about the currently connected wireless network.
- Export Wi-Fi Profile:
netsh wlan export profile name="<profile name>" key=clear- Exports a saved Wi-Fi profile to an XML file, which can include the saved Wi-Fi password.
11. telnet
- Check Open Port on Remote Host:
telnet <hostname or IP address> <port>- Tests if a specific port is open on a remote server.
- Example:
telnet example.com 80checks if port 80 (HTTP) is open on the server.