Title: CS455 Introduction to Computer Networks
1CS455 Introduction to Computer Networks
WSU Vancouver
- Dr. Wenzhan Song
- Assistant Professor, Computer Science
2Course roadmap
- Introduction
- Application Layer WWW, FTP, email, DNS,
multimedia - Transport Layer reliable end-end data transfer
principles, UDP, TCP - Network Layer IP addressing, routing and other
issues - Data Link Layer framing, error control, flow
control - Medium Access Control (MAC) Layer
multiple-access, channel allocation - Physical Layer wired, wireless, satellite
- Other Topics network security, social issues,
hot topics, research directions
3Roadmap Network Layer
- Network layer design issues
- overview of service models
- Virtual circuits and datagram networks
- IP Internet Protocol
- datagram format, IPv4 addressing
- NAT, IPv6
- ICMP, ARP, DHCP
- Routing algorithms
- distance vector
- link state
- Routing Protocol in Internet
- RIP
- OSPF
- BGP
- Other issues in network layer
4Network Layer
- Goals
- understand principles behind network layer
services - routing (path selection)
- dealing with scale
- how a router works
- instantiation and implementation in the Internet
- IPv4, IPv6, mobility
- routing and control protocols
5Overview of network layer
- transport segment from sending to receiving host
- sending side encapsulates segments into datagrams
- rcving side delivers segments to transport layer
- network layer protocols in every host, router
- Router examines header fields in all IP datagrams
passing through it
6Overview of network layer
Two processes in router Forwarding forward
packets according to routing table Routing
change and fill routing table according to
routing algorithms
7Network service model
Q What service model for channel transporting
datagrams from sender to rcvr?
- Example services for a flow of datagrams
- In-order datagram delivery
- Guaranteed minimum bandwidth to flow
- Restrictions on changes in inter-packet spacing
- Example services for individual datagrams
- Guaranteed delivery
- Guaranteed delivery with less than 40 msec delay
8Network layer service models
Guarantees ?
Network Architecture Internet ATM ATM ATM ATM
Service Model best effort CBR VBR ABR UBR
Congestion feedback no (inferred via
loss) no congestion no congestion yes no
No Loss no yes yes no no
Bandwidth none constant rate guaranteed rate gua
ranteed minimum none
Order no yes yes yes yes
Timing no yes yes no no
CBR, Constant bit rate ABR, Available bit
rate VBR, Variable bit rate UBR, unspecified
bit rate
9Datagram network vs VC network
- Datagram network (e.g., Internet) provides
network-layer connectionless service - VC network (e.g., ATM) provides network-layer
connection-oriented service - Analogous to the transport-layer services, but
- Service host-to-host
- Implementation in the core
- Both of them are packet-switched networks
10Virtual circuits
- source-to-dest path behaves much like telephone
circuit - performance-wise
- network actions along source-to-dest path
- call setup, teardown for each call before data
can flow - each packet carries VC identifier (not
destination host address) - every router on source-dest path maintains
state for each passing connection - link, router resources (bandwidth, buffers) may
be allocated to VC
11VC implementation
- A VC consists of
- Path from source to destination
- VC numbers, one number for each link along path
- Entries in forwarding tables in routers along
path - Packet belonging to VC carries a VC number.
- VC number must be changed on each link.
- New VC number comes from forwarding table
12Forwarding table in VC network
VC number
B
R1
R2
A
22
32
12
2
1
3
Forwarding table in Router R1
R4
R3
interface number
Routers maintain connection state information!
13Virtual circuits signaling protocols
- used to setup, maintain teardown VC
- used in ATM, frame-relay, X.25
- not used in todays Internet
6. Receive data
5. Data flow begins
4. Call connected
3. Accept call
1. Initiate call
2. incoming call
14Datagram networks
- no call setup at network layer
- routers no state about end-to-end connections
- no network-level concept of connection
- packets forwarded using destination host address
- packets between same source-dest pair may take
different paths
1. Send data
2. Receive data
15Router Architecture
- Two key router functions
- run routing algorithms/protocol (RIP, OSPF, BGP)
- forwarding datagrams from incoming to outgoing
link
223.1.1.4
223.1.3.27
223.1.2.9
223.1.4.5
Each router may have multiple interfaces (or
ports) and each interface typically has different
IP address.
16Routing table
4 billion possible entries
Destination Address Range
Link
Interface 11001000 00010111 00010000
00000000
through
0 11001000
00010111 00010111 11111111 11001000
00010111 00011000 00000000
through
1
11001000 00010111 00011000 11111111
11001000 00010111 00011001 00000000
through
2 11001000 00010111 00011111 11111111
otherwise
3
17Longest prefix matching
Prefix Match
Link Interface
11001000 00010111 00010
0 11001000 00010111
00011000 1
11001000 00010111 00011
2
otherwise
3
Examples
Which interface?
DA 11001000 00010111 00010110 10100001
Which interface?
DA 11001000 00010111 00011000 10101010
18Datagram or VC network why?
- Internet
- data exchange among computers
- elastic service, no strict timing req.
- smart end systems (computers)
- can adapt, perform control, error recovery
- simple inside network, complexity at edge
- many link types
- different characteristics
- uniform service difficult
- ATM
- evolved from telephony
- human conversation
- strict timing, reliability requirements
- need for guaranteed service
- dumb end systems
- telephones
- complexity inside network
19Design Principles for Internet
- Make sure it works.
- Keep it simple.
- Make clear choices.
- Exploit modularity.
- Expect heterogeneity.
- Avoid static options and parameters.
- Look for a good design it need not be perfect.
- Be strict when sending and tolerant when
receiving. - Think about scalability.
- Consider performance and cost.
20Comparison
5-4
21Roadmap Network Layer
- Network layer design issues
- overview of service models
- Virtual circuits and datagram networks
- IP Internet Protocol
- datagram format, IPv4 addressing
- NAT, IPv6
- ICMP, ARP, DHCP
- Routing algorithms
- distance vector
- link state
- Routing Protocol in Internet
- RIP
- OSPF
- BGP
- Other issues in network layer
22The Internet Network layer
- Host, router network layer functions
Transport layer TCP, UDP
Network layer
Link layer
physical layer
23IP datagram format
IP protocol version number
32 bits
total datagram length (bytes)
header length (bytes)
type of service
head. len
ver
total length
for fragmentation/ reassembly
fragment offset
type of data (e.g., file, voice)
flgs
16-bit identifier
max number remaining hops (decremented at each
router)
upper layer
time to live
header checksum
32 bit source IP address
32 bit destination IP address
upper layer protocol (e.g., TCP/UDP) to deliver
payload to
E.g. timestamp, record route taken, specify list
of routers to visit.
Options (if any)
- how much overhead with TCP?
- 20 bytes of TCP
- 20 bytes of IP
- 40 bytes app layer overhead
data (variable length, typically a TCP or UDP
segment)
24IP Fragmentation Reassembly
- network links have MTU (max.transfer size) -
largest possible link-level frame. - different link types, different MTUs
- large IP datagram divided (fragmented) within
net - one datagram becomes several datagrams
- reassembled only at final destination
- IP header bits used to identify, order related
fragments
fragmentation in one large datagram out 3
smaller datagrams
reassembly
25IP Fragmentation and Reassembly
- Example
- 4000 byte datagram
- MTU 1500 bytes
1480 bytes in data field
offset 1480/8
How to get 1040 as length of last segment? Show
calculation.
26IP Addressing introduction
223.1.1.1
- IP address 32-bit identifier for host, router
interface - interface connection between host/router and
physical link - routers typically have multiple interfaces
- host may have multiple interfaces
- IP addresses associated with each interface
- Classful addressing and CIDR addressing
223.1.2.9
223.1.1.4
223.1.1.3
223.1.1.1 11011111 00000001 00000001 00000001
223
1
1
1
27Classful addressing
- A 128 networks with 16 million host each
- B 16,384 networks with 64K hosts each
- C 2 million networks with with 256 hosts each
- Classful addressing method is not used by todays
Internet anymore, - since it is not flexible and may waste many IP
addresses - ? CIDR(Classless InterDomain Routing)
28Subnets
- A campus network consisting of subnets for
various departments.
29Subnets
?-------------- 22 -----------------------?
- A class B network subnetted into 64 subnets,
subnet mask /22
30Subnets
223.1.1.1
- IP address
- subnet part (including all high order bits)
- host part (low order bits)
- Whats a subnet?
- device interfaces with same subnet part of IP
address - can physically reach each other without
intervening router
223.1.2.1
223.1.1.2
223.1.2.9
223.1.1.4
223.1.2.2
223.1.1.3
223.1.3.27
LAN
223.1.3.2
223.1.3.1
network consisting of 3 subnets
31Subnets
- Recipe
- To determine the subnets, detach each interface
from its host or router, creating islands of
isolated networks. Each isolated network is
called a subnet.
Subnet mask /24
32Subnets
223.1.1.2
223.1.1.1
223.1.1.4
223.1.1.3
223.1.7.0
223.1.9.2
223.1.9.1
223.1.7.1
223.1.8.0
223.1.8.1
223.1.2.6
223.1.3.27
223.1.2.2
223.1.2.1
223.1.3.2
223.1.3.1
33Subnets
223.1.1.1
223.1.2.1
223.1.1.2
223.1.2.9
223.1.1.4
223.1.2.2
223.1.1.3
223.1.3.27
LAN
223.1.3.2
223.1.3.1
network consisting of 3 subnets
Subnet mask /24
34IP addressing CIDR
- CIDR Classless InterDomain Routing
- To allocate the remaining IP addresses in
variable-sized blocks, without regard to the
classes - subnet portion of address of arbitrary length
- address format a.b.c.d/x, where x is bits in
subnet portion of address
host part
subnet part
11001000 00010111 00010000 00000000
200.23.16.0/23
35CIDR Examples
5-59
- A set of IP address assignments.
36IP addresses how to get one?
- Q How does host get IP address?
- hard-coded by system admin in a file
- Wintel control-panel-gtnetwork-gtconfiguration-gttcp
/ip-gtproperties - UNIX /etc/rc.config
- DHCP Dynamic Host Configuration Protocol
dynamically get address from as server - plug-and-play
37IP addresses how to get one?
- Q How does network get subnet part of IP addr?
- A gets allocated portion of its provider ISPs
address space
ISP's block 11001000 00010111 00010000
00000000 200.23.16.0/20 Organization 0
11001000 00010111 00010000 00000000
200.23.16.0/23 Organization 1 11001000
00010111 00010010 00000000 200.23.18.0/23
Organization 2 11001000 00010111 00010100
00000000 200.23.20.0/23 ...
..
. . Organization 7
11001000 00010111 00011110 00000000
200.23.30.0/23
38Hierarchical addressing route aggregation
Hierarchical addressing allows efficient
advertisement of routing information
Organization 0
Organization 1
Send me anything with addresses beginning
200.23.16.0/20
Organization 2
ISP-1
Internet
Organization 7
Send me anything with addresses beginning
199.31.0.0/16
ISP-2
39Hierarchical addressing more specific routes
Later, ISP1 acquires ISP2, and asks Organization
1 to connect with ISP2. Hence ISP2 need a more
specific route to Organization 1
Organization 0
Send me anything with addresses beginning
200.23.16.0/20
Organization 2
ISP-1
Internet
Organization 7
Send me anything with addresses beginning
199.31.0.0/16 or 200.23.18.0/23
ISP-2
Organization 1
Recall longest prefix routing
40IP addressing the last word...
- Q How does an ISP get block of addresses?
- A ICANN Internet Corporation for Assigned
- Names and Numbers
- allocates addresses
- manages DNS root servers
- assigns domain names, resolves disputes
- Special IP address
41NAT Network Address Translation
rest of Internet
local network (e.g., home network) 10.0.0/24
10.0.0.1
10.0.0.4
10.0.0.2
138.76.29.7
10.0.0.3
All datagrams leaving local network have same
single source NAT IP address 138.76.29.7, differe
nt source port numbers
Datagrams with source or destination in this
network have 10.0.0/24 address for source,
destination (as usual)
Three reserved IP range for local network only
10.0.0.0 10.255.255.255/8 (16,777,216
hosts)172.16.0.0 -172.31.255.255/12(1,048,576
hosts)192.168.0.0 192.168.255.255/16(65,536
hosts)
42NAT Network Address Translation
- Motivation local network uses just one IP
address as far as outside word is concerned - no need to be allocated range of addresses from
ISP - just one IP address is used for all
devices - can change addresses of devices in local network
without notifying outside world - can change ISP without changing addresses of
devices in local network - devices inside local net not explicitly
addressable, visible by outside world (a security
plus).
43NAT Network Address Translation
- Implementation NAT router must
- outgoing datagrams replace (source IP address,
port ) of every outgoing datagram to (NAT IP
address, new port ) - . . . remote clients/servers will respond using
(NAT IP address, new port ) as destination
addr. - remember (in NAT translation table) every (source
IP address, port ) to (NAT IP address, new port
) translation pair - incoming datagrams replace (NAT IP address, new
port ) in dest fields of every incoming datagram
with corresponding (source IP address, port )
stored in NAT table
44NAT Network Address Translation
NAT translation table WAN side addr LAN
side addr
138.76.29.7, 5001 10.0.0.1, 3345
10.0.0.1
10.0.0.4
10.0.0.2
138.76.29.7
10.0.0.3
4 NAT router changes datagram dest addr
from 138.76.29.7, 5001 to 10.0.0.1, 3345
3 Reply arrives dest. address 138.76.29.7,
5001
45NAT Network Address Translation
- 16-bit port-number field
- 60,000 simultaneous connections with a single
LAN-side address! - NAT is controversial
- routers should only process up to layer 3
- violates end-to-end argument
- NAT possibility must be taken into account by app
designers, eg, P2P applications - address shortage should instead be solved by IPv6
46IPv6
- Initial motivation 32-bit address space soon to
be completely allocated. - 16 byte(or 128 bits) addresses. E.g.,
80000000000000000123456789ABCDEF - IPv4 address 192.31.20.46 can be written as
192.31.20.46 - Additional motivation
- header format helps speed processing/forwarding
- header changes to facilitate QoS
- IPv6 datagram format
- fixed-length 40 byte header
- no fragmentation allowed
47IPv6 Header (Cont)
Priority identify priority among datagrams in
flow Flow Label identify datagrams in same
flow. (concept offlow
not well defined). Next header identify upper
layer protocol for data
48Other Changes from IPv4
- Checksum removed entirely to reduce processing
time at each hop - Options allowed, but outside of header,
indicated by Next Header field - ICMPv6 new version of ICMP
- additional message types, e.g. Packet Too Big
- multicast group management functions
49Transition From IPv4 To IPv6
- Not all routers can be upgraded simultaneous
- no flag days
- How will the network operate with mixed IPv4 and
IPv6 routers? - Tunneling IPv6 carried as payload in IPv4
datagram among IPv4 routers
50Tunneling
51Tunneling (2)
- Tunneling a car from France to England.
52ICMP Internet Control Message Protocol
- used by hosts routers to communicate
network-level information - error reporting unreachable host, network, port,
protocol - echo request/reply (used by ping)
- network-layer above IP
- ICMP msgs carried in IP datagrams
- ICMP message type, code plus first 8 bytes of IP
datagram causing error
Type Code description 0 0 echo
reply (ping) 3 0 dest. network
unreachable 3 1 dest host
unreachable 3 2 dest protocol
unreachable 3 3 dest port
unreachable 3 6 dest network
unknown 3 7 dest host unknown 4
0 source quench (congestion
control - not used) 8 0
echo request (ping) 9 0 route
advertisement 10 0 router
discovery 11 0 TTL expired 12 0
bad IP header
53ARP Address Resolution Protocol
- Find out which Ethernet address corresponds to a
given IP address
54ARP Address Resolution Protocol
- Each IP node (Host, Router) on LAN has ARP table
- ARP Table IP/MAC address mappings for some LAN
nodes - lt IP address MAC address TTLgt
- TTL (Time To Live) time after which address
mapping will be forgotten (typically 20 min)
237.196.7.78
1A-2F-BB-76-09-AD
237.196.7.23
237.196.7.14
LAN
71-65-F7-2B-08-53
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
237.196.7.88
55ARP protocol Same LAN (network)
- A wants to send datagram to B, and Bs MAC
address not in As ARP table. - A broadcasts ARP query packet, containing B's IP
address - Dest MAC address FF-FF-FF-FF-FF-FF
- all machines on LAN receive ARP query
- B receives ARP packet, replies to A with its
(B's) MAC address - frame sent to As MAC address (unicast)
- A caches (saves) IP-to-MAC address pair in its
ARP table until information becomes old (times
out) - soft state information that times out (goes
away) unless refreshed - ARP is plug-and-play
- nodes create their ARP tables without
intervention from net administrator
56Routing to Another LAN
- walkthrough send datagram from A to B via R
- assume A knows B IP address
- Two ARP tables in router R, one for each IP
network (LAN) - In routing table at source Host, find router
111.111.111.110 - In ARP table at source, find MAC address
E6-E9-00-17-BB-4B, etc
A
R
B
57Routing to Another LAN
- A creates datagram with source A, destination B
- A uses ARP to get Rs MAC address for
111.111.111.110 - A creates link-layer frame with R's MAC address
as dest, frame contains A-to-B IP datagram - As adapter sends frame
- Rs adapter receives frame
- R removes IP datagram from Ethernet frame, sees
its destined to B - R uses ARP to get Bs MAC address
- R creates frame containing A-to-B IP datagram
sends to B
A
B
R
58DHCP Dynamic Host Configuration Protocol
send through a UDP packet to port 67
- Find out which IP address corresponds to a given
Ethernet address - First solution RARP (Reverse Address Resolution
Protocol) - Limited broadcast, which can not be forwarded by
router. While RARP server might not be in same
LAN - New solution BOOTP manual configuration ?
extend to ? DHCP dynamic configuration - Based on UDP, hence it can be forwarded by router