Some Basic Network
Commands:
By Hilmi
OLGUN
General Note: Firstly most of those commands
run on any operating system (UNIX, Solaris, windows).And to test those
commands
the TCP/IP protocol must be installed on the
system(Generally it is already installed).And some services must be started, to
do that(assuming that you are using windows2000 or XP) from control
panelàadministrative toolsàservices you can start/stop any services from
there manually or automatically.
About this document each time when you see the
line “C:\Documents
and Settings\sysadm>” it means that we are using(on) command prompt-line. And additionally remember that
each command belongs(or works under) to a protocol and
it is possible that you might have not learnt those protocols until now ,DON’T
WORRY you will learn each protocol when the time arrives. The aim of this
document is to give you some knowledge about network
commands.
1-)arp :
When we
need an Ethernet (MAC) address we can use arp(address resolution
protocol).
In other
words it shows the physical address of an host.
Example:
C:\Documents and Settings\sysadm>arp -a
Interface:
169.254.195.199 --- 0x2
Internet Address Physical
Address
Type
216.109.127.60
00-53-45-00-00-00
static
2-)nslookup:
Displays information from Domain Name System
(DNS) name servers.
Example:
C:\Documents and Settings\sysadm>nslookup
itu.dk
Server:
ns3.inet.tele.dk
Address:
193.162.153.164
Non-authoritative answer:
Name: itu.dk
Address:
130.226.133.2
NOTE :If you write the command as above it shows as default your pc's server name
firstly.
C:\Documents and Settings\sysadm>nslookup mail.yahoo.com
itu.dk
Server:
superman.itu.dk
Address:
130.226.133.2
Non-authoritative answer:
Name:
login.yahoo.akadns.net
Address:
216.109.127.60
Aliases:
mail.yahoo.com, login.yahoo.com
NOTE:Remark that in the second example we do not see the
default server name.
There are
many nslookup with optional commands.To read them type nslookup and enter
then type help and enter.
3-)finger:
Displays the
information about a user on the system.
Example:
NOTE :I could not find out the name of the server that
we log on (windows) at the school.
Sysadmin does not know that either:o)
But as an
example I tried it on the our unix server.
[hilmiolgun@ssh hilmiolgun]$ finger
Login Name
Tty Idle Login
Time Office Office Phone
adel Adel Abu-Sharkh pts/1 7 Sep 10
adel Adel Abu-Sharkh pts/2 9 Sep 9
hilmiolgun Hilmi Olgun
pts/9
hm
Hanne Munkholm
pts/6
jcg Jens
Christian Godsk
pts/4 1d Sep 8
kaj
Kenneth Ahn Jensen pts/7
Sep 10
root root
pts/8
1 Sep 10
troels Troels Arvin
pts/5
webclaus
Claus Bech Rasmussen pts/0 6 Sep 10
NOTE :What I did is :I first check the online users,and get a list of them(above).
Then i just choosed one user to get
information about him(below)
[hilmiolgun@ssh hilmiolgun]$ finger hm
Login: hm
Name: Hanne Munkholm
Directory:
/import/home/hm
Shell: /bin/bash
On since
Mon Sep 8
1 hour 56 minutes idle
Last login
Tue Sep 9
New mail
received Mon Nov 11
Unread since
Plan:
World Domination... fast.
[hilmiolgun@ssh hilmiolgun]$
4-)ping:
Simpy shows if the remote machine is available or
not....
Example:
C:\Documents and Settings\sysadm>ping webmail.itu.dk
Pinging
tarzan.itu.dk [130.226.133.3] with 32 bytes of data:
Reply from
130.226.133.3: bytes=32 time=29ms TTL=55
Reply from
130.226.133.3: bytes=32 time=30ms TTL=55
Reply from
130.226.133.3: bytes=32 time=30ms TTL=55
Reply from
130.226.133.3: bytes=32 time=30ms TTL=55
Ping
statistics for 130.226.133.3:
Packets: Sent = 4, Received
= 4, Lost = 0 (0% loss),
Approximate
round trip times in milli-seconds:
Minimum = 29ms, Maximum =
30ms, Average = 29ms
NOTE :Remark that the remote machine is replying.Otherwise the output will be "Request time out"
which means the
remote machine is not working well.(Not
answering)
5-)tracert:
It simply
shows the path between source and destination address.
Example:
C:\Documents and Settings\sysadm>tracert
webmail.itu.dk
Tracing
route to tarzan.itu.dk [130.226.133.3]
over a maximum of 30 hops:
1 *
*
* Request
timed out.
2 29 ms 19 ms 29 ms
ge-0-2-1-2.1000M.albnxu1.ip.tele.dk
[195.249.1.2
9]
3 29 ms 29 ms 19 ms pos1-0.622M.lynxg1.ip.tele.dk
[195.249.2.46]
4 29 ms
19 ms 29 ms
herman.fsknet.lyngby.forskningsnettet.dk [192.38
.7.1]
5 29
ms
29 ms 19 ms
130.225.244.214
6 29
ms
29 ms 29 ms
1.ku.forskningsnettet.dk [130.225.245.90]
7 29
ms
29 ms 29 ms
rk.itu.forskningsnettet.dk [130.226.249.30]
8 29 ms 29 ms 29 ms
130.225.245.86
9 29 ms 29 ms 29 ms tarzan.itu.dk
[130.226.133.3]
Trace complete.
6-)ftp:
For file
transferring..(File transfer
protocol)
Example:Lets you dont have an ftp
software and you want to get a file from your school harddisk.
So to do
that:
C:\Documents and Settings\sysadm>ftp
ftp> open
To
ftp.itu.dk
Connected to ssh.itu.dk.
220 ProFTPD 1.2.8rc2 Server (ProFTPD
Default Installation) [ssh.it-c.dk]
NOTE:What am I doing is simply:typing them one-by-one(after each typing remember to
enter)
ftp,open,ftp.itu.dk
User (ssh.itu.dk:(none)): hilmiolgun
331
Password required for hilmiolgun.
Password:
230 User
hilmiolgun logged in.
NOTE:The server will require username and
password..
ftp> help
Commands
may be abbreviated. Commands
are:
!
delete
literal
prompt
send
?
debug
ls
put
status
append
dir
mdelete
pwd
trace
ascii
disconnect
mdir
quit
type
bell
get
mget
quote
user
binary
glob
mkdir
recv
verbose
bye
hash
mls
remotehelp
cd
help
mput
rename
close
lcd
open
rmdir
ftp> help dir
dir
List contents of remote directory
NOTE: If it is your first time to those commands
just type help and get the commands.If you dont know how to use
them type help commandname..
ftp> dir
200 PORT
command successful
150 Opening
ASCII mode data connection for file list
drwx------ 4 hilmiolgun hilmiolgun 155 Jul 1 14:02 Desktop
drwx------ 2 hilmiolgun hilmiolgun 4096 May 30 10:21 Mail
drwxr-xr-x 5 hilmiolgun hilmiolgun 90 Sep 2 02:59
MobilePositionSDK
drwx------ 7 hilmiolgun hilmiolgun 4096 Aug 8 2002 NTnetscape
drwxr--r-- 13 hilmiolgun
hilmiolgun
4096 Sep 4 01:56 New Folder
-rw-rw-r-- 1 hilmiolgun hilmiolgun 74
Sep 9
12:56 TTI409B
drwx------ 2 hilmiolgun hilmiolgun 6
Jan 21 2002 cgi-bin
-rw-rw-r-- 1 hilmiolgun hilmiolgun 74
Sep 9
12:56 geu
-rw-rw-r-- 1 hilmiolgun hilmiolgun 74
Sep 9
12:56 hilmiolgun
drwxr-xr-x 6 hilmiolgun hilmiolgun 4096 Aug 14 15:59 image
drwxr-xr-x 3 hilmiolgun hilmiolgun 4096 Jul 29 16:03
jmf20-apidocs
drwxr-xr-x 4 hilmiolgun hilmiolgun 4096 Sep 9 14:10 NOTEsieee
drwx------ 2 hilmiolgun hilmiolgun 6
Feb 21
2002 nsmail
drwx------ 3 hilmiolgun hilmiolgun 103 Feb 21 2002
office52
drwx------ 2 hilmiolgun hilmiolgun 6
Jan 21 2002 private
drwxr--rwx 2 hilmiolgun hilmiolgun 4096 Aug 23 12:02 public_html
drwxr-xr-x 5 hilmiolgun hilmiolgun 4096 Sep 6 03:30
speech
-rw-rw-r-- 1 hilmiolgun hilmiolgun 2630 Sep 9 13:58
test.txt
-rw-rw-r-- 1 hilmiolgun hilmiolgun 148 Sep 9
226
Transfer complete.
ftp: 1318 bytes received in 0,24Seconds
5,49Kbytes/sec.
ftp> get testing.txt
200 PORT
command successful
150 Opening
ASCII mode data connection for testing.txt (148 bytes)
226
Transfer complete.
ftp: 161 bytes received in 0,02Seconds
8,05Kbytes/sec.
NOTE :After taking a look to the school harddisk ,I copied a file "testing.txt" to my local harddisk....
ftp> !dir
Volume in drive C has no
label.
Volume Serial Number is
0868-D52D
Directory of C:\Documents and
Settings\sysadm
8 File(s)
96.695 bytes
13 Dir(s)
3.842.056.192 bytes free
ftp> send love.wav
200 PORT
command successful
150 Opening
ASCII mode data connection for love.wav
226
Transfer complete.
ftp: 80140 bytes sent in 3,97Seconds
20,21Kbytes/sec.
ftp> dir
200 PORT
command successful
150 Opening
ASCII mode data connection for file list
drwx------ 4 hilmiolgun hilmiolgun 155 Jul 1 14:02 Desktop
drwx------ 2 hilmiolgun hilmiolgun 4096 May 30 10:21 Mail
drwxr-xr-x 5 hilmiolgun hilmiolgun 90 Sep 2 02:59
MobilePositionSDK
drwx------ 7 hilmiolgun hilmiolgun 4096 Aug 8 2002 NTnetscape
drwxr--r-- 13 hilmiolgun
hilmiolgun
4096 Sep 4 01:56 New Folder
-rw-rw-r-- 1 hilmiolgun hilmiolgun 74
Sep 9
12:56 TTI409B
drwx------ 2 hilmiolgun hilmiolgun 6
Jan 21 2002 cgi-bin
-rw-rw-r-- 1 hilmiolgun hilmiolgun 74
Sep 9
12:56 geu
-rw-rw-r-- 1 hilmiolgun hilmiolgun 74
Sep 9
12:56 hilmiolgun
drwxr-xr-x 6 hilmiolgun hilmiolgun 4096 Aug 14 15:59 image
drwxr-xr-x 3 hilmiolgun hilmiolgun 4096 Jul 29 16:03
jmf20-apidocs
-rw-rw-r-- 1 hilmiolgun hilmiolgun 80137 Sep 9 22:36
love.wav
drwxr-xr-x 4 hilmiolgun hilmiolgun 4096 Sep 9 14:10
NOTEsieee
drwx------ 2 hilmiolgun hilmiolgun 6
Feb 21
2002 nsmail
drwx------ 3 hilmiolgun hilmiolgun 103 Feb 21 2002
office52
drwx------ 2 hilmiolgun hilmiolgun 6
Jan 21 2002 private
drwxr--rwx 2 hilmiolgun hilmiolgun 4096 Aug 23 12:02 public_html
drwxr-xr-x 5 hilmiolgun hilmiolgun 4096 Sep 6 03:30
speech
-rw-rw-r-- 1 hilmiolgun hilmiolgun 2630 Sep 9 13:58
test.txt
-rw-rw-r-- 1 hilmiolgun hilmiolgun 148 Sep 9
226
Transfer complete.
ftp: 1387 bytes received in 0,07Seconds
19,81Kbytes/sec.
ftp>
NOTE:At the end first looking at the local
working directory and sending a file "love.wav" to the
school harddisk.
7-)net:
It has
many options,which are for checking/starting/stopping
nt services,users,messaging,configuration and so
on...
Some of
those options require administration privileges..
Example:
NOTE: To have an overview of commands
options....
C:\Documents and Settings\sysadm>net
The syntax
of this command is:
NET [ ACCOUNTS | COMPUTER | CONFIG | CONTINUE | FILE | GROUP |
HELP |
HELPMSG |
LOCALGROUP | NAME | PAUSE | PRINT | SEND | SESSION |
SHARE | START |
STATISTICS | STOP | TIME | USE | USER | VIEW
]
NOTE: And furthermore to get an overview of a
specific option ...
C:\Documents and Settings\sysadm>net help print
The syntax
of this command is:
NET
PRINT
\\computername\sharename
[\\computername] job# [/HOLD | /RELEASE | /DELETE]
NET PRINT
displays print jobs and shared queues.
For each
queue, the display lists jobs, showing the size
and status of each job, and the status of the
queue.
\\computername
Is the name of the computer sharing the
printer
queue(s).
sharename
Is the name of the shared printer queue.
job#
Is the identification number assigned to a print
job. A computer with one or more printer
queues
assigns each print job a unique
number.
/HOLD
Prevents a job in a queue from printing.
The
job stays in the printer queue, and other
jobs bypass it until it is
released.
/RELEASE
Reactivates a job that is held.
/DELETE
Removes a job from a queue.
NET HELP
command | MORE displays Help one screen at a time.
Finally in
addition to above there are also those commands: hostname ,lpq,
lpr ,rsh ,tftp ,nbstat ,netstat.
To get
familiar with those commands simply type commandname /? at the
command line.
You can
send any questions about this document to hilmiolgun@itu.dk