Professional Documents
Culture Documents
Dr. T V Gopal
Professor
Department of Computer Science and Engineering
Anna University
Chennai – 600 025, INDIA
e-mail : gopal@annauniv.edu
Home Page : http://www.annauniv.edu/staff/gopal
Kernel Structure (Traditional)
UNIX Shell
Since the kernel is responsible for so many
complex tasks (translation, memory and file system
management, etc), it typically cannot spend too
much time making life too easy for the person
using it. Its user interface, though much better than
that of the hardware, still slows down for the
average user.
Fortunately, UNIX implements another layer of
abstraction that envelops the kernel. This next layer
is called a shell.
The benefit of a shell, of course, is that it is built
primarily for people. Time and energy have been
taken to develop a user-friendly interface with a
language more intelligible than either the language
of the hardware or that of the kernel.
Shell and Users
Shell and User Isolation
Alice
Hollywood, California
Champaign, Illinois
Bob
100 Santa Monica Blvd.
Hollywood, CA 90028
Bob
100 Santa Monica Blvd.
Hollywood, CA 90028
Install a mailbox
Receive the mail
Get rid of envelope
Read the message
Programming
Sockets API:
A transport layer service interface
Introduced in 1981 by BSD 4.1
Implemented as library and/or system calls
Similar interfaces to TCP and UDP
Can also serve as interface to IP (for super-user); known as
“raw sockets”
Client
connect listen
accept
write
read
write
read
close read
close
socket
socket bind
sendto
recvfrom
sendto
recvfrom
close
6 Presentation Understanding
5 Session
4 Transport
3 Network
Transmission
2 Data Link
1 Physical
OSI Protocol Stack (cont.)
Layers 1-4: transmission - how data
moves through the network.
Layers 5-7: understanding - how data
appears to applications and users
OSI Protocol Stack (cont.)
Explanation of the layers:
Physical: Physical cable, electrical signalling, cable
length specifications, connector size.
Data link: Error free (not reliable) media access for
datagrams
Network: Provides path (route) through the network
for data
Transport: Reliable (usually) flow of datagrams
between two nodes
Session: Synchronises dialogue between two
programs
OSI Protocol Stack (cont.)
Explanation (cont.):
Presentation: Converts data between formats
used by two programs
Application: Obvious (hopefully)
Internet Protocols and Services
7 Application Berkeley/ARPA NFS
6 Presentation XDR
ICMP
IP
3 Network ARP
802.2
2 Data Link Ethernet
802.3
Electrical interference
Noise produced by other electrical devices and cables
Shielding used to reduce
Attenuation
Signal decay over the length of the cable
Reduced by amplifiers (analog), repeaters (digital)
Access Methods
CSMA/CD (ethernet)
Carrier sense, multiple access, collision detection
Nodes must wait to transmit, and back off if there is a
collision
Performs poorly under high load conditions
IEEE Standards
IEEE defined LAN standards
Similar to OSI stack
Split data link layer into two levels:
Logical link control (LLC)
Media access control (MAC)
Standards
802.2: LLC
802.3: CSMA/CD
Pros:
No powered components
Cons:
Breaking one cable breaks whole network
Length: 180 m total
Not common any more
Media Types (cont.)
Twisted pair (10 base T, 100 base T): “UTP”
Pairs of wires (2 or 4 pairs), twisted together
Star topology
Pros:
Each node has a separate connection, thus easy to “plug and
play”
Failure of one cable only affects attached node
Hubs can provide management information
Cons:
Requires a hub, thus more expensive than coaxial
Failure of hub affects all attached nodes
Most commonly used cable in the industry
Length: 90 m per cable run, maximum of 4 hops
Media Types (cont.)
Optical fibre
Glass fibres transmit light pulses
Point-to-point connection
Pros:
Immune to electrical interference
High bandwidth
Cons:
Installation and maintenance difficult
Equipment often expensive
Used for some inter-network connections and high-
bandwidth disk connectivity
Transceivers
Convert signals from a LAN card to
specific cable types
Several types used;
10 base T
10 base 2
100 base T
Gigabit
Gateways
7 Application
6 Presentation
Gateway
5 Session
6 Presentation
5 Session
Host Name
4 Transport Port
3 Network IP
1 Physical
Link Level Addresses
Also called:
Ethernet address, MAC address, station address,
hardware address
48-bits
Top 24 bits: vendor id
Bottom 24 bits: node id
Looks like this:
000502879BD1, 08:00:09:C8:2D:F0
Unix commands:
lanscan (HP-UX), ifconfig (Solaris, Linux)
IP Addresses
Address notation
32 bit number
Expressed in “dotted-quad” notation, e.g. 164.112.128.1
Address classes
Allocate addresses efficiently to different sized
organisations
Use high-order bits of address to determine class
Class A
For large organisations
24 bits for host addresses
Class C
For small organisations
8 bits for host addresses
Reserved
240-255: Reserved (undefined?)
Private networks (RFC 1918):
10.0.0.0
172.16.0.0 - 172.31.0.0
192.168.0.0 - 192.168.255.0
Unix commands:
ifconfig: interfaces
netstat -in: interfaces
255.255.255.192
2:
Low addresses are servers
Unix files:
/etc/services - all known port assignments
/etc/inetd.conf - active port assignments (mostly)
Command:
netstat -an - shows all active ports
Host Naming
Unix host name
hostname
uname -n
Routes
Hosts
Troubleshooting
Startup files:
/etc/rc.config.d/{netconf,netdaemons}
Host Names
Looking up hosts
Local: /etc/hosts
NIS: ypcat hosts
DNS: /etc/resolv.conf
Troubleshooting Commands
ping
traceroute
arp
netstat
linkloop
lanadmin
3. Configuring Internet Services
In this section:
Internetservices overview
Configuration and startup
Checking connections
Internet Services
C a p a b ility G e n e r a l ( m o s t l y A RBPeAr )k e l e y ( B S D )
L o g in T e ln e t r lo g in
F ile tr a n s fe r FTP , TFTP rc p
C o m m a n d e x e c u tio n re x e c , re m sh (rsh )
E m a il s e n d m a il
N e tw o r k in fo r m a tio n r w h o , r u p tim e , fin g e r
D y n a m ic r o u tin g g a te d r o u te d
N a m e s e r vic e s B IN D , N IS
T im e s y n c h r o n iz a N
tioTnP tim e d
D y n a m ic c o n fig u rB a tio
O On T P , D H C P
S y s te m lo g g in g s y s lo g d
P r in tin g lp d
Clients and Servers
D a e m o n ( / u s r / sSbeirnv) e r ( / u s r / l bCilni e) n t ( / u s r / b i nS)e r v i c e
in e t d t e ln e t d , r lo g in dt e ln e t , r lo g in L o g in
ftp d , tftp d ftp , tftp F ile t r a n s f e r
re m s h d rc p F ile t r a n s f e r
r e x e c d , r e m s h dr e x e c , r e m s h ( r sCh o) m m a n d e x e c u t io n
s e n d m a il m a il E m a il
r w h o d , f in g e r d r w h o , r u p t im e , N f ine gt we ro r k in f o r m a t io n
b o o tp d b o o tp d b o o tp q u e ry D y n a m ic c o n f ig u r a t io n
g a te d , rd p d D y n a m ic r o u t in g
n am ed n s lo o k u p N a m e s e r v ic e s
x n tp d n t p q , n t p d a t e T im e s y n c h r o n iz a t io n
s y s lo g d s y s lo g d , lo g g e r S y s t e m lo g g in g
r lp d a e m o n lp ( r lp ) P r in t in g
How inetd Works
Listens on ports, waiting for connections
When connection arrives, UNIX checks against
security file /var/adm/inetd.sec to allow or deny
access
Linux uses tcpd for the same purpose:
/etc/hosts.{allow,deny}
Sets up socket connection
Invokes server process and transfers control to it
Returns to listening
inetd Configuration Files
/etc/services: Well-known ports
/etc/inetd.conf: Active inetd services
netstat -a
Remote Login
rlogin configuration files:
/etc/hosts.equiv
System-wide
Permissions 444
root ignores it
$HOME/.rhosts
Per-user
Permissions 600
Can override hosts.equiv
Can be overridden with rlogind -l
FTP
/etc/ftpusers
Lists users not allowed to login via ftpd
All users without passwords are also not
allowed to login
$HOME/.netrc
Specifies hosts, usernames, and passwords
for ftp & rexec
Don’t use it!
Anonymous FTP
Uses ftp user home directory
Does a chroot() to ~ftp so that user is
“sandboxed”
Needs certain directories & files to work:
~ftp/usr/bin/ls, mode 111
~ftp/etc/{passwd,group,logingroup}, mode 444
Other directories:
~ftp/dist: outgoing files (elsewhere ~ftp/pub)
~ftp/pub: incoming files (elsewhere ~ftp/incoming)