Download IntroductionToUnix_S14 - Silicon Valley University

Document related concepts

Deep packet inspection wikipedia , lookup

Wake-on-LAN wikipedia , lookup

Airborne Networking wikipedia , lookup

Internet protocol suite wikipedia , lookup

Distributed firewall wikipedia , lookup

Remote Desktop Services wikipedia , lookup

Piggybacking (Internet access) wikipedia , lookup

List of wireless community networks by region wikipedia , lookup

Recursive InterNetwork Architecture (RINA) wikipedia , lookup

Cracking of wireless networks wikipedia , lookup

Zero-configuration networking wikipedia , lookup

Transcript
Introduction to UNIX /
Linux - 9
Dr. Jerry Shiao, Silicon Valley University
Summer 2015
SILICON VALLEY UNIVERSITY
CONFIDENTIAL
1
Introduction UNIX/Linux Course

Section 9
 Networking and Internetworking
 1960s, Advanced Research Projects Agency (ARPA) for
development of new technologies for military and public.
 1980s Wide Area Network, ARPANET connected academic
institutions and all U.S. military sites.
 Network Model: TCP/IP Protocol Suite
 Transport Layer: TCP and UDP
 Network Layer: Internet Protocol ( IP ) and IPV4 Addresses
 Domain Name Server: Translating Name to IP Address
 Internet Services and Protocols
 1990s Web Browser, Mosaic, developed at National Center
for Supercomputer Associations (NCSA).

Mosaic GUI: Netscape, Google, Internet Explorer, Mozilla.
 Client-Server Software
 Application Software
Summer 2015
Model
SILICON VALLEY UNIVERSITY
CONFIDENTIAL
2
Introduction UNIX/Linux Course


Networking and Internetworking
ARPANET
 1970s
US DoD Research Project of networking
between Universities and Research Laboratories.
 1982, prototype Internet using TCP/IP became
operational and in 1983, all U.S. military sites
connected to ARPANET was on the Internet.
 1991, first Web Browser, Mosaic, was developed by
National Center for Supercomputer Application
(NCSA).
 1995, World Wide Web browsing surpassed FTP as
the major use of the Internet.
 2010, over 75% planet connected by Internet.
 Most of networking protocols initially implemented on
UNIX platforms.
Copyright @2005 Pearson
Addison-Wesley
SILICON VALLEY UNIVERSITY
CONFIDENTIAL
3
Introduction UNIX/Linux Course



Networking and Internetworking
Computer Network: Two or more computer
hardware resources (computers, printers,
scanners, plotters, etc) are connected.
Category of Computer Networks:
 LANs:
Local Area Network connects hosts room,
building, or campus (up to 1 kilometers).
 MAN: Metropolitan Area Network connects hosts
within city or between cities (1 to 20 kilometers).
 WAN: Wide Area Network connects hosts within state
or country (10+ kilometers to 1,000+ kilometers).
 Internetworking or Internet: Network of networks
through routers or gateways.
Copyright @2005 Pearson
Addison-Wesley
SILICON VALLEY UNIVERSITY
CONFIDENTIAL
4
Introduction UNIX/Linux Course


Networking and Internetworking
Computer Network:
Network:
Six hosts connected
with Network Switch or
Router.
Internetwork:
Net1, Net2 = WAN
Net3 = MAN
Net4 = Campus LAN
Interconnected by
Network Routers.
Copyright @2005 Pearson
Addison-Wesley
SILICON VALLEY UNIVERSITY
CONFIDENTIAL
5
Introduction UNIX/Linux Course
 Networking and Internetworking
 Benefits of Computer Networks

Sharing of Computer Resources: Share printers, scanners, files
and application software (Peer-to-Peer file sharing).

Communication medium between people separated by distance.

Cost and Performance Efficency: Distributed Computing or
Cloud Computing, running related programs across network of
workstations and servers at the same time.

Data Warehousing: Repository of data consisting or integrated servers
network connected.


Data Mining: Data analysis of data from multiple sources network connected.

Big Data: Collection of large and complex data sets network connected.
Less Performance Degradation: Network of servers stays active,
even though some servers could fail.
Copyright @2005 Pearson
Addison-Wesley
SILICON VALLEY UNIVERSITY
CONFIDENTIAL
6
Introduction UNIX/Linux Course


Networking and Internetworking
Issues in Network Models:
Layer 1

Device /
Phys

Layer 2

Link
Layer 3
Network
Layer 4


Trnsport
Layer 5
Appl

1) Supporting Different Physical Communication Medium
(Ethernet NIC, Token Ring NIC, xDSL, etc.).
2) Supporting Different Topology of the Network ( bus or
Ethernet, ring or Token Ring, ATM, mesh, etc.).
3) Supporting protocols (or rules) to allow a host on a
network to access the physical medium (CSMA for
Ethernet).
4) Supporting protocols used for routing application data
from one host to another in a LAN/internetwork.
5) Supporting protocols for transporting data from a
process on a host to a process on another host on
LAN/internetwork.
6) Supporting protocols used by network-based software
for specific applications (telnet).
Copyright @2005 Pearson
Addison-Wesley
SILICON VALLEY UNIVERSITY
CONFIDENTIAL
7
Introduction UNIX/Linux Course


Networking and Internetworking
Network Models:
 ISO:
