|
|
|
|
|
|
|
|
|
|
|
Networking in UNIX
|
|
|
Networkig UNIX is as old as the UNIX itself, is was rather networkig in UNIX that made it so popular. |
|
|
|
|
|
Connecting to remote machines
|
|
|
|
|
|
- Telnet is a utility that allows a computer user at one site to make a connection, login and then conduct work on a computer at another site.
- Telnet is used to access many of the Internet resources, such as databases, libraries and computers
|
|
|
|
|
|
Example telnet session:
|
|
|
|
|
|
% telnet asic-world
Trying asic-world...
Connected to asic-world.
Escape character is '^]'.
Telnet Server
login: deepak
Password:
Last login: Sat Dec 10 17:27:14 on :0
[deepak@asic-world deepak]$
{ do some work }
asic-world% exit
Connection closed.
|
|
|
|
|
|
Note:See the telnet man page for details. |
|
|
|
|
|
Email utilities
|
|
|
There are many mail utilities around, but unix provides powerfull and lightweight mail clients like pine, elm, mutt, mail. Here we will see mail- |
|
|
|
|
|
mail is the standard UNIX utility for sending and receiving email. It can be invoked by typing mail in shell as below. |
|
|
|
|
|
$ mail
Mail version 8.1 6/6/93. Type ? for help.
"/var/spool/mail/will": 1 messages 1 new
1 deepak@asic-world.com Sat Dec 10 10:37 "Hi"
&
|
|
|
|
|
|
Some of the more important commands are shown in below table. Here a messagelist is either a single message specified by a number (e.g. 1) or a range (e.g. 1-2). The special messagelist * matches all messages. |
|
|
|
|
|
Command
|
Description
|
?
|
help
|
q
|
quit, saving changes to mailbox
|
x
|
quit, restoring mailbox to its original state
|
t
|
messagelist displays messages
|
+/-
|
show next/previous message
|
d
|
messagelist deletes messages
|
u
|
messagelist undelete messages
|
m
|
address send a new email
|
r
|
messagelist reply to sender and other receipients
|
R
|
messagelist reply only to sender
|
|
|
|
|
|
|
You can also use mail to send email directly from the command line. For example: |
|
|
|
|
|
$ <b>mail -s "Hi" deepak@asic-world.com < message.txt</b>
$
|
|
|
|
|
|
emails the contents of the (ASCII) file message.txt to the recipient deepak@deepak@asic-world.com with the subject "Hi". |
|
|
|
|
|
|
|
|
|
|
|
Network Related Utilities
|
|
|
Several UNIX utilities are especially useful for users computing in a networked, distributed environment. Additional tools for System Administrators are available but not discussed here. |
|
|
|
|
|
ping
|
|
|
The ping command sends an echo request to a network host. It is useful for: |
|
|
|
|
|
- Determining the status of the network and various foreign hosts.
- Tracking and isolating hardware and software problems.
- Testing, measuring, and managing networks.
|
|
|
|
|
|
The ping command sends one datagram per second and prints one line of output for every response received. Round-trip times and packet loss statistics are calculated and displayed. |
|
|
|
|
|
Example: |
|
|
|
|
|
% ping asic-world.com
PING asic-world.com: (216.193.202.224): 56 data bytes
64 bytes from 216.193.202.224: icmp_seq=0 ttl=254 time=3 ms
64 bytes from 216.193.202.224: icmp_seq=1 ttl=254 time=2 ms
64 bytes from 216.193.202.224: icmp_seq=2 ttl=254 time=2 ms
64 bytes from 216.193.202.224: icmp_seq=3 ttl=254 time=2 ms
64 bytes from 216.193.202.224: icmp_seq=4 ttl=254 time=2 ms
64 bytes from 216.193.202.224: icmp_seq=5 ttl=254 time=2 ms
^C
----asic-world.com PING Statistics----
6 packets transmitted, 6 packets received, 0% packet loss
round-trip min/avg/max = 2/2/3 ms
|
|
|
|
|
|
traceroute
|
|
|
The traceroute command prints the route that IP packets take to a network host. It is intended for use in network testing, measurement, and management. |
|
|
|
|
|
Example: |
|
|
|
|
|
% traceroute google.co.in
traceroute to google.co.in (216.239.37.99), 30 hops max, 38 byte packets
1 202.142.120.98 (202.142.120.98) 1.588 ms 1.689 ms 1.491 ms
2 10.0.0.1 (10.0.0.1) 12.825 ms 12.439 ms 15.925 ms
3 202.142.121.1 (202.142.121.1) 14.213 ms 10.987 ms 15.898 ms
4 202-149-60-105.exatt.net (202.149.60.105) 17.171 ms 14.287 ms 13.338 ms
5 61.246.219.249 (61.246.219.249) 27.343 ms 22.542 ms 19.212 ms
6 59.145.148.98 (59.145.148.98) 22.154 ms 22.104 ms 23.690 ms
7 203.101.100.33 (203.101.100.33) 30.740 ms 28.606 ms 27.249 ms
8 59.145.6.38 (59.145.6.38) 26.138 ms 30.615 ms 38.257 ms
9 203.208.168.169 (203.208.168.169) 257.947 ms 264.389 ms 274.618 ms
10 203.208.168.250 (203.208.168.250) 256.995 ms 252.338 ms 252.616 ms
11 66.249.94.8 (66.249.94.8) 327.047 ms 252.896 ms 258.017 ms
12 72.14.236.8 (72.14.236.8) 252.010 ms 257.420 ms 256.055 ms
13 216.239.46.45 (216.239.46.45) 306.595 ms 302.920 ms 313.127 ms
14 66.249.95.247 (66.249.95.247) 309.950 ms 324.506 ms 311.089 ms
15 66.249.94.232 (66.249.94.232) 320.078 ms 320.445 ms 318.167 ms
16 66.249.95.122 (66.249.95.122) 323.582 ms 322.555 ms 322.189 ms
17 64.233.174.125 (64.233.174.125) 325.523 ms 321.032 ms 326.639 ms
18 216.239.48.94 (216.239.48.94) 323.057 ms 326.882 ms 216.239.37.99
(216.239.37.99) 320.201 ms
|
|
|
|
|
|
Warning: Because of the load traceroute imposes on the network, the traceroute command should not be used during normal operations or from automated scripts. The traceroute utility may not be available on all systems. |
|
|
|
|
|
ftp
|
|
|
ftp stands for File Transfer Protocol. File transfer provides a means for you to obtain computer files (text, image, sound, etc.) from other computers over the network. ftp can also be used to send (upload) files from your computer to another computer, providing you have write permission or a real account on the machine you are uploading. |
|
|
|
|
|
The ftp utility has its own set of UNIX like commands which allow you to perform tasks such as: |
|
|
|
|
|
- Connect and login to a remote host
- Navigate directories
- List directory contents
- Put and get files
- Transfer files as ascii, ebcdic or binary
|
|
|
|
|
|
Example : Typical ftp session |
|
|
|
|
|
% ftp asic-world.com
Connected to asic-world.com.
220---------- Welcome to Pure-FTPd [TLS] ----------
220-You are user number 4 of 50 allowed.
220-Local time is now 05:04. Server port: 21.
220 You will be disconnected after 15 minutes of inactivity.
Name (asic-world.com:deepak): deepak
331 User deepak OK. Password required
Password:
230 User deepak logged in.
ftp> dir
200 PORT command successful.
150 Opening data connection for /bin/ls.
total 1464
drwxr-sr-x 3 deepak asic 1024 Mar 11 20:04 verilog
drwxr-sr-x 2 deepak asic 1536 Mar 3 18:07 specman
drwxr-sr-x 5 deepak asic 512 Dec 7 10:59 vhdl
drwxr-sr-x 2 deepak asic 1024 Mar 11 15:24 soc
drwxr-sr-x 5 deepak asic 3072 Mar 13 16:10 systemverilog
-rw-r--r-- 1 deepak asic 671 Mar 15 10:57 file_list.txt
drwxr-sr-x 3 deepak asic 512 Jan 5 13:32 ftp
drwxr-sr-x 3 deepak asic 512 Feb 10 10:17 www
226 Transfer complete.
ftp> get file_list.txt
200 PORT command successful.
150 Opening data connection for file_list.txt (671 bytes).
226 Transfer complete.
671 bytes received in 0.2 seconds (128.1 Kbytes/s)
ftp> quit
221 Goodbye.
|
|
|
|
|
|
Many computers on the Internet permit anonymous ftp . You can login to these machines without a real account, to obtain files which have been made publicly available. Typically, the user name anonymous is used, coupled with your email address as the password. Anonymous ftp is usually restricted so that users can only see what the server permits them to see. Anonymous users do not have full privileges as would a user with a real computer account. |
|
|
|
|
|
rlogin, rsh, rcp
|
|
|
rlogin (remote login), rsh (remote shell) and rcp (remote copy) are three utilities which allow you to perform tasks on other machines without requiring the usual login authentication. All three utilities depend upon a .rhosts located in your home directory. |
|
|
|
|
|
Command
|
Description
|
rlogin
|
Allows you to login to a remote machine. It is nearly identical to telnet in function and appearance, however if your .rhosts file is setup accordingly, you will be able to login to your account on another machine wihout having to enter a userid and password.
|
rsh
|
The remote shell command can be used to execute a command on remote host or log into remote host. With the proper .rhosts file, authentication is not required.
|
rcp
|
Remote copy enables you to copy files between different systems. With the proper .rhosts file, authentication is not required.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|