Network Layer 5-1 2010 session 1 TELE3118: Network Technologies Week 5: Network Layer Forwarding, Features Some slides have been taken from: Computer Networking: A Top Down Approach Featuring the Internet , 4 th edition. Jim Kurose, Keith Ross. Addison-Wesley, July 2007. All material copyright 1996-2004. J.F Kurose and K.W. Ross, All Rights Reserved. Computer Networks, 4 th edition. Andrew S. Tanenbaum. Prentice- Hall, 2003.
27
Embed
Network Layer5-1 2010 session 1 TELE3118: Network Technologies Week 5: Network Layer Forwarding, Features Some slides have been taken from: r Computer.
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Network Layer 5-1
2010 session 1TELE3118: Network
Technologies
Week 5: Network LayerForwarding, Features
Some slides have been taken from:Computer Networking: A Top Down Approach Featuring the Internet, 4th edition. Jim Kurose, Keith Ross. Addison-Wesley, July 2007. All material copyright 1996-2004. J.F Kurose and K.W. Ross, All Rights Reserved.Computer Networks, 4th edition. Andrew S. Tanenbaum. Prentice-Hall, 2003.
Network Layer 5-2
IP Forwarding
Case I: hosts in same LAN (A B)
Case II: hosts in different LANs (A E)
A note on terminology:Switch (bridge) vs. Router
Hardware vs. software? layer-2 vs. layer-3?
223.1.1.1
223.1.1.2
223.1.1.3
223.1.1.4 223.1.2.9
223.1.2.2
223.1.2.1
223.1.3.2223.1.3.1
223.1.3.27
A
B
E
IP datagram:
miscfields
sourceIP addr
destIP addr data
Network Layer 5-3
Case I: hosts in same LAN
Starting at A, dest. B: look up dest-IP in routing
table dest is in LAN on interface
223.1.1.1 send datagram directly to B
in Ethernet frame how to determine B’s
Ethernet MAC address?
routing table at ADest Mask Next-hop
223.1.1.0 24 L: 223.1.1.1
0.0.0.0 0 223.1.1.4
B’s MACaddr
A’s MACaddr
A’s IPaddr
B’s IPaddr
IP payload
datagramframe
frame source,dest address
datagram source,dest address
miscfields223.1.1.1223.1.1.3data
223.1.1.1
223.1.1.2
223.1.1.3
223.1.1.4 223.1.2.9
223.1.2.2
223.1.2.1
223.1.3.2223.1.3.1
223.1.3.27
A
B
E
Network Layer 5-4
ARP: Address Resolution Protocol
Each IP node (Host, Router) on LAN has ARP table
ARP Table: IP/MAC address mappings for same LAN nodes
< IP address; MAC address; TTL>
TTL (Time To Live): time after which address mapping will be forgotten (typically 20 min)
Network Layer 5-5
ARP protocol
A wants to send datagram to B, and A knows B’s IP address.
Suppose B’s MAC address is not in A’s ARP table.
A broadcasts ARP query packet, containing B's IP address all machines on LAN
receive ARP query B receives ARP packet,
replies to A with its (B's) MAC address frame sent to A’s 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
Network Layer 5-6
Case II: hosts in different LANs
Starting at A, dest. E: look up network address of
E in routing table E on different network
A, E not directly attached
routing table: next hop router to E is 223.1.1.4
link layer sends datagram to router 223.1.1.4 in Ethernet frame (ARP)
datagram arrives at 223.1.1.4
continued…..
miscfields223.1.1.1223.1.2.2 data
routing table at ADest Mask Next-hop
223.1.1.0 24 L: 223.1.1.1
0.0.0.0 0 223.1.1.4
223.1.1.1
223.1.1.2
223.1.1.3
223.1.1.4 223.1.2.9
223.1.2.2
223.1.2.1
223.1.3.2223.1.3.1
223.1.3.27
A
B
E
Network Layer 5-7
Case II (contd.)
Arriving at 223.1.4, destined for 223.1.2.2
look up network address of E in router’s routing table
E on same network as router’s interface 223.1.2.9 router, E directly
attached link layer sends datagram
to 223.1.2.2 in Ethernet frame via interface 223.1.2.9 (ARP)
datagram arrives at 223.1.2.2!!! (hooray!)
miscfields223.1.1.1223.1.2.2 data
routing table in router
223.1.1.1
223.1.1.2
223.1.1.3
223.1.1.4 223.1.2.9
223.1.2.2
223.1.2.1
223.1.3.2223.1.3.1
223.1.3.27
A
B
E
Dest Mask Next-hop
223.1.1.0 24 L: 223.1.1.4
223.1.2.0 24 L: 223.1.2.9
223.1.3.0 24 L: 223.1.3.27
Network Layer 5-8
Packet walk-throughA (111.111.111.111) B (222.222.222.222)
A
RB
Each node (host/router) has Route table: dest/mask next-hop ARP table: LAN IP addr MAC address
Network Layer 5-9
A creates datagram with source A, destination B A uses ARP to get R’s 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 A’s data link layer sends frame R’s data link layer receives frame R removes IP datagram from Ethernet frame, sees its
destined to B R uses ARP to get B’s physical layer address R creates frame containing A-to-B IP datagram sends to B B receives the frame and extracts IP datagram
A
RB
Network Layer 5-10
To switch or route?
vlan 100 vlan 200
1
2
3
4
sMAC dMAC sIP dIP ----Data---- ??
Assume unicast traffic Lookup dMAC in MAC-table If (dMAC ≠ interface MAC) switch
switch (bridge) the frame as is onto learnt port
Else frame is for upper layer (IP) route Lookup dest-IP in routing table (discard if no match) Determine next hop MAC addr (ARP table) Send datagram with new Ethernet header
Network Layer 5-11
Switch-Router MAC table
VLAN MAC address port
3 08-00-60-00-09 10
3 08-00-60-00-17 6
3 00-4E-3A-02-08 Self
3 08-00-60-00-51 4
76 08-00-60-00-A3 7
76 08-00-60-00-46 8
76 08-00-60-00-1B 10
2018 08-00-60-00-51 3
2018 08-00-60-00-92 10
2018 00-4E-3A-02-10 Self
router IP interfaceson VLANs 3 and 2018
No router IP interfaceon VLAN 76
Network Layer 5-12
Switch-Router routing table
0.0.0.0 0 192.168.1.1
10.0.0.0 8 172.20.4.1
200.23.16.0 20 199.31.18.4
200.23.18.0 23 172.20.4.1
10.20.0.0 24 199.31.18.4
192.168.1.0 24 L 192.168.1.18
172.20.4.0 24 L 172.20.4.253
199.31.18.0 24 L 199.31.18.52
destination mask loca
l
next-hop
LAN
inte
rface
s
172.20.4.253/24
192.168.1.18/24199.31.18.52/24
default route
Network Layer 5-13
Unicast forwarding algorithm
Determinemost specific
match in routingtable
foundone?
droppacket
dest onsame LAN.
nh-IP = dest-IP
localintf?
next-hopis router.
nh-IP = gway-IP
nh-IP inARP table?
send ARPrequest and
wait for response
get ARPresponse and
fill in ARP table
constructEthernet
header andsend frame
no yes
yes no
no
yes
dest-MACaddressmine?
discard
extract IPdatagram
dest-IPaddressmine?
pass datagramdata to upper layer
yes
no
no
yes
Send:Host receive:
switchEthernet
frame
dest-MACaddressmine?
Route IPdatagram
extract IPdatagram
dest-IPaddressmine?
pass datagramdata to
upper layer
yes
no
no
yes
Switch/routerreceive:
Network Layer 5-14
IP/Ethernet configuration
1.1.1.1/24 1.1.1.2/24 1.1.1.1/24 1.1.2.2/24
1.1.1.1/24 1.1.2.2/24
what’s going on ??
1.1.1.3/16
A B
C
Dest Mask Gateway
1.1.1.0 24 L: 1.1.1.1
0.0.0.0 0 1.1.1.100
IP interface: 1.1.1.1/24Interface route
Network Layer 5-15
IP/Ethernet configuration
1.1.1.1/24default route: 1.1.1.100
1.1.2.2/24default route: 1.1.2.100
1.1
.1.1
00
/24
1.1
.2.1
00
/24
Dest Mask
Gateway
1.1.1.0 24 L:1.1.1.1
0.0.0.0 0 1.1.1.100
Internet
Network Layer 5-16
IP/Ethernet configuration192.168.1.1/16
default route: 192.168.1.100
192.168.1.3/24default route: 192.168.1.100
19
2.1
68
.1.1
00
/24
19
2.1
68
.2.1
00
/24
192.168.2.4/24default route: 192.168.2.100
A
C
D
IP reachability:
switch
---
---
---
---
from
ABCD
A B C Dto
192.168.2.2/24default route: 192.168.2.100
B
router
Network Layer 5-17
IP datagram format
ver length
32 bits
data (variable length,typically a TCP
or UDP segment)
16-bit identifier
Internet checksum
time tolive
32 bit source IP address
IP protocol versionnumber
header length (bytes)
max numberremaining hops
(decremented at each router)
forfragmentation/reassembly
total datagramlength (bytes)
upper layer protocolto deliver payload to
head.len
type ofservice
“type” of data flgsfragment
offsetupper layer
32 bit destination IP address
Options (if any) E.g. timestamp,record routetaken, specifylist of routers to visit.
how much overhead with TCP?
20 bytes of TCP 20 bytes of IP = 40 bytes +
app layer overhead
Network Layer 5-18
IP 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 datagramout: 3 smaller datagrams
reassembly
Network Layer 5-19
IP Fragmentation and Reassembly
ID=x
offset=0
fragflag=0
length=4000
ID=x
offset=0
fragflag=1
length=1500
ID=x
offset=185
fragflag=1
length=1500
ID=x
offset=370
fragflag=0
length=1040
One large datagram becomesseveral smaller datagrams
Example 4000 byte
datagram MTU = 1500
bytes
1480 bytes in data field
offset =1480/8
Network Layer 5-20
ICMP: 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 description0 0 echo reply (ping)3 0 dest. network unreachable3 1 dest host unreachable3 2 dest protocol unreachable3 3 dest port unreachable3 6 dest network unknown3 7 dest host unknown4 0 source quench (congestion control - not used)8 0 echo request (ping)9 0 route advertisement10 0 router discovery11 0 TTL expired12 0 bad IP header
Network Layer 5-21
Traceroute and ICMP
Source sends series of UDP segments to dest First has TTL =1 Second has TTL=2, etc. Unlikely port number
When nth datagram arrives to nth router: Router discards
soon to be completely allocated. Additional motivation:
header format helps speed processing/forwarding
header changes to facilitate QoS IPv6 datagram format: fixed-length 40 byte header no fragmentation allowed
Network Layer 5-23
IPv6 Header (Cont)Priority: identify priority among datagrams in flowFlow Label: identify datagrams in same “flow.” (concept of“flow” not well defined).Next header: identify upper layer protocol for data
Network Layer 5-24
Other 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
Network Layer 5-25
Transition 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