International Standards Organization’s Open
System Interconnect Reference Model (OSI 7-Layer
Reference Model).

Network Layer: CLNP (Connectionless Network Protocol)
using NSAPs (Network Service Access Points) to connect
end-systems (hosts) and intermediate systems (network
devices).
 TCP/IP:
Department of Defense Advanced Research
Projects Agency (ARPA) (TCP/IP 5-Layer Model).


Network Layer: IP 32-bit addressing to connect hosts.
TCP/IP Model currently used in the Internet and
is considered the Internet Protocol Model.
Copyright @2005 Pearson
Addison-Wesley
SILICON VALLEY UNIVERSITY
CONFIDENTIAL
8
Introduction UNIX/Linux Course


Networking and Internetworking
Network Models:
Copyright @2005 Pearson
Addison-Wesley
SILICON VALLEY UNIVERSITY
CONFIDENTIAL
9
Introduction UNIX/Linux Course



Networking and Internetworking
TCP/IP Protocol Suite:
Application layer consists of applications and
utilities that invoke various Internet Services.


Web Browsing, File Transfers, Remote Login, Electronic Mail.
Transport Layer:





Purpose is to transport application data to/from remote host.
UDP (User Datagram Protocol) is connectionless protocol and
does not guarantee reliable delivery.
TCP (Transmission Control Protocol) is connection oriented and
does guarantee reliable in-sequence delivery. Overhead in
establishing/maintaining connection.
TCP or UDP Port Numbers (16 bit or 0-65535) identify
processes using the protocol.
IANA (Internet Assigned Numbers Authority) manages the port
numbers. Ports 0-1023 are well-known ports.
Copyright @2005 Pearson
Addison-Wesley
SILICON VALLEY UNIVERSITY
CONFIDENTIAL
10
Introduction UNIX/Linux Course



Networking and Internetworking
TCP/IP Protocol Suite:
Transport Layer Applications:
Copyright @2005 Pearson
Addison-Wesley
SILICON VALLEY UNIVERSITY
CONFIDENTIAL
11
Introduction UNIX/Linux Course



Networking and Internetworking
TCP/IP Protocol Suite:
Network Layer:


Internet Protocol (IP) encapsulates TCP
segments and UDP datagrams into IP packet.



Responsible for routing application data to the destination host
using Internet Protocol (IP).
IP routing is Best Effort and does not guarantee delivery of TCP
or UDP packets.
IP packet has sender’s and receiver’s IP address.
IP Address



Three fields: Address Class, Network ID, Host ID.
Five address classes: Using Address Class field, Class A
(0:x:x:x), B(1:0:x:x), C(1:1:0:x), D(1:1:1:0), E(1:1:1:1:0)
Each class has different range of network and host IDs.
Copyright @2005 Pearson
Addison-Wesley
SILICON VALLEY UNIVERSITY
CONFIDENTIAL
12
Introduction UNIX/Linux Course


Networking and Internetworking
IPV4 Address Classes:
Copyright @2005 Pearson
Addison-Wesley
SILICON VALLEY UNIVERSITY
CONFIDENTIAL
13
Introduction UNIX/Linux Course


Networking and Internetworking
IPV4 Address Classes:
 Class A: 2power7 Networks, 2power24 Hosts
 Class A Networks limited (128).
 Assigned to large commercial organizations, MIT,
UCBerkeley, Bell Labs, NASA.
 Class B: 2power14 Networks, 2power16 Hosts
 Class B Networks larger (16384).
 Assigned to large commercial organizations, educational
institutions, IBM, Oracle, Oregon Graduate Institute, national
and international universities.
 Class C: 2power21 Networks, 2power8 Hosts
 Class C Networks very large (2097152).
 Assigned to individuals, small-to-medium-sized
organizations, local Internet Service Providers, small
consulting and software companies, community colleges, and
universities.
Copyright @2005 Pearson
Addison-Wesley
SILICON VALLEY UNIVERSITY
CONFIDENTIAL
14
Introduction UNIX/Linux Course



Networking and Internetworking
IPV4 Address Classes
Dotted Decimal Notation (DDN)


All four bytes of an IPV4 address are written in their decimal
equivalents and are separated by dots.
IP Address 32-bits

11000000011001100000101000010101
192

102
10
21
IP Address = 192.102.10.21
Copyright @2005 Pearson
Addison-Wesley
SILICON VALLEY UNIVERSITY
CONFIDENTIAL
15
Introduction UNIX/Linux Course


Networking and Internetworking
IPV4 Address Classes
NOTE: 127.x.x.x is the
local host, used by
system to send packet
back to itself.
NOTE: After DHCP
fails, Windows client
will assign itself Class
B (APIPA).
Automatic Private IP
Addressing:
169.254.x.x.
Class C Network
Class A Network
Class B Network
Copyright @2005 Pearson
Addison-Wesley
SILICON VALLEY UNIVERSITY
CONFIDENTIAL
16
Introduction UNIX/Linux Course

Networking and Internetworking

Symbolic Names




Management of IP addresses easier.
Unique for a host on the Internet.
Remains the same, even if the numeric IP address changes.
Format: hostname.domain_name






