Monday, April 21, 2008

Windows Commands 1

ping - a computer network tool used to test whether a particular host is reachable across an IP network.

usage : ping ${IPADDR}

example : ping 192.168.0.1

The sample results showns will be as :

Pinging 192.168.0.1 with 32 bytes of data:

Reply from 192.168.0.1: bytes=32 time=2ms TTL=60
Reply from 192.168.0.1: bytes=32 time=1ms TTL=60
Reply from 192.168.0.1: bytes=32 time=1ms TTL=60
Reply from 192.168.0.1: bytes=32 time=1ms TTL=60

Ping statistics for 192.168.0.1:
    Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
    Minimum = 1ms, Maximum = 2ms, Average = 1ms

tracert - a command used to determine the route taken by packets across an IP network.

usage : tracert ${IPADDR}

example : tracert yahoo.com

 

ipconfig - a command to display the network settings currently assigned and given by a network.

usage : ipconfig

example : ipconfig

Additional options : ipconfig/all, ipconfig/renew, ipconfig/release

 

arp - a command to show/remove the ARP informations

usage : arp -a

example : arp -d

sample result :

Interface: 192.168.0.188 --- 0x3
  Internet Address      Physical Address      Type
  192.168.0.254         00-02-44-73-ed-64     dynamic

Additional options : arp -d ( to remove and refresh the ARP table )

 

route - a command to display/add/remove routing table

To show the routing table

usage : route PRINT

example : route PRINT

To add a static route

usage : route ADD ${NETWORK} MASK ${NETMASK}  ${GATEWAY} METRIC ${METRIC} IF ${INTERFACE}

example : route ADD 10.100.132.0 MASK 255.255.255.0 192.168.0.2 METRIC 3 IF 2

To remove a route

usage : route DELETE ${NETWORK} MASK ${NETMASK}  ${GATEWAY} METRIC ${METRIC} IF ${INTERFACE}

example : route DELETE 10.100.132.0

To change a route

usage : route CHANGE ${NETWORK} MASK ${NETMASK}  ${GATEWAY} METRIC ${METRIC} IF ${INTERFACE}

example : route CHANGE 10.100.132.0 MASK 255.255.255.0 192.168.0.2 METRIC 3 IF 2

 

pathping - a command with combinations of ping and tracert.

This command have more advantages comparing to tracert and ping as it provides statistics between each nodes from end-to-end but it has disadvantage whereby it would takes up more than 5 minutes to accumulate the results.

usage : pathping ${IPADDR}

example : pathping yahoo.com

The results showns will be as :

Tracing route to yahoo.com [216.109.112.135]
over a maximum of 30 hops:
  0  joseph [192.168.0.54]
  1  192.168.0.1
  2  .....
  3  .....
  4  .....
  5  .....
  6  gi0-1.gw1.kul1.asianetcom.net [202.147.48.193]
  7  gi2-0-0.gw3.kul1.asianetcom.net [202.147.48.146]
  8  po12-3.gw2.sin1.asianetcom.net [202.147.48.210]
  9  po15-0-1.cr1.nrt1.asianetcom.net [202.147.32.90]
10  po1-0.gw1.sjc1.asianetcom.net [202.147.50.133]
11  PAT2.SJC.yahoo.com [206.223.116.16]
12  so-0-0-0.pat2.da3.yahoo.com [216.115.101.139]
13  so-1-0-0.pat2.dcp.yahoo.com [216.115.101.154]
14  ge-1-0-0-p121.msr1.dcn.yahoo.com [216.115.108.51]
15  ge2-2.bas1-m.dcn.yahoo.com [216.109.120.142]
16  w2.rc.vip.dcn.yahoo.com [216.109.112.135]

Computing statistics for 400 seconds...
Source to Here   This Node/Link Hop  RTT    Lost/Sent = Pct  Lost/Sent = Pct  Address
  0  joseph [192.168.0.54]    0/ 100 =  0%   |
  1   14ms     0/ 100 =  0%     0/ 100 =  0%  192.168.0.1     0/ 100 =  0%   |
  2   35ms     0/ 100 =  0%     0/ 100 =  0%  ....

  3   25ms     1/ 100 =  1%     1/ 100 =  1%  ....                              

....and so on...

By using this command, you can have better analysis on the "lost" may have along the paths with how many packets are loss over 100 samples ping.

 

netsh dump - Dump all the network information as a script to the screen.

usage : netsh dump

With this command you can gather all the informations for your network devices. You may also dump all the informations into a text file for easier references.

usage : netsh dump > dump.txt

netsh interface ip - Configure the IP settings

To show IP config

Besides using the conventional "ipconfig/all", you may also use this command for all the IP settings informations .

usage : netsh interface ip show config

example : netsh interface ip show config

Sample result as below :

Configuration for interface "Local Area Connection"
    DHCP enabled:                         No
    IP Address:                           192.168.0.188
    SubnetMask:                           255.255.255.0
    Default Gateway:                      192.168.0.1
    GatewayMetric:                        1
    InterfaceMetric:                      0
    Statically Configured DNS Servers:    203.158.24.18
                                          203.158.28.18
    Statically Configured WINS Servers:   None
    Register with which suffix:           Both primary and connection-specific

Configuration for interface "Wireless Network Connection"
    DHCP enabled:                         Yes
    InterfaceMetric:                      0
    Statically Configured DNS Servers:    203.158.28.18
    WINS servers configured through DHCP: None
    Register with which suffix:           Primary only

To configure static IP address

usage : netsh interface ip set address "${ETHERNETADAPTOR}" static ${IPADDRE} ${SUBNETMASK} ${GATEWAY} ${METRIC}

example : netsh interface ip set address "Local Area Connection" static 192.168.0.188 255.255.255.0 192.168.0.1 1

To configure dhcp IP address

usage : netsh interface ip set address "${ETHERNETADAPTOR}" dhcp

example : netsh interface ip set address "Wireless Network Connection" dhcp

No comments: