Problem Solving with TCP/IP Command Line Tools

Using ipconfig, ping, tracert and nslookup on a Windows Computer

Problem Solving  with TCP/IP Command Line Tools - Mark Alng  with TCP/IP Command line Texander Bain
Problem Solving with TCP/IP Command Line Tools - Mark Alng with TCP/IP Command line Texander Bain
Network problems can be infuriating for Internet users. However, there are simple command line methods that help a programmer to find why their applications run slowly

The most important thing about the TCP/IP (or Transmission Control Protocol/Internet Protocol) is that it enables computers all around the world to communicate with each other, regardless of their operating system.

So, a Windows computer in Washington can talk to a Linux computer in London or a Sun machine in Sydney. And all of this done automatically in the background without any input from the Internet user.

However, this raises an important question for that user. How can they analyse problems when things start to go wrong with the network? Fortunately there are some very simple command line tools to help the Windows user.

Ipconfig

The starting point for any system analysis is, perhaps, ipconfig. If the user calls types "ipconfig" on the command line then they will see the IP set up for their own computer, for example:

> ipconfig
Windows IP Configuration
Ethernet adapter Local Area Connection 2:
Media State: Media disconnected
Ethernet adapter Wireless Network Connection:
Media State: Media disconnected
PPP adapter 1.3G:
Connection-specific DNS Suffix . :
IP Address: 10.235.116.220
Subnet Mask: 255.255.255.255
Default Gateway: 10.235.116.220

And even more information can be obtained by calling ipconfig with it's "/all" flag:

> ipconfig /all
Host Name : acer-aef39c1d21
PPP adapter 1.3G:
Description: WAN (PPP/SLIP) Interface
Physical Address: 00-53-45-00-00-00
DNS Servers: 172.30.140.69 172.31.76.69
Primary WINS Server: 10.11.12.13
Secondary WINS Server: 10.11.12.14

Next the network user can consider whether or not their computer can accually connect to the Internet.

Ping

The ping command sends packets of information to a web server, tests to see if it receives a response, and times how long the response takes:

ping www.stamford.ac.uk
Pinging www.stamford.ac.uk [194.83.69.30] with 32 bytes of data:
Reply from 194.83.69.30: bytes=32 time=289ms TTL=49
Reply from 194.83.69.30: bytes=32 time=331ms TTL=49
Reply from 194.83.69.30: bytes=32 time=289ms TTL=49
Reply from 194.83.69.30: bytes=32 time=325ms TTL=49
Ping statistics for 194.83.69.30:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 289ms, Maximum = 331ms, Average = 308ms

Ping is particularly useful because of the fact that it confirms that the computer is (or is not) connecting correctly. However, there are other commands that give even more information

Tracert

One interesting command is tracert. This traces the route between the user's computer and any other computer on the network:

> tracert www.stamford.ac.uk
Tracing route to www.stamford.ac.uk [194.83.69.30] over a maximum of 30 hops:
1 306 ms 322 ms 299 ms 172.30.152.4
2 256 ms 340 ms 300 ms 172.31.152.20
3 257 ms 322 ms 336 ms 217.171.129.125
4 294 ms 318 ms 318 ms 217.171.128.36
5 275 ms 300 ms 341 ms 172.31.252.114
6 299 ms 378 ms 318 ms 195.50.90.153
7 336 ms 340 ms 299 ms ae-1-51.edge3.London1.Level3.net [4.69.139.73]
8 317 ms 322 ms 336 ms teleglobe-level3-xe.london1.level3.net [4.68.63.106]
9 353 ms 340 ms 336 ms if-0-1-0-62.mcore3.LDN-London.as6453.net [195.219.83.2]
10 329 ms 419 ms 299 ms ix-15-0-0.mcore3.LDN-London.as6453.net [195.219.195.86]
11 276 ms 339 ms 299 ms so-6-0-0.lond-sbr1.ja.net [146.97.33.153]
12 298 ms 317 ms 341 ms EMMAN-N2.site.ja.net [146.97.42.54]
13 358 ms 299 ms 336 ms dmu1-gw-v319.emman.net [195.195.228.110]
14 275 ms 318 ms 400 ms stamford-col-gw-gi0-1.emman.net [194.82.121.210]
15 356 ms 318 ms 401 ms www.stamford.ac.uk [194.83.69.30]
Trace complete.

Here it can be seen that there are 15 connections between the user's computer and the target host (which is interesting considering that in this case they are only 4 miles apart).

Nslookup

The final command to consider is nslookup. This returns the name and any aliases for a given IP address, for example:

> nslookup 194.83.69.30
Name: www.stamford.ac.uk
Address: 194.83.69.30
Aliases: 30.69.83.194.in-addr.arpa

Here the output can be compared with a known IP/name pairing, or it can be used to look up the details for any unnamed hops from the tracert output:

gt; nslookup 172.30.152.4
Server: mr0ns01.three.co.uk
Address: 172.30.140.69

And so, with just these few commands a computer user can query the IP address of their machine, they can check its connectivity to the Internet, they can investigate the route that it's taking in order to make the connection, helping them towards identifying problems with their network.

Mark Alexander Bain - Mark Alexander Bain is a writer, Mo Bro and consultant for all aspects of software development at dsquared. He has also written regularly ...

rss
Advertisement
Advertisement
Advertisement