FQDN (Fully Qualified Domain Name) is host name attached to
the domain name with a period between them.
Domain Name assigned by Internet Network Information Center
(NIC).
Top-Level Domain is right-most string.
Organization is string to the left of the right-most period.
Another string assigned to the left of the Organization to keep
“Organization.Top-Level-Domain” unique.
Three levels of Top-Level Domains: special, generic, and
country-code.
Copyright @2005 Pearson
Addison-Wesley
SILICON VALLEY UNIVERSITY
CONFIDENTIAL
17
Introduction UNIX/Linux Course

Networking and Internetworking

Top-Level Internet Domains
Copyright @2005 Pearson
Addison-Wesley
SILICON VALLEY UNIVERSITY
CONFIDENTIAL
18
Introduction UNIX/Linux
Course

Networking and
Internetworking

Top-Level Internet
Domains
Copyright @2005 Pearson
Addison-Wesley
SILICON VALLEY UNIVERSITY
CONFIDENTIAL
19
Introduction UNIX/Linux Course

Networking and Internetworking

Top-Level Internet Domain Name Hierarchy
svuca
[email protected]
Domain_name or Top-Level Domain
Hostname controlled by site allocated
Domain_name by NIC.
Copyright @2005 Pearson
Addison-Wesley
SILICON VALLEY UNIVERSITY
CONFIDENTIAL
20
Introduction UNIX/Linux Course

Networking and Internetworking

Domain Name System (DNS)
DNS implements distributed database of name-toaddress mapping.




Name Servers: Dedicated hosts that take requests from any
client software and maps domain name to IP address.
Berkeley Internet Name Domain (BIND) Program.
 Application calls gethostbyname() and gethost byaddr().
UNIX Static Host File
/etc/hosts
# Internet Host Table
127.0.0.1
localhost.localdomain localhost
203.128.0.6
yamsrv1.ece.gatech.edu loghost
…

Copyright @2005 Pearson
Addison-Wesley
SILICON VALLEY UNIVERSITY
CONFIDENTIAL
21
Introduction UNIX/Linux Course

Networking and Internetworking

Network Utilities
ifconfig –a


View IP address and other information about the interfaces to the network.

$ /sbin/ifconfig -a
eth0
Link encap:Ethernet HWaddr 00:0C:29:5B:F0:D8
inet addr:192.168.1.83 Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: fe80::20c:29ff:fe5b:f0d8/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
< Statistics >
...
lo
Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
< Statistics >
...
Copyright @2005 Pearson
Addison-Wesley
SILICON VALLEY UNIVERSITY
CONFIDENTIAL
22
Introduction UNIX/Linux Course

Networking and Internetworking

Network Utilities
host Command


Display IP address(es) for a domain name or vice versa.
$ host www.google.com
www.google.com has address 74.125.227.114
www.google.com has address 74.125.227.115
www.google.com has address 74.125.227.116
www.google.com has address 74.125.227.112
www.google.com has address 74.125.227.113
www.google.com has IPv6 address 2607:f8b0:4000:800::1014

$ host 74.125.227.114
114.227.125.74.in-addr.arpa domain name pointer dfw06s16-in-f18.1e100.net.

$ host www.svuca.edu
www.svuca.edu has address 71.129.127.99

Copyright @2005 Pearson
Addison-Wesley
SILICON VALLEY UNIVERSITY
CONFIDENTIAL
23
Introduction UNIX/Linux Course

Networking and Internetworking

Network Utilities
dig [ option ]

/etc/resolv.conf created by
network admin or by
application that contains
directives with IP
addresses of name servers
available to a host.
Used by the BIND DNS
Resolver Library.

Interact with name servers specified in /etc/resolv.conf and display their
responses. Replaces host command.
 - f file : For batch operation, take domain names (or IP addresses) from “file”.
 -p port : Interact with a name server at “port” instead of default port 53.
$ cat /etc/resolv.conf
### /etc/resolv.conf file autogenerated by netconfig!
#
# Before you change this file manually, consider to define the
# static DNS configuration using the following variables in the
# /etc/sysconfig/network/config file:
...
### Please remove (at least) this line when you modify the file!
nameserver 68.94.156.1
nameserver 68.94.157.1
nameserver 192.168.1.254
$
Copyright @2005 Pearson
Addison-Wesley
SILICON VALLEY UNIVERSITY
CONFIDENTIAL
24
Introduction UNIX/Linux Course

Networking and
Internetworking

Network Utilities
mit.edu is handled
by 3 class A hosts.
MIT site runs 3
name servers.
IP addresses of 2 of
the name servers
are known.
Copyright @2005 Pearson
Addison-Wesley
SILICON VALLEY UNIVERSITY
CONFIDENTIAL
25
Introduction UNIX/Linux Course

Networking and Internetworking

Request For Comments (RFC)

Where to find information on Internet?
 RFC documents used to help record unofficial notes on the
development of the ARPANET (DOD project connecting
universities and research laboratories).
TCP/IP Standards in RFC documents.
RFC document in various states: UNKNOWN, PROPOSED
STANDARD, DRAFT STANDARD, INFORMATIONAL,
EXPERIMENTAL, or HISTORIC.
 RFC published as Internet Drafts and made available to all
Internet users for review and feedback.
 Draft becomes Standard after review process.
Online RFC Respositories.
http://www.ietf.org/rfc.html




Copyright @2005 Pearson
Addison-Wesley
SILICON VALLEY UNIVERSITY
CONFIDENTIAL
26
Introduction UNIX/Linux Course

Networking and Internetworking

Internet Services

UNIX Supports Numerous Applications or Services Using
Internet Services and Internet Protocols.

Internet Services and well-known port numbers:
 /etc/services
Copyright @2005 Pearson
Addison-Wesley
SILICON VALLEY UNIVERSITY
CONFIDENTIAL
27
Introduction UNIX/Linux Course

Networking and Internetworking
$ cat /etc/services
# Note that it is presently the policy of IANA to assign a single well-known
# port number for both TCP and UDP; hence, most entries here have two entries
# even if the protocol doesn't support UDP operations.
#
# This list could be found on:
#
http://www.iana.org/assignments/port-numbers
# PORT NUMBERS
# The Well Known Ports are those from 0 through 1023.
# The Registered Ports are those from 1024 through 49151
...
ftp
21/tcp # File Transfer [Control]
ftp
21/udp # File Transfer [Control]
ssh
22/tcp # SSH Remote Login Protocol
ssh
22/udp # SSH Remote Login Protocol
...
tftp
69/tcp # Trivial File Transfer
tftp
69/udp # Trivial File Transfer
...
http
80/tcp # World Wide Web HTTP
http
80/udp # World Wide Web HTTP

Copyright @2005 Pearson
Addison-Wesley
SILICON VALLEY UNIVERSITY
CONFIDENTIAL
28
Introduction UNIX/Linux Course



Networking and Internetworking
Client-Server Software Model
Internet Service has Client/Server Connection
 Client
Software: Runs on host when user starts the
application.
 Server Software: Runs on host during bootup (server
software runs as long as host is running),.
 Connection-Oriented Client-Server Model:




Client Sends a connection request. Upon success, client
sends user commands to the server as requests.
Server Accepts or Rejects the request. Upon success, server
process client requests and sends reponse to the client and
displays to the user.
Virtual Connection is successful connection between client
and server.
Copyright @2005 Pearson
Addison-Wesley
SILICON VALLEY UNIVERSITY
CONFIDENTIAL
29
Introduction UNIX/Linux Course


Networking and Internetworking
Client-Server Software Model

Copyright @2005 Pearson
Addison-Wesley
SILICON VALLEY UNIVERSITY
CONFIDENTIAL
30
Introduction UNIX/Linux Course


Networking and Internetworking
Web Client/Server

http client use Universal Resource Locator (URL) to
connect to remote site’s http server.



URL Format:
 http://host/page
http://www.yahoo.com
http://192.201.18.91
 Fully Paramaterized Client:
 URL also contains the the particular port number.
 http server allows access to ftp or telnet sites.
 ftp://ftp.svuca.edu
 telnet://192.201.18.91
Copyright @2005 Pearson
Addison-Wesley
SILICON VALLEY UNIVERSITY
CONFIDENTIAL
31
Introduction UNIX/Linux Course


Networking and Internetworking
Host
 user@host Address Format
 Identifies user on a network on the Internet.
 Network-based applications needs hostname@domain.
 Need to Identify local Hostname and Domain.
 Fully Qualified Domain Name (FQDN).
$ hostname
yamsrv1.ece.gatech.edu
$ uname -n
yamsrv1.ece.gatech.edu
$ uname -a
SunOS yamsrv1.ece.gatech.edu 5.8
Generic_108528-22 sun4u sparc SUNW,Ultra-250
$
Copyright @2005 Pearson
Addison-Wesley
SILICON VALLEY UNIVERSITY
CONFIDENTIAL
32
Introduction UNIX/Linux Course


On local network:
User: Computer: Terminal.
Networking and Internetworking
Users Currently on Local Network
$ rwho | more
Bobk
upibm7:ttyC4
Dfrakes
upibm47:ttyp2
Lulay
upsun17:pts/0
Oster
upsun17:pts/2
Sarwar
upibm7:ttyp2
$ rwho -a | more
Bobk
upibm7:ttyC4
dfrakes
upibm47:ttyp2
kent
upibm48:ttyp0
kittyt
upibm9:ttyp0
kuhn
upsun29:console
lulay
upsun17:pts/0
oster
upsun17:pts/2
pioster
upsun20:pts/0
sarwar
upibm7:ttyp2
sarwar
upsun29:pts/0
Copyright @2005 Pearson
Addison-Wesley
Jul
Jul
Jul
Jul
Jul
26
26
26
26
26
12:03
11:49
10:17
12:28
11:15
Jul
Jul
Jul
Jul
Jul
Jul
Jul
Jul
Jul
Jul
26
26
26
26
16
26
26
26
26
26
12:03
11:49
03:41
07:36
13:11
10:17
12:28
09:53
11:15
11:24
SILICON VALLEY UNIVERSITY
CONFIDENTIAL
Include users
currently idle.
Hrs:Min since last
typed on keyboard.
8:49
1:28
99:59
2:41
1:00
33
Introduction UNIX/Linux Course

Networking and Internetworking

Users Logged Onto Systems on Local Network
rusers [options] [host_list]
Purpose:
Display the login names of the users
logged on to all the machines on your local
network
Output:
Information about the users logged on to
the hosts on your local network in one line
per machine format
Commonly used options/features:
-a
Display a host name even if no user is
using it
-l
Display the user information in a long
format similar to that displayed by the who
command
Copyright @2005 Pearson
Addison-Wesley
SILICON VALLEY UNIVERSITY
CONFIDENTIAL
34
Introduction UNIX/Linux Course

