Transcript OS_EX10

Operating Systems
Lesson 10
Networking

Communications protocol is the set of
standard rules for
◦
◦
◦
◦

Data representation
Signaling
Authentication
Error detection
Usually split into layers
◦ Higher layer protocols use services from low
level
◦ High layer protocols adds complexity
◦ Low-level protocols are usually unaware of
higher-layer payload content
OSI Model
OSI Model
Data unit
Host
layers
Media
layers
Layer
Function
7. Application
Network process to application
Data 6. Presentation
Data representation and encryption
5. Session
Interhost communication
Segment
4. Transport
End-to-end connections and reliability (TCP)
Packet/Datagram
3. Network
Path determination and logical addressing
(IP)
Frame
2. Data link
Physical addressing (MAC & LLC)
Bit
1. Physical
Media, signal and binary transmission
Routing/Switching

Usually there is no direct connection
between every 2 devices (PC, phoneshosts)

Communications data travels a path of
several nodes( e.g routers/switches)

Each node forwarded (routes) data to the
next node over a communication
link(hop)
Packet vs. Circuit switching

Packet switching
◦ Packets (discrete blocks of data) are routed
between nodes over data links shared with other
traffic
◦ Usually “ best effort”

Circuits switching
◦ Establishes a fixed bandwidth circuit (or channel)
between nodes and terminals before the users
may communicate
◦ Bandwidth is reserved even if data is not
transmitted
Transmission modes
Multicast
Broadcast
Unicast
TCP/IP protocol stack
Ethernet: Bus
•Several Stations connected by wire (bus), “everyone sees
everyone”
•Each station has unique address (MAC) burned into network
card
•Need to know each other address to communicate
•Nothing is guaranteed
A network
card, network
adapter, LAN
Adapter or
NIC
Ethernet: Star
HUB: Connect
devices as a
single segment
Switch: Inspect
and forward
packets to
appropriate port
Ethernet: CSMA/CD
CSMA/CA
IP address

Numerical address (115.64.32.12- human
readable form)

Global unique addresses to be reached from
outside world

Local addresses to use within the enterprise can
be reused by different networks

Host with local addresses can reach global hosts
using Network Address Translation (NAT)
mechanism
IP Routing
network
id
cost
next hop
........
........
........
........
........
........
Windows shell: ROUTE PRINT
If Destination Address & Mask==Network Id
send to specified gateway through specified NIC
ARP (Address Resolution Protocol)

IP router decided what is the next hop according to
its routing table

Knows IP but Ethernet needs MAC address

Broadcast IP and wait for response from host that has
this IP

ARP –a in windows shell
DHCP (Dynamic Host
Configuration Protocol)
What happens when you plug-in network
cable into wall?
 Your PC need to know its IP, IP of a
gateway and other parameters
 DHCP server accept broadcasts
 DHCP server assigns IP and provides
addresses of all required services
 IPCONFIG in Windows Shell

IP is Best-Offer:

Fault-events
◦
◦
◦
◦
data corruption
lost data packets
duplicate arrival
out-of-order packet delivery
UDP over IP (User Datagram)
Over IP
 Ports to distinguish applications at the
same host
 No guaranteed delivery
 May arrive out of order (different routing
path)
 LightWeight (less delay, processing)


Usage: Audio streaming
TCP over IP (TCP/IP)

Transmission Control Protocol (TCP)

Guaranteed delivery
◦ Packets have sequence number (SQN)
◦ Receiver send acknowledge (ACK)

Port number in addition to IP address
◦ To distinguish between applications

Mechanisms for establishment and
termination of a connection
DNS (Dynamic Name System)
Sometimes want to assign symbolic name
to a host (tau.ac.il)
 DNS server lookup IP address by DNS
name
 Multilevel lookup (ac.il is an address of
DNS server which manage universities)
 DNS server is obtained by DHCP
 DNS tables are cached everywhere

Windows Networking Tools

IPCONFIG
◦ IP configuration

ARP –a
◦ ARP table

ROUTE PRINT
◦ IP routing table

PING www.microsoft.com
◦ Ping host and DNS resolve

TRACERT www.microsoft.com
◦ Routing path to host

NSLOOKUP www.microsoft.com
◦ DNS lookup

NETSTAT
◦ Open TCP/UDP ports
Example

Connect a laptop to the wall socket (Ethernet), open
browser and go to www.google.com
1. laptop detects that cable is connected
2. Laptop broadcasts DHCP request asking for IP configuration (e.g. IP address, IP
routing table, DNS server address etc.)
3. DHCP server responses with IP configuration
4. Browser needs to translate symbolic address (google.com) to the numeric IP through
sending a UDP request to DNS server
5. DNS server address is known (received through DHCP), need to know next
gateway to reach it over IP
6. Lookup next gateway on the route to DNS using IP routing table
7. Got IP of the next gateway from IP table, need MAC address to send over
Ethernet
8. Send ARP broadcast to find out MAC address of the gateway, save response in the
table. Send DNS UDP request to the gateway through Ethernet.
9. After DNS server responds with IP of the Google’s web site, browser establishes
TCP connection to port 80(HTTP) of the server
10. Repeat steps 6-8 this type for Google IP: Find next gateway on the way to Google
web site, send ARP if required to find gateway’s MAC address