Network Layer and Routing
NL responsibility
• Main responsibilities
– Host to Host delivery across different network – Finding path to destination.
• Services provided to TL, receive from DL
– Connectionless and connection oriented services
– Identifying source and destination uniquely and thereby use NL address. Fragments TL data if necessary. Uses packet switching (store and forward) with datagram approach.
– In the router NL finds the appropriate interface through which it will reach the destination.
– At the destination matches the address and checks corrupt
packets, and assembly fragmented units and then sent to TL
Design Issues
• The services should be independent of the router technology.
• The transport layer should be shielded
from the number, type, and topology of the routers present.
• The network addresses made available to
the transport layer should use a uniform
numbering plan, even across LANs and
WANs.
Switching
• Store and Forward means?
• How is a packet sent from one node to another node?
– Circuit switching: connection oriented – Packet switching:
– VC approach – call set up before message transfer: packet switching connection oriented – Datagram approach – independent packet, does
not need call setup phase: packet switching
connecionless
Connectionless service
Connection oriented service
Homework
• Comparison between datagram and
virtual circuit networks
Internet Protocol
• Network layer of datagram-oriented network such as internet has three major components:
– Network protocol, e.g IP – Path determination
– Error reporting
Transport Layer:TCP, UDP
Link Layer Routing Protocols:
• path selection
•RIP, OSPF, BGP
Routing Table
IP Protocols:
• addressing conventions
•Datagram format
•Packet handling conventions ICMP protocol:
• error reporting
•Router “signaling”
IPv4 header
• header has 20bytes fixed part and a variable length optional part.
• IHL – header length in 32 bit words. minimum IHL = 5 words = 20 bytes.
maximum is 15 words.
• types of service – 6 bit field. voice, text etc. different classes of service.
• total length – 65,535 bytes
Version IHL(4) Type of Service Total length
Identification DF MF Fragment offset
TTL protocol Header checksum
Source Add Destination Add
options ( 0 or more words)
16 bits 16 bits
• Identification – identifies the fragment which datagram it belongs to.
• unused 1 bit field.
• DF stands for don’t fragment. 1 bit.
• MF stands for more fragment – all fragments except the last one has this bit set. 1 bit
• Fragment offset (13 bits) – where in the current datagram this fragment belongs. All fragments except the last one in a datagram must be a multiple of 8 bytes. there is a maximum 8192 fragments per datagram.
• TTL – counter to limit packet lifetimes in seconds. max. value 255. it must be decremented on each hop, and supposed to be decremented when
queued for long time in a router. when it hits 0 the packet is discarded and a warning message is sent back to source.
• Protocol – TCP or UDP etc.
• checksum – for header only.
• source and destination address – IP addresses.
• Options – security, strict source routing, loose source routing, record routes, timestamp etc.
IPv4 addressing
• IPv4 is 32 bits long
• Usually written in dotted decimal notation, eg.
193.32.216.9
• In the globak internet
each interface must have a unique IP address.
• Network address and host address.
• Subnet mask.
• Meaning of 223.1.1.0/24
Classful addressing
0 network Host
10 network Host
110 network Host
1110 network Mutlicast address
11110 network For future use
1.0.0.0 –
127.255.255.255 128.0.0.0 – 191.255.255.255
192.0.0.0 – 223.255.255.255 224.0.0.0 – 239.255.255.255 240.0.0.0 – 255.255.255.255
192.68.1.20/255.255.255.0 or 192.168.1.20/24 network number or address – 192.68.1.0 host number of address - 20
Special IP
• 0.0.0.0 – this host; used when the machine is booting.
• IP address with 0 as the network number refer to the current network.
• IP with all 1s allows broadcasting on local network, typically a LAN.
• IP address with all 1s in host field allows broadcasting on the remote network that matches the network number.
• 127.x.x.x - loopback
Internet structure
• At the NL internet can be viewed as a
collection of subnets or Autonomous systems
(AS) that are interconnected.
Internet working
• TL takes data streams and breaks them up into datagrams. Datagrams can be up to 64Kbytes each, but usually not more than 1500 bytes. If necessary it is
fragmented.
• When all pieces finally reaches the
destination they are reassembled by NL to original datagram. It is then handed over to TL which inserts it into receiving
process.
Transporting a datagram from src to dest
• Addressing and routing
– Key fields of IP datagram
Misc fields
Source IP address
Desti.IP address
Data
Dest. Net Next
router Nhops
223.1.1.0/24 - 1
223.1.2.0/24 223.1.1.4 2 223.1.3.0/24 223.1.1.4 2
Routing table in A A
223.1.1.1
223.1.1.2
223.1.1.3
223.1.1.4 223.1.2.9
223.1.3.27
223.1.2.1 223.1.2.2
B
E
Hub
Dest. Net Next
router Nhops interface 223.1.1.0/24 - 1 223.1.1.4 223.1.2.0/24 - 1 223.1.2.9
223.1.3.0/24 1 223.1.3.27
Routing table in router
• How is this table created in the router?
A campus network
main rout
er routers hosts
APE
CSE
Subnets
• Splitting a network into several subnetworks.
– Reduced network traffic
• Routers create broadcast domains. The smaller broadcast domains you create, the less network traffic on that network segment.
– Optimized network performance
• This is a result of reduced network traffic
– Simplified management
• It’s easier to identify and isolate network problems in a group of smaller connected networks than within one gigantic
network.
– Facilitated spanning of large geographical
distances
• Internet corporation for Assigned Names and Numbers (ICANN) – manages IP numbers
and DNS root servers
• ICANN appointed some regional authority called Internet registry who are now
responsible for IP address assignment for a particular region
– North america: American registry for internet – Reseaux IP Europeans
– Asia pacific Network Information center (APNIC)
Distance Vector Algorithm
• It is iterative, asynchronous and distrbuted.
• Each node keeps a distance table. Node X’s distance table entry, D
X(Y,Z) is the sum of the cost of the direct one hop link between X and Z, plus neighbor Z’s
currently known least cost path from itself to Y.
D
X(Y,Z) = c(X,Z)+min
w{D
Z(Y,W)}
After the algorithm converged
C
E A
B
D
D
E() A B C
A 1 14 5
B 7 8 5
C 6 9 4
D 4 11 2
Destination
Cost to destination via
7
1
2
2 8
1
X Z Y
Dx Y Z
Y 2 ∞
Z ∞ 7
Dy X Z
X 2 ∞
Z ∞ 1
Dz X Y
X 7 ∞
Y ∞ 1
Dx Y Z
Y 2 8
Z 3 7
Dy X Z
X 2 8
Z 9 1
Dz X Y
X 7 3
Y 9 1
Dx Y Z
Y 2 8
Z 3 7
Dy X Z
X 2 1+3
Z 2+3 1
Dz X Y
X 7 3
Y 9 1
2
7
1
Link cost changes and failure
Dy X Z
X 4 6
Dz X Y X 50 5
X Z
Y 4
50 1 1
Dy X Z
X 1 6
Dz X Y X 50 5
t0 t1 t2
Dy X Z
X 1 6
Dz X Y X 50 2
Dy X Z
X 1 3
Dz X Y X 50 2
• When link-cost decreases
• When link-cost increases
X Z
Y 4
50 60 1
Dy X Z
X 4 6
Dz X Y X 50 5
Dy X Z X 60 6 Dz X Y X 50 5
t0 t1 t2
Dy X Z X 60 6 Dz X Y X 50 7
Dy X Z X 60 8 Dz X Y X 50 7
Dy X Z X 60 8 Dz X Y X 50 9
• Routing loop
• Count to infinity problem
t3
CIDR
• Classless InterDomain Routing