Networking and Internetworking
User kent is logged on
twice on the host
upibm48.egr.up.edu.
User kittyt (twice) and
debrorahs are logged
onto host
upibm6.egr.up.edu.
Host names are truncated to 16
characters.
Missing the “.edu”. Only has “.e”.
The “-a” option lists hosts, even if
no users are on the host computer.
Copyright @2005 Pearson
Addison-Wesley
SILICON VALLEY UNIVERSITY
CONFIDENTIAL
35
Introduction UNIX/Linux Course

Networking and Internetworking

Status of Hosts Connected on Local Network
ruptime [options]
Purpose:
Output:
Show status of machines on the local area network
Status of machines including machine name,
up/down status, time a machine has been up (or
down) for-called machine uptime, and the number
of users logged on to the machine
Commonly used options/features:
-l
Display output after sorting it with load average
-t
Display output after sorting it by machine uptime
-u
Display output after sorting it by the number of
users
Copyright @2005 Pearson
Addison-Wesley
SILICON VALLEY UNIVERSITY
CONFIDENTIAL
36
Introduction UNIX/Linux Course

Networking and Internetworking

Status of Hosts Connected on Local Network
Computer Up Time.
System Status.
Host Name.
Copyright @2005 Pearson
Addison-Wesley
SILICON VALLEY UNIVERSITY
CONFIDENTIAL
Sorted by the number of
users.
37
Introduction UNIX/Linux Course

Networking and Internetworking

Network Connection Testing
Determine reachability of target host.
ping [options] hostname

Send an IP datagram to ‘hostname’ to test
whether it is on the network (or Internet); if
the host is alive it simply echoes the
received datagram
Output:
Message(s) indicating whether
the machine is alive
Commonly used options/features:
-c count
Send and receive ‘count’ packets
-f
Send 100 packets per second or as many
as can be handled by the network; only the
superuser can use this option
-s packetsize
Send ‘packetsize’ packets; the default is
56 bytes (plus an 8 byte header)
Purpose:
Copyright @2005 Pearson
Addison-Wesley
SILICON VALLEY UNIVERSITY
CONFIDENTIAL
38
Introduction UNIX/Linux Course

Networking and Internetworking

Network Connection Testing
Ping “-c 3” packets to
host name.
Ping “-s 2040” packet
size to host name.
Copyright @2005 Pearson
Addison-Wesley
SILICON VALLEY UNIVERSITY
CONFIDENTIAL
39
Introduction UNIX/Linux Course

Networking and Internetworking

Network Connection Testing
Display information on users local or remote host.

finger [options] [user_list]
Purpose:
Display information about the users in the
‘user_list’; without a ‘user_list’, the
command displays a short status report
about all the users currently logged on to
the specified hosts.
Example: [email protected]
Output:
User information extracted from the
~/.project and ~/.plan files
Commonly used options/features:
-m
Match ‘user_list’ to login names only
-s
Display output in a short format
Copyright @2005 Pearson
Addison-Wesley
SILICON VALLEY UNIVERSITY
CONFIDENTIAL
40
Introduction UNIX/Linux Course

Networking and Internetworking

Network Connection Testing
Single user Birch on
local host is displayed.
Using “-s” option
shows short form.
Using “-m” option
must match user
name. User name is
“btree” not “Birch”,
so error returns.
Copyright @2005 Pearson
Addison-Wesley
SILICON VALLEY UNIVERSITY
CONFIDENTIAL
41
Introduction UNIX/Linux Course

Networking and Internetworking

Network Connection Testing
Copyright @2005 Pearson
Addison-Wesley
SILICON VALLEY UNIVERSITY
CONFIDENTIAL
42
Introduction UNIX/Linux Course

Networking and Internetworking

Network Connection to Remote Host (Client-Server)
Telnet allows login to dissimilar systems (i.e. UNIX to
Windows), as long as Telnet server is running.
Multiple users can login to a host via Telnet server.
The telnet protocol uses TCP Transport Layer:
Establishes virtual connection between hosts.
telnet [options] [host[port]]



To connect to a remote system ‘host’ via a
network; the ‘host’ can be specified by its name or
IP address in dotted decimal notation
Commonly used options/features:
-a
Attempt automatic login
-l
Specify a user for login
Purpose
Copyright @2005 Pearson
Addison-Wesley
SILICON VALLEY UNIVERSITY
CONFIDENTIAL
43
Introduction UNIX/Linux Course

Networking and Internetworking

Telnet Command Mode and Input Mode
Command Mode: telnet
$ telnet
telnet> open 192.168.1.1
Client takes character-at-a-time or
Trying 192.168.1.1...
line-at-a-time mode, depending on




what the server on the remote host
supports.
Copyright @2005 Pearson
Addison-Wesley
SILICON VALLEY UNIVERSITY
CONFIDENTIAL
44
Introduction UNIX/Linux Course

Networking and Internetworking

Telnet Command Mode and Input Mode
Input Mode: telnet host
Telnet with host address directly
goes to username/password
$ telnet 192.102.10.89
validation and once validated, the


