Download Slide 1

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

Distributed firewall wikipedia , lookup

Peering wikipedia , lookup

Asynchronous Transfer Mode wikipedia , lookup

VMEbus wikipedia , lookup

Parallel port wikipedia , lookup

Piggybacking (Internet access) wikipedia , lookup

Multiprotocol Label Switching wikipedia , lookup

Net bias wikipedia , lookup

Deep packet inspection wikipedia , lookup

Network tap wikipedia , lookup

AppleTalk wikipedia , lookup

Computer network wikipedia , lookup

IEEE 1355 wikipedia , lookup

Airborne Networking wikipedia , lookup

I²C wikipedia , lookup

Internet protocol suite wikipedia , lookup

Wake-on-LAN 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
Lecture 4
TCP/IP Network Layer (2)
Khaled Mahbub, IICT, BUET, 2008
ICT 6621 : Advanced Networking
Outline (Network Layer)
• Principles behind network
layer services:
– Virtual circuit and datagram
networks
– Routing algorithms
•
•
•
•
Link State
Distance Vector
Hierarchical
Routing Tables
• What’s inside a router
• Internet Protocol
–
–
–
–
Datagram format
IPv4 addressing
CIDR
IPv6
Khaled Mahbub, IICT, BUET, 2008
• Routing in the Internet
– RIP
– OSPF
– BGP
• Broadcast and multicast routing
• Miscellaneous protocols and
programs
ICT 6621 : Advanced Networking
Router Architecture Overview
Two key router functions:
• run routing algorithms/protocol
• forwarding datagrams from incoming to outgoing link
Khaled Mahbub, IICT, BUET, 2008
ICT 6621 : Advanced Networking
Input Port Functions
Physical layer:
bit-level reception
Data link layer:
e.g., Ethernet
Decentralized switching:
• given datagram dest., lookup output port using forwarding
table in input port memory.
• goal: complete input port processing at ‘line speed’.
Lookup speed can be increased by applying efficient
algorithm/data structure (e.g. like binary tree based on bit
values), rather than linear search of the routing table.
• queuing: if datagrams arrive faster than forwarding rate
into switch fabric
Khaled Mahbub, IICT, BUET, 2008
ICT 6621 : Advanced Networking
Three types of switching fabrics
Khaled Mahbub, IICT, BUET, 2008
ICT 6621 : Advanced Networking
Switching Via Memory
First generation routers:
• traditional computers with switching under direct control of
CPU (acts as routing processor)
• Input port interrupts the processor and copies the packet to
system’s memory
• Processor extracts the destination address, finds the output
port and copies the packet to the output port.
• speed limited by memory bandwidth (2 bus crossings per
datagram)
Memory
Input
Port
Output
Port
System Bus
Khaled Mahbub, IICT, BUET, 2008
ICT 6621 : Advanced Networking
Switching Via a Bus
• datagram from input port
memory to output port memory
via a shared bus, without
intervention by the routing
processor.
• Only one packet can be
transferred at a time.
• bus contention: switching
speed limited by bus bandwidth
• 1 Gbps bus, Cisco 1900:
sufficient speed for access and
enterprise routers.
Khaled Mahbub, IICT, BUET, 2008
ICT 6621 : Advanced Networking
Switching Via An Interconnection Network
• overcome bus bandwidth limitations
• A crossbar switch is an interconnection network consisting of 2N
busses that connect N input ports to N output ports.
• A packet arriving at an input port travels along the horizontal bus
attached to the input port until it intersects with the vertical bus
leading to the desired output port.
• If the vertical bus leading to the output port is free, the packet is
transferred to the output port. If the vertical bus is being used to
transfer a packet from another input port to this same output port,
the arriving packet is blocked and must be queued at the input
port.
• Cisco 12000 family switches uses interconnection network
Khaled Mahbub, IICT, BUET, 2008
ICT 6621 : Advanced Networking
Output Ports
• Output port takes the datagrams that have been stored in
the output port's memory and transmits them over the
outgoing link.
• Buffering required when datagrams arrive from fabric faster
than the transmission rate
• Scheduling discipline chooses among queued datagrams
for transmission
Khaled Mahbub, IICT, BUET, 2008
ICT 6621 : Advanced Networking
Output Port Queuing
• buffering when arrival rate via switch exceeds output line speed
• queueing (delay) and loss due to output port buffer overflow!
• packet scheduler at the output port must choose one packet among
those queued for transmission.
– first-come-first-served (FCFS) scheduling
– weighted fair queueing (WFQ)
Khaled Mahbub, IICT, BUET, 2008
ICT 6621 : Advanced Networking
Input Port Queuing
• Fabric slower than input ports combined -> queueing may
occur at input queues
• Head-of-the-Line (HOL) blocking: queued datagram at
front of queue prevents others in queue from moving
forward
• queueing delay and loss due to input buffer overflow!
Khaled Mahbub, IICT, BUET, 2008
ICT 6621 : Advanced Networking
Outline (Network Layer)
• Principles behind network
layer services:
– Virtual circuit and datagram
networks
– Routing algorithms
•
•
•
•
Link State
Distance Vector
Hierarchical
Routing Tables
• What’s inside a router
• Internet Protocol
–
–
–
–
Datagram format
IPv4 addressing
ICMP
IPv6
Khaled Mahbub, IICT, BUET, 2008
• Routing in the Internet
–
–
–
–
RIP
OSPF
BGP
CIDR
• Broadcast and multicast routing
• Miscellaneous protocols
ICT 6621 : Advanced Networking
Internet Protocol
• The network protocol in the Internet (TCP/IP stack) is
called the Internet Protocol, or more commonly, the IP
Protocol.
• There are currently two versions of the IP protocol in use
today.
– Internet Protocol version 4, is more commonly known as IPv4.
– Internet Protocol version 6, is more commonly known as IPv6.
• Functionality:
– Determine how to route packets from source to destination
– Hide the details of the physical network
– Unreliable, connectionless, datagram delivery
Khaled Mahbub, IICT, BUET, 2008
ICT 6621 : Advanced Networking
IP datagram format (IPv4)
Khaled Mahbub, IICT, BUET, 2008
ICT 6621 : Advanced Networking
IP Header
• Version: 4
• Header length: 4 bits, number of 32 bits words (4bytes), max
15x4=60 bytes
• TOS: 0 for normal service,
• Total length: 16 bits, max 65535 bytes
• Identifier, flags, offset: for fragmentation and reassembly
• TTL: 32/64, decrease by one in each hop
• Protocol field: TCP, UCP, ICMP, IGMP, etc.
• Checksum: header only
Khaled Mahbub, IICT, BUET, 2008
ICT 6621 : Advanced Networking
Recommended Values for TOS Field
Application
Minimize
Delay
Maximize
Throughput
Maximize
Reliability
Telnet/Rlogin
FTP
control
data
any bulk data
TFTP
SMTP
command phase
data phase
DNS
UDP query
TCP query
zone transfer
ICMP
error
query
any IGP
SNMP
BOOTP
NNTP
1
0
0
0
0X10
1
0
0
1
0
1
1
0
0
0
0
0
0
0
0
0
0X10
0X08
0X08
0X10
1
0
0
1
0
0
0
0
0X10
0x08
1
0
0
0
0
1
0
0
0
0
0
0
0X10
0X00
0X08
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
1
0
0
0
0
0
0
0
1
0X00
0X00
0X04
0X04
0X00
0X02
Khaled Mahbub, IICT, BUET, 2008
Minimize
Hex Value
Monetary Cost
ICT 6621 : Advanced Networking
IP Fragmentation & Reassembly
• network links have MTU
(max. transmission unit) 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
Khaled Mahbub, IICT, BUET, 2008
fragmentation:
in: one large datagram
out: 3 smaller datagrams
reassembly
ICT 6621 : Advanced Networking
IP Fragmentation and Reassembly
length ID fragflag offset
=4000 =x
=0
=0
Example
• 4000 byte
datagram
• MTU = 1500 bytes
1480 bytes in
data field
offset
1020 bytes in
data field
(3980 – 1480 – 1480)
Khaled Mahbub, IICT, BUET, 2008
One large datagram becomes
several smaller datagrams
length ID fragflag offset
=1500 =x
=1
=0
length ID fragflag offset
=1500 =x
=1
=1480
length ID fragflag offset
=1040 =x
=0
=2960
ICT 6621 : Advanced Networking
Outline (Network Layer)
• Principles behind network
layer services:
– Virtual circuit and datagram
networks
– Routing algorithms
•
•
•
•
Link State
Distance Vector
Hierarchical
Routing Tables
• What’s inside a router
• Internet Protocol
–
–
–
–
Datagram format
IPv4 addressing
CIDR
IPv6
Khaled Mahbub, IICT, BUET, 2008
• Routing in the Internet
– RIP
– OSPF
– BGP
• Broadcast and multicast routing
• Miscellaneous protocols and
programs
ICT 6621 : Advanced Networking
IP Addressing: Introduction
• IP address: 32-bit
identifier for host,
router interface
• interface:
connection between
host/router and
physical link
– router’s typically
have multiple
interfaces
– host may have
multiple interfaces
Khaled Mahbub, IICT, BUET, 2008
223.1.1.1
223.1.2.1
223.1.1.2
223.1.1.4
223.1.1.3
223.1.2.9
223.1.3.27
223.1.2.2
223.1.3.2
223.1.3.1
223.1.1.1 = 11011111 00000001 00000001 00000001
223
1
ICT 6621 : Advanced Networking
1
1
IP Addressing
• Q: Every host has one unique IP-address (true/false)?
Answer
False: one address per interface, not one address per host, e.g., a host
with multiple connections, routers
- host may also have multiple
Interfaces
– IP addresses associated with
interface, not host
– what about routers?
router’s typically have
multiple interfaces (so multiple
IP addresses)
Khaled Mahbub, IICT, BUET, 2008
ICT 6621 : Advanced Networking
IP Addressing
• IP address:
– network part (high
order bits)
– host part (low order
bits)
• What’s a network ?
– device interfaces with
same network part of
IP address
– can physically reach
each other without
intervening router
Khaled Mahbub, IICT, BUET, 2008
223.1.1.1
223.1.2.1
223.1.1.2
223.1.1.4
223.1.1.3
223.1.2.9
223.1.2.2
223.1.3.27
LAN
223.1.3.1
223.1.3.2
ICT 6621 : Advanced Networking
Subnets
• How to find
networks
223.1.1.2
223.1.1.1
223.1.1.4
– detach each
223.1.1.3
interface from its
host or router,
223.1.7.0
223.1.9.2
creating islands of
isolated networks.
Each isolated
network is called a
223.1.9.1
223.1.7.1
subnet. e.g.
223.1.8.1
223.1.8.0
Interconnected
223.1.2.6
223.1.3.27
system consisting
223.1.2.2 223.1.3.1
223.1.3.2
of six networks 223.1.2.1
Khaled Mahbub, IICT, BUET, 2008
ICT 6621 : Advanced Networking
IP Address Classes (Classful Addressing)
• Determining the class:
– if first bit is 0 then class A
– else if second bit 0 then class B
– else if ...
Khaled Mahbub, IICT, BUET, 2008
ICT 6621 : Advanced Networking
Subnet Addressing
• Subnetting allows another level of hierarchy in the IP
address
• From the IP address used one can determine the class
being used
• Subnet Mask determines the boundary between subnet ID &
host ID
• Subnetting is not visible to the outside networks
• Subnetting reduces the complexity in routing
• It is not necessary that the subnet ID be 8 bits
Khaled Mahbub, IICT, BUET, 2008
ICT 6621 : Advanced Networking
Subnet Masking
• IP address:
10101000 11110000 00010100 00100101
• Mask:
11111111 11111111 11111111 00000000
• Applying Mask:
10101000 11110000 00010100 000000000
• Example Subnet Masks
– host’s address is 140.134.6.5
• subnet mask is 255.255.0.0 (No subnetting)
– host address is 140.134.6.5
• subnet mask is 255.255.255.0 (subnetting with 8 bits)
– host address is 140.134.6.5
• subnet mask is 255.255.255.192 (subnetting with 6 bits)
Khaled Mahbub, IICT, BUET, 2008
ICT 6621 : Advanced Networking
IP Addressing: CIDR
• classful addressing:
– inefficient use of address space, address space
exhaustion
– e.g., class B net allocated enough addresses for 65K
hosts, even if only 2K hosts in that network
• CIDR: Classless Inter Domain Routing
– network portion of address of arbitrary length
– address format: a.b.c.d/x, where x is # bits in network
portion of address
host
part
subnet
part
11001000 00010111 00010000 00000000
200.23.16.0/23
Khaled Mahbub, IICT, BUET, 2008
ICT 6621 : Advanced Networking
Special Case IP Addresses
IP address
net ID
Subnet
ID
Can appear as
Description
Host ID
Source?
Dest?
0
0
0
hostid
OK
OK
Never
never
127
anything
OK
OK
Loop back address
-1
netid
netid
netid
-1
-1
-1
-1
Never
Never
Never
Never
OK
OK
OK
OK
limited broadcast (never forwarded)
net-directed broadcast to netid
subnet-directed broadcast to netid,subnetid
all-subnets-directed broadcast to netid
subnetid
-1
this host on this net
specified host on this net
• A blank subnet ID column means the address is not subnetted.
• The first two entries are special case source address and used only in the
initialization procedure when a host is determining its own IP address,
(e.g. BOOTP protocol)
• The third address is the special loopback address.
• The last four addresses are the broadcast addresses.
Khaled Mahbub, IICT, BUET, 2008
ICT 6621 : Advanced Networking
IP Addresses: How to Get One
• How does host get IP address?
– hard-coded by system admin in a file
• Wintel: control-panel->network->configuration>tcp/ip->properties
• UNIX: /etc/rc.config
– DHCP: Dynamic Host Configuration Protocol:
dynamically get address from as server
• “plug-and-play” (more in later lecture)
• How does an ISP get block of addresses?
ICANN: Internet Corporation for Assigned Names and Numbers
• allocates addresses
• manages DNS
• assigns domain names, resolves disputes
Khaled Mahbub, IICT, BUET, 2008
ICT 6621 : Advanced Networking
NAT: Network Address Translation
Private IP address ranges:
10.0.0.0 – 10.255.255.255/8
172.16.0.0 – 172.31.255.255/12
192.168.0.0 – 192.168.255.255/16
rest of
Internet
(16,772,216 hosts)
(1,048,576 hosts)
(65,536 hosts)
local network
(e.g., home network)
10.0.0/24
10.0.0.4
10.0.0.1
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,
different source port numbers
Khaled Mahbub, IICT, BUET, 2008
Datagrams with source or
destination in this network
have 10.0.0/24 address for
source, destination (as usual)
ICT 6621 : Advanced Networking
NAT: 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).
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 address.
– 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 destination fields
of every incoming datagram with corresponding (source IP address, port #)
stored in NAT table
Khaled Mahbub, IICT, BUET, 2008
ICT 6621 : Advanced Networking
NAT: Network Address Translation
2: NAT router
changes datagram
source addr from
10.0.0.1, 3345 to
138.76.29.7, 5001,
updates table
2
NAT translation table
WAN side addr
LAN side addr
1: host 10.0.0.1
sends datagram to
128.119.40, 80
138.76.29.7, 5001 10.0.0.1, 3345
……
……
S: 10.0.0.1, 3345
D: 128.119.40.186, 80
S: 138.76.29.7, 5001
D: 128.119.40.186, 80
138.76.29.7
S: 128.119.40.186, 80
D: 138.76.29.7, 5001
3: Reply arrives
dest. address:
138.76.29.7, 5001
Khaled Mahbub, IICT, BUET, 2008
3
1
10.0.0.4
S: 128.119.40.186, 80
D: 10.0.0.1, 3345
10.0.0.1
10.0.0.2
4
10.0.0.3
4: NAT router
changes datagram
dest addr from
138.76.29.7, 5001 to 10.0.0.1, 3345
ICT 6621 : Advanced Networking
NAT: Network Address Translation
• 16-bit port-number field:
– 60,000 simultaneous connections with a single LANside address!
• NAT is controversial:
– routers should only process up to layer 3 (violation of
fundamental rule of protocol layering).
– Force to treat Internet as connection oriented network
(i.e. NAT table has to maintain info for each
connection)
– violates end-to-end argument
• NAT possibility must be taken into account by app designers,
e.g., P2P applications
– address shortage should instead be solved by IPv6
Khaled Mahbub, IICT, BUET, 2008
ICT 6621 : Advanced Networking
Outline (Network Layer)
• Principles behind network
layer services:
– Virtual circuit and datagram
networks
– Routing algorithms
•
•
•
•
Link State
Distance Vector
Hierarchical
Routing Tables
• What’s inside a router
• Internet Protocol
–
–
–
–
Datagram format
IPv4 addressing
CIDR
IPv6
Khaled Mahbub, IICT, BUET, 2008
• Routing in the Internet
– RIP
– OSPF
– BGP
• Broadcast and multicast routing
• Miscellaneous protocols and
programs
ICT 6621 : Advanced Networking
IPv6
• Why IPv6?
– Need for larger address space. 32-bit address space
of IPv4 soon to be completely allocated.
• Additional motivation: Support for new
applications like real-time audio and video that
require network guarantees in the network
– header format helps speed processing/forwarding
– header changes to facilitate QoS
• IPv6 datagram format:
– fixed-length 40 byte header
– no fragmentation allowed
Khaled Mahbub, IICT, BUET, 2008
ICT 6621 : Advanced Networking
IPv6 Header
• Version (4 bits): This field identifies the IP
version number. For IPv6 it is 6, for IPv4 it
is 4
• Traffic class (8 bits): This field is used by
the source and routers to identify the
packets belonging to the same traffic class
and thus distinguish between packets with
different priorities.
• flow label (20 bits): This field is used to
identify a "flow" of packets from different
processes.
• payload length (16 bits): This field is used
to specify the number of bytes in the IPv6
packet following the fixed length, 40 byte
packet header
Khaled Mahbub, IICT, BUET, 2008
ICT 6621 : Advanced Networking
IPv6 Header
•
•
next header (8 bits): This field identifies the
protocol to which the contents (data field) of
this packet will be delivered (e.g., to TCP or
UDP). The field uses the same values as the
Protocol field in the IPv4 header.
hop limit (8 bits). The contents of this field are
decremented by one by each router that
forward the packet. If the hop limit count
reaches zero, the packet is discarded.
• Source/destination address (128 bits):
address of source and target hosts. IPv6
address is expressed as eight unsigned
integers on 16 bits and writing each
number with four hexadecimal digits,
where numbers are separated by colons,
e.g.
1080:0000:0000:0000:0008:0800:200C:417A
1080::8:800:200C:417A
Khaled Mahbub, IICT, BUET, 2008
ICT 6621 : Advanced Networking
IPv4 vs IPv6
• Key differences
– Address size is 128-bits
– No fragmentation/reassembly
– Checksum: removed entirely to reduce
processing time at each hop
– fixed-length 40 byte header
– flexible header format for options, i.e. Options:
allowed, but outside of header, indicated by
“Next Header” field (known as extension
headers)
– Also a new ICMP for IPv6, ICMPv6 (will be
discussed in next lecture)
Khaled Mahbub, IICT, BUET, 2008
ICT 6621 : Advanced Networking
Transition From IPv4 To IPv6
• Not all routers are upgraded
– How will the network operate with mixed IPv4
and IPv6 routers?
• Two proposed approaches:
– Dual Stack: some routers with dual stack (v6,
v4) can “translate” between formats
– Tunneling: IPv6 carried as payload in IPv4
datagram among IPv4 routers
Khaled Mahbub, IICT, BUET, 2008
ICT 6621 : Advanced Networking
Dual Stack Approach
Khaled Mahbub, IICT, BUET, 2008
ICT 6621 : Advanced Networking
Tunneling
Logical view:
Physical view:
A
B
IPv6
IPv6
A
B
C
IPv6
IPv6
IPv4
Flow: X
Src: A
Dest: F
data
A-to-B:
IPv6
Khaled Mahbub, IICT, BUET, 2008
E
F
IPv6
IPv6
D
E
F
IPv4
IPv6
IPv6
tunnel
Src:B
Dest: E
Src:B
Dest: E
Flow: X
Src: A
Dest: F
Flow: X
Src: A
Dest: F
data
data
B-to-C:
IPv6 inside
IPv4
B-to-C:
IPv6 inside
IPv4
Flow: X
Src: A
Dest: F
data
E-to-F:
IPv6
ICT 6621 : Advanced Networking
Notice
• Mid term 1 on 7th June @5:15 PM
• Duration 1 hour, Full Marks: 30
• Syllabus: Topics covered in the first four lectures.
• Tips for the exam:
– True/False, MCQ and short questions.
– Read the books thoroughly, Do not rely on the
lecture slides only.
– Do not memorize blindly, Try to get the clear
concept of the topics.
– Most of the questions will be set to try out your
concept and understanding.
Khaled Mahbub, IICT, BUET, 2008
ICT 6621 : Advanced Networking
Reading Material
• Chapter 4 – text3 (Kurose)
• Chapter 5 – text2 (Tanenbaum)
• Chapter 3 – text1 (Stevens)
Khaled Mahbub, IICT, BUET, 2008
ICT 6621 : Advanced Networking