Network Troubleshooting using Command-line

To troubleshoot a TCP/IP networking problem, utilize the following command step be step.


1. ipconfig

ipconfig /all : view TCP/IP configuration of the computer.

ipconfig /renew : force network adapter to contact a DHCP server and renew the existing configuration or obtain a new configuration.

Also, ipconfig command can be used to deal with DNS. (might be useful) /displaydns : displays the contents of the DNS Resolver Cache; /flushdns : purges the DNS cache; /registerdns : refreshes all DHCP leases and re-registers DNS names.

2. ping

The ping command helps to verify IP-level connectivity by sending an ICMP echo request to a target host name or IP address.

Perform the following steps when using ping:

1). Ping the loopback address to verify that TCP/IP is installed and configured correctly on the local computer.

ping 127.0.0.1

2). Ping the IP address of the local computer to verify that it was added to the network correctly.

ping IP_address_of_local_host

3). Ping the IP address of the default gateway to verify that default gateway is functioning and you can communicate with a local host on the local network.

ping IP_address_of_default_gateway

4). Ping the IP address of a remote host to verify that you can communicate through a router.

ping IP_address_of_remote_host

The ping command uses Windows Sockets - style name resolution to resolve a computer name to an IP address, so if pinging by address succeeds, but pinging by name failes, then the problem lies in address or name resolution, not network connectivity.

3. arp

The arp command is used to view and modify the ARP table entires on the local computer so as to resolve address resolution problems.

4. nbtstat

The nbtstat command is used for troubleshooting NetBIOS name resolution problems (basically for netBIOS services in local area networks).

NetBIOS (Network Basic Input/Output System) provides services related to the session layer of the OSI model allowing applications on seperate computers to commnicate over a local area network. NetBIOS over TCP/IP is a network protocol that allows legacy computer applications relying on NetBIOS API to be used on modern TCP/IP networks. NetBIOS provides three distinct services: name service, session service and datagram distribution service.

5. netstat

The netstat command can be used to display protocol stastics and current TCP/IP connections.

netstat -a : displays all connections.

netstat -r : displays the route table plus active connections.

netstat -e : displays Ethernet statistics.

netstat -s : displays per-protocol statistics.

netstat -n : addresses and port numbers are not converted to names.

6. tracert

Trace Route is a route-tracing utility that is used to determine the path that an IP datagram takes to reach a destination. The tracert command uses the IP time-to-live field and ICMP error messages to determine the route.

tracert [-d](specifies that IP address are not resolved to host name) [-h maximum_hops] [-j host-list] [-w timeout] target_name

7. pathping

The pathping command is a route tracing tool that combines features of the ping and tracert commands with additional information that neither of those tools provides.

The pathping command sends packets to each router on the way to a final destination over a period of time, and then computes results based on the packets returned from each hop. Since the command shows the degree of packet loss at any given router or link, it is easy to determine which routers or links might be causing network problems.

802.11 Trace File Analysis in NS2

1. 802.11 trace file format

NS2中802.11的trace功能利用cmu-trace对象来实现,并建议了一种新的trace格式,这种新格式目前是适用于无线网模拟,并且向前与老版本的trace格式兼容。下边分别看下新老两种trace格式:

1.1 New trace format

In order to use new trace format, the following command:

$ns use-newtrace

must be called before the universal trace command $ns trace-all .

An example of the new trace format is as following:



The new trace format can be divided into following fields:

1). Event type. the first field describes the type of event taking place at the nodeand can be one of the four types:
s - send
r - receive
d - drop
f - forward

2). General tag. The second field starting with "-t" may stand for time or global setting.
-t time
-t * (global setting)

3). Next hop info. This field provides next hop info and the tag starts with a leading "-H".
-Hs: id for this node
-Hd: id for next hop towards the destination.

4). Node property tags. This field denotes the node properties like node-id, the level at which tracing is being done like agent, router or MAC. The tags start with a leading "-N" and are listed as below:
-Ni: node id
-Nx: node’s x-coordinate
-Ny: node’s y-coordinate
-Nz: node’s z-coordinate
-Ne: node energy level
-Nl: trace level, such as AGT, RTR, MAC
-Nw: reason for the event. The different reasons for dropping a packet are given below:
"END" DROP_END_OF_SIMULATION
"COL" DROP_MAC_COLLISION
"DUP" DROP_MAC_DUPLICATE
"ERR" DROP_MAC_PACKET_ERROR
"RET" DROP_MAC_RETRY_COUNT_EXCEEDED
"STA" DROP_MAC_INVALID_STATE
"BSY" DROP_MAC_BUSY
"NRTE" DROP_RTR_NO_ROUTE i.e no route is available.
"LOOP" DROP_RTR_ROUTE_LOOP i.e there is a routing loop
"TTL" DROP_RTR_TTL i.e TTL has reached zero.
"TOUT" DROP_RTR_QTIMEOUT i.e packet has expired.
"CBK" DROP_RTR_MAC_CALLBACK
"IFQ" DROP_IFQ_QFULL i.e no buffer space in IFQ.
"ARP" DROP_IFQ_ARP_FULL i.e dropped by ARP
"OUT" DROP_OUTSIDE_SUBNET i.e dropped by base stations on receiving routing updates from nodes outside its domain.

5). Packet info at MAC level. This field gives MAC layer information and starts with a leading "-M" as shown below:
-Ma: duration
-Md: dst’s ethernet address
-Ms: src’s ethernet address
-Mt: ethernet type

6). Packet information at IP level. The tags for this field start with a leading "-I" and are listed along with their explanations asfollowing:
-Is: source address.source port number
-Id: dest address.dest port number
-It: packet type
-Il: packet size
-If: flow id
-Ii: unique id
-Iv: ttl value

7). Packet info at "Application level". The packet information at application level consists of the type of application like ARP,TCP, the type of adhoc routing protocol like DSDV, DSR, AODV etc being traced. This field consists of a leading "-P" and list of tags for different application is listed as below:
-P arp Address Resolution Protocol. Details for ARP is given by the following tags:
-Po: ARP Request/Reply
-Pm: src mac address
-Ps: src address
-Pa: dst mac address
-Pd: dst address

-P dsr This denotes the adhoc routing protocol called Dynamic source routing. Information on DSR is represented bythe following tags:
-Pn: how many nodes traversed
-Pq: routing request flag
-Pi: route request sequence number
-Pp: routing reply flag
-Pl: reply length
-Pe: src of srcrouting->dst of the source routing
-Pw: error report flag ?
-Pm: number of errors
-Pc: report to whom
-Pb: link error from linka->linkb

-P cbr Constant bit rate. Information about the CBR application is represented by the following tags:
-Pi: sequence number
-Pf: how many times this pkt was forwarded
-Po: optimal number of forwards

-P tcp Information about TCP flow is given by the following subtags:
-Ps: seq number
-Pa: ack number
-Pf: how many times this pkt was forwarded
-Po: optimal number of forwards

This field is still under development and new tags shall be added for other applications as they get included along theway.

1.2 Old trace format

By default, NS2 uses old trace format in 802.11 simulation.

An example of the old trace format is as following:

The old trace format can be divided into following fields:

1). ACTION [s r D] s - sent, r - received, D - dropped

2). WHEN: the time when the action happened

3). WHERE: the node where the action happened

4). LAYER: AGT -- application,

RTR -- routing,

LL -- link layer (ARP is done here) ,

IFQ -- outgoing packet queue (between link and mac layer),

MAC -- mac,

PHY -- physical

5). SEQNO: the sequence number of the packet

6). TYPE: the packet type

cbr -- CBR data stream packet

DSR -- DSR routing packet (control packet generated by routing)

RTS -- RTS packet generated by MAC 802.11

ARP -- link layer ARP packet

7). SIZE: the size of packet at current layer, when packet goes down, size increases, goes up size decreases

[a b c d]: a -- the packet duration in mac layer header

b -- the mac address of destination

c -- the mac address of source

d -- the mac type of the packet body

8). flags:

[......]: [

source node ip : port_number

destination node ip (-1 means broadcast) : port_number

ip header ttl

ip of next hop (0 means node 0 or broadcast)

]


2. Analyzing by using perl

3. Tools for trace analysis