Trying 192.102.10.89...
client enters into Input Mode.
Connected to upsun29.egr.up.edu.
Once in Input Mode, directly
interact with telnet server.
Escape character is ‘^]’.
UNIX(r) System V Release 4.0 (upsun29.egr.up.edu)
login: sarwar
Password: **********
Last login: Sat Dec 27 05:05:37 from up
You have mail.
DISPLAY = (‘)
TERM = (vt100)
$
Copyright @2005 Pearson
Addison-Wesley
SILICON VALLEY UNIVERSITY
CONFIDENTIAL
45
Introduction UNIX/Linux Course

Networking and Internetworking
Telnet with host address (FQDN) or
the IP address, 191.220.19.2.
In Input Mode, use “^]” will put
telnet into Command Mode.
In Command Mode, enter “z” will
suspend telnet.
In “ps” command, Status of the
telnet process shows “S” or
Suspended.
“fg” command moves the
suspended job (telnet) into current
job.
Copyright @2005 Pearson
Addison-Wesley
SILICON VALLEY UNIVERSITY
CONFIDENTIAL
46
Introduction UNIX/Linux Course

Networking and Internetworking

Network Connection to Internet Services
Telnet with host address and wellknown Port 13 connects to daytime
service at cs.berkeley.edu.
Telnet with host address and wellknown Port 79 connects to finger
server at iastate.edu. Finger server
waits for an user name as input the
returns the information.
Copyright @2005 Pearson
Addison-Wesley
SILICON VALLEY UNIVERSITY
CONFIDENTIAL
47
Introduction UNIX/Linux Course

Networking and Internetworking

Standard UNIX System Commands for Network
Connection to Remote Host on UNIX Systems
 rlogin: Remote Login
 rcp: Remote Copy share files among computers
 rsh: Remote Shell share processors of computers

Convenient method to exchange between
trusted computers.
 ONLY


Local Networks.
Not Secure:
ONLY Trusted hosts on Local Network.
 /usr/.rhosts: List of trusted hosts.
 /etc/hosts.equiv: List of trusted hosts and users.
 Uses the same login name WITHOUT password.
Copyright @2005 Pearson
Addison-Wesley
SILICON VALLEY UNIVERSITY
CONFIDENTIAL
48
Introduction UNIX/Linux Course

Networking and Internetworking

Network Connection to Remote Host
rlogin on UNIX Systems

Username consistent across multiple systems.
 Only prompts for password.
 Concept of trusted users – No login required.
 Security concerns .
The rlogin command allows you to log on to a host on your
local network
rlogin [options] hosts
Purpose:
To connect to a remote UNIX ‘host’
via a network ; the ‘host’ can be specified
by its name or IP address in the dotted
decimal notation


Commonly used options/features:
-ec
Set the escape character to ‘c’( the default is
‘~’)
-l user
User ‘user’ as the login name on
the remote host
Copyright @2005 Pearson
Addison-Wesley
SILICON VALLEY UNIVERSITY
CONFIDENTIAL
49
Introduction UNIX/Linux Course

Networking and Internetworking

Network Connection to Remote Host
rlogin on UNIX Systems
Does not prompt for username.

$ rlogin upsun
Does not prompt for password , if
the password is the same on
remote host.
Password:
Last login: Mon Dec 18 12:08:12 from upsun21.up.edu
SunOS Release 4.1.3 (UPSUN_SERVER) #5: Mon Nov 14
17:31:44 PST 1994
DISPLAY 5 (upx46:0.0)
TERM 5 (vt100)
$ whoami
sarwar
$ hostname
upsun.egr.up.edu
$
Copyright @2005 Pearson
Addison-Wesley
SILICON VALLEY UNIVERSITY
CONFIDENTIAL
50
Introduction UNIX/Linux Course

Networking and Internetworking

Network Connection to Remote Host
rlogin on UNIX Systems
Use “-l” option to login to another

user.
$ rlogin upsun -l perform
Password:
Last login: Mon Dec 18 12:08:12 from upsun21.up.edu
SunOS Release 4.1.3 (UPSUN_SERVER) #5: Mon Nov 14
17:31:44 PST 1994
DISPLAY 5 (upx46:0.0)
TERM 5 (vt100)
$ whoami
perform
$ hostname
upsun.egr.up.edu
$
Copyright @2005 Pearson
Addison-Wesley
SILICON VALLEY UNIVERSITY
CONFIDENTIAL
51
Introduction UNIX/Linux Course

Networking and Internetworking

Network Connection to Remote Host
Remote Command Execution
rsh [ options ] host [ command ]









Purpose: To execute a command on a remote machine, “host”,
on the same network; the rlogin command is executed if no
“command” is specified.
- l user : Use “user” as the login name on the remote host.
Login shell used to execute the “command”.
Shell environment hidden file is executed (i.e. bashrc for bash
shell).
Login shell is not executed (i.e. .login or .profile).
When executing “command” on remote host, the standard files
(stdin, stdout, stderr) and attached to the standard files in the
local host.
I/O Redirect Files taken from local host.
Copyright @2005 Pearson
Addison-Wesley
SILICON VALLEY UNIVERSITY
CONFIDENTIAL
52
Introduction UNIX/Linux Course

Networking and Internetworking

Network Connection to Remote Host
Copyright @2005 Pearson
Addison-Wesley
SILICON VALLEY UNIVERSITY
CONFIDENTIAL
53
Introduction UNIX/Linux Course

Networking and Internetworking

Network Connection to Remote Host
Copyright @2005 Pearson
Addison-Wesley
SILICON VALLEY UNIVERSITY
CONFIDENTIAL
54
Introduction UNIX/Linux Course

Networking and Internetworking

Network Connection to Remote Host
Stdin input file, students, taken
from local host.
Stdout output file, sorted_students,
taken from local host.
Remote host login as “msarwar”.
No command defaults to “rsh”
login.
Copyright @2005 Pearson
Addison-Wesley
SILICON VALLEY UNIVERSITY
CONFIDENTIAL
55
Introduction UNIX/Linux Course

Networking and Internetworking

File Transfers to/from Remote Host.
 Login name: anonymous or guest.
 Must have appropriate remote site file permissions to
read/write.
ftp [options] [host]
Purpose:
To transfer files from or to a
remote ‘host’
Commonly used options/features
-d
Enable debugging
-i
Disable prompting during
transfers of multiple files
-v
Show all remote responses
Copyright @2005 Pearson
Addison-Wesley
SILICON VALLEY UNIVERSITY
CONFIDENTIAL
56
Introduction UNIX/Linux Course

Networking and
Internetworking

File Transfers
to/from Remote Host.
Copyright @2005 Pearson
Addison-Wesley
SILICON VALLEY UNIVERSITY
CONFIDENTIAL
57
Introduction UNIX/Linux Course


Networking and Internetworking
$ ftp ftp.uu.net
File Transfers
to/from Remote Host.
Anonymous FTP with remote
host site ftp.uu.net.
Password is email address.
Get file from remote host.
Using “!” runs “ls” command
on the local host.
Transfers multiple files from
remote host to local host.
Prompt each file before
transfer.
Copyright @2005 Pearson
Addison-Wesley
Connected to ftp.uu.net.
220 FTP server ready.
Name (ftp.uu.net:msarwar): anonymous
331 Guest login ok, send your complete e-mail address as password.
Password:
230Welcome to the UUNET archive.
…
ftp> cd pub/shells/tcsh
ftp> ls
200- Port command successful.
150- Opening ASCII mode data connection for file list.
...
tcsh-6.06.tar.gz
...
226 Transfer Complete
ftp> get tcsh-6.06.tar.gz
200 PORT command successful.
…
526399 bytes received in 32 seconds (15.96 Kbytes/s)
ftp> ! ls –l tcsh-6.06.tar.gz
…
-rw-r—r-- 1 msarwar faculty 524469 Jan 11 12:13 tcsh-6.06.tar.gz
ftp> mget tcsh*
Mget tcsh-6.06.tar.gz ? N
Mget tcsh.man.Z ? Y
200 PORT command successful.
…
SILICON VALLEY UNIVERSITY
CONFIDENTIAL
58
Introduction UNIX/Linux Course

Networking and Internetworking

File Transfers Using Remote Copy
rcp command allows files to be copied to and from a
remote host without logging onto the remote host.

Local host must be Trusted Host, else prompt for password or
fail.
 /etc/hosts.equiv has Trusted Hosts.
 ~/.rhosts on remote host with local host name.
rcp[options] [host:]sfile [host:]dfile
rcp [options][host:]sfile [host:]dir
Purpose: To copy ‘sfile’ to ‘dfile’
Commonly used options/features
-p
Attempt to preserve file modify and access times;
without this option the command uses the current
value of unmask to create file permissions.
-r
Recursively copy files at ‘sfiles’ to ‘dir’

Copyright @2005 Pearson
Addison-Wesley
SILICON VALLEY UNIVERSITY
CONFIDENTIAL
59
Introduction UNIX/Linux Course

Networking and Internetworking

File Transfers Using Remote Copy
$ rcp ~/myweb/*.html upsun29:webmirror
- Copies all files with html extension from ~/myweb/ to remote
host upsun29 in ~/webmirror directory.
$ rcp ~/unixbook/Chapter[1-9].doc upsun29:unixbook.backup
- Copies files named Chapter[1-9].doc from ~/unixbook/ to
remote host upsun29 in ~/unixbook.backup directory.
$ rcp upsun29:ece446/projects/*.[c,C] ~/swprojects.backup
- Copies C and C++ files from remote host upsun29 directory
~/ece446/projects/ to local ~/swprojects.backup directory.
$ rcp -rp www1:* www2:
- Copies all files from home directory from remote host www1 to
the home directory in remote host www2. The “-r” indicates
recursive copy and the “-p” preserves existing modification
times and access permissions.
Copyright @2005 Pearson
Addison-Wesley
SILICON VALLEY UNIVERSITY
CONFIDENTIAL
60
Introduction UNIX/Linux Course

Networking and Internetworking

Secure Version of UNIX Remote Command





rlogin  ssh Secure Shell ( Remote Login )
rcp  scp : Secure Copy ( Remote Copy )
rsh  ssh : Secure Shell ( Remote Execution )
ftp  sftp : Secure File Transfer ( Remote Copy )
Cryptography:

Transmitting Data





Commands
Password
Files
Prevent sniffer capturing and viewing cleartxt.
Current Standard for communicating across Internet.
Copyright @2005 Pearson
Addison-Wesley
SILICON VALLEY UNIVERSITY
CONFIDENTIAL
61
Introduction UNIX/Linux Course

Networking and Internetworking

Remote Command Execution
Secure Shell
ssh [ options ] host [ command ]








Purpose: To execute a command on a remote machine, “host”,
on the same network; the rlogin command is executed if no
“command” is specified.
- l user : Use “user” as the login name on the remote host.
Uses strong cryptography for transmitting data, including
commands, password, and files.
Standard for secure terminal connections within network or the
Internet.
Public-key cryptography to authenticate user and its host.
Same capabilities (i.e. shells, standard files, I/O Redirect files)
and tasks as rsh, but in a more secure manner.
Copyright @2005 Pearson
Addison-Wesley
SILICON VALLEY UNIVERSITY
CONFIDENTIAL
62
Introduction UNIX/Linux Course

Networking and Internetworking

Secure Shell
Executes “ps –el …” command
on the remote host. Displays
the status of all daemons
(command end in “d”).
Executes “ps –el …” command
on remote host. Its output is
piped to the “grep” command
that is running on the local
host.
Copyright @2005 Pearson
Addison-Wesley
SILICON VALLEY UNIVERSITY
CONFIDENTIAL
63
Introduction UNIX/Linux Course

Networking and Internetworking

File Transfers Using Remote Copy
Secure Copy
scp command allows files to be copied to and from a
remote host without logging onto the remote host.
Copying occurs under encrypted sessions after proper
authentication of the local host and user.
Same capabilities as rcp, but in a more secure manner.




scp[options] [host:]sfile [host:]dfile
scp [options][host:]sfile [host:]dir
Purpose: To copy ‘sfile’ to ‘dfile’
Commonly used options/features
-p
Attempt to preserve file modify and access times;
without this option the command uses the current
value of unmask to create file permissions.
-r
Recursively copy files at ‘sfiles’ to ‘dir’
Copyright @2005 Pearson
Addison-Wesley
SILICON VALLEY UNIVERSITY
CONFIDENTIAL
64
Introduction UNIX/Linux Course

Networking and Internetworking

File Transfers Using Remote Copy
Secure Copy

$ scp prog4.c upsun29:~/courses/cs213/programs/
- Copies prog4.c to remote host upsun29 directory
~/courses/cs213/programs/.
$ scp -r upsun21.egr.up.edu:courses .
- Recursively copies remote host
to local directory (“.”).
upsun21.egr.up.edu directory
$ scp -rp www1:* www2:
- Recusively copies remote host www1 home directory to remote
host www2 home directory and perserving existing modification
times and access permissions for all files and subdirectories.
Copyright @2005 Pearson
Addison-Wesley
SILICON VALLEY UNIVERSITY
CONFIDENTIAL
65
Introduction UNIX/Linux Course



Networking and Internetworking
Interactive Chat
talk user [ tty ]
 To initiate interactive chat with “user” who is logged in
on a “tty” terminal.
 Remote host: “user@host”.
 Other user must respond with “talk user” command.
 “mesg n” command blocks “talk” requests.
$ talk bob
<Different TTY>
[Waiting for your party to respond]
Both sides must
execute “talk” for
interactive chat.
Message from [email protected] at 13:36 ...
talk: connection requested by [email protected].
talk: respond with: talk [email protected]
$ talk sarwar@upibm7
Copyright @2005 Pearson
Addison-Wesley
SILICON VALLEY UNIVERSITY
CONFIDENTIAL
66
Introduction UNIX/Linux Course


Networking and Internetworking
traceroute hostname Command



Display the route (each intermediate router that routes the
packet) that e-mail, ssh (telnet) commands, and ftp files take
from local host to the remote host.
Security Issue: Shows the internal structure of the network and
IP addresses of the routers.
traceroute Output


One line for each system or router in the path between local host to the
remote host.
At each line, Round Trip Times for 3 packets from that system to the local
host.
 Output:
17 relay2.EECS.Berkeley.EDU (169.229.6028) 23.8ms 39.4ms 22.8ms
The host name of the
17th system that are
traversed on the way to
“host”.
IP address of system.
Copyright @2005 Pearson
Addison-Wesley
SILICON VALLEY UNIVERSITY
CONFIDENTIAL
Round trip time for 1st,
2nd, and 3rd packet to
this system.
67
Introduction UNIX/Linux Course


Networking and Internetworking
traceroute hostname Command
Copyright @2005 Pearson
Addison-Wesley
SILICON VALLEY UNIVERSITY
CONFIDENTIAL
68
Introduction UNIX/Linux Course
Networking and
Internetworking
 Organizations
Managing the
Internet and
Formulating
Plans and
Policies for Growth

Copyright @2005 Pearson
Addison-Wesley
SILICON VALLEY UNIVERSITY
CONFIDENTIAL
69
Introduction UNIX/Linux Course


Networking and Internetworking
Web Resources for Network- and Internetrelated Policies, Documents, and UNIX
Commands
Copyright @2005 Pearson
Addison-Wesley
SILICON VALLEY UNIVERSITY
CONFIDENTIAL
70
Introduction UNIX/Linux Course


Networking and Internetworking
Web Resources for Network- and Internetrelated Policies, Documents, and UNIX
Commands
Copyright @2005 Pearson
Addison-Wesley
SILICON VALLEY UNIVERSITY
CONFIDENTIAL
71