CSCI x760 - Computer Networks Spring 2016
Instructor: Prof. Roberto Perdisci perdisci@cs.uga.edu
source: computer-networks-webdesign.com
These slides are adapted from the textbook slides by J.F. Kurose and K.W. Ross
CSCI x760 - Computer Networks Spring 2016 Instructor: Prof. Roberto - - PowerPoint PPT Presentation
source: computer-networks-webdesign.com CSCI x760 - Computer Networks Spring 2016 Instructor: Prof. Roberto Perdisci perdisci@cs.uga.edu These slides are adapted from the textbook slides by J.F. Kurose and K.W. Ross Chapter 4: Network Layer
Instructor: Prof. Roberto Perdisci perdisci@cs.uga.edu
source: computer-networks-webdesign.com
These slides are adapted from the textbook slides by J.F. Kurose and K.W. Ross
Network Layer 4-2
} network layer service models } forwarding versus routing } how a router works } routing (path selection) } dealing with scale } advanced topics: IPv6, mobility
Network Layer 4-3
} Datagram format } IPv4 addressing } ICMP } IPv6
} Link state } Distance
} Hierarchical routing
} RIP } OSPF } BGP
Network Layer 4-4 } transport segment from sending to receiving
} on sending side encapsulates segments into
} on rcving side, delivers segments to transport
} network layer protocols in every host, router } router examines header fields in all IP
application transport network data link physical application transport network data link physical network data link physical network data link physical network data link physical network data link physical network data link physical network data link physical network data link physical network data link physical network data link physical network data link physical network data link physical
Network Layer 4-5
} routing algorithms
Network Layer 4-6
2 3
0111
value in arriving packet’s header
routing algorithm local forwarding table header value output link
0100 0101 0111 1001 3 2 2 1
Network Layer 4-7
} no network-level concept of “connection”
} packets between same source-dest pair may take different paths
Network Layer 4-8
Network Layer 4-9
Network Layer 4-10
} Datagram format } IPv4 addressing } ICMP } IPv6
} Link state } Distance
} Hierarchical routing
} RIP } OSPF } BGP
Network Layer 4-11
Routing protocols
IP protocol
ICMP protocol
Network Layer 4-12
} Datagram format } IPv4 addressing } ICMP } IPv6
} Link state } Distance
} Hierarchical routing
} RIP } OSPF } BGP
Network Layer 4-13
❒ 20 bytes of TCP ❒ 20 bytes of IP ❒ = 40 bytes + app
Network Layer 4-14 } network links have MTU
} different link types, different
} large IP datagram divided
} one datagram becomes several
} “reassembled” only at final
} IP header bits used to identify,
fragmentation: in: one large datagram
reassembly
Network Layer 4-15
❒ 4000 byte
❒ MTU = 1500 bytes
} ID = 4325, Flag = 1, offset = 0, length = 820 } ID = 4325, Flag = 1, offset = 100, length = 820 } ID = 4325, Flag = 1, offset = 200, length = 820 } ID = 4325, Flag = 0, offset = 300, length = 700
Network Layer 4-16
} ID = 4325, Flag = 1, offset = 0, length = 924 } ID = 4325, Flag = 1, offset = 113, length = 924 } ID = 4325, Flag = 1, offset = 226, length = 924 } ID = 4325, Flag = 0, offset = 339, length = 388
Network Layer 4-17
Network Layer 4-18
} Datagram format } IPv4 addressing } ICMP } IPv6
} Link state } Distance
} Hierarchical routing
} RIP } OSPF } BGP
Network Layer 4-19
} router’s typically have
} host typically has one
} IP addresses associated with
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.2 223.1.3.1 223.1.3.27 223.1.1.1 = 11011111 00000001 00000001 00000001 223 1 1 1
Network Layer 4-20
} subnet part (high order bits) } host part (low order bits)
} devides interfaces with same
} can physically reach each
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.2 223.1.3.1 223.1.3.27
Network Layer 4-21
223.1.1.0/24 223.1.2.0/24 223.1.3.0/24
Network Layer 4-22
223.1.1.1 223.1.1.3 223.1.1.4 223.1.2.2 223.1.2.1 223.1.2.6 223.1.3.2 223.1.3.1 223.1.3.27 223.1.1.2 223.1.7.0 223.1.7.1 223.1.8.0 223.1.8.1 223.1.9.1 223.1.9.2
Network Layer 4-23
} subnet portion of address of arbitrary length } address format: a.b.c.d/x, where x is # bits in subnet portion
} 192.168.(00000110).(01100010)
} 192.168.(01000001).(00000011)
} CIDR
} 192.168.(00000000).(00000000)/17 } 192.168.0.0/17
} Subnet Mask
} 255.255.(10000000). (00000000) } 255.255.128.0 } IP & SM = CIDR
} 172.18.5.(11010111)
} 172.18.5.(11010010)
} CIDR
} 172.18.5.(11010000)/29 } 172.18.5.208/29
} Subnet Mask
} 255.255.255. (11111000) } 255.255.255.248 } IP & SM = CIDR Network Layer 4-24
} 10.35.25.102, 10.35.27.23, 10.35.28.203, 10.35.30.124 } CIDR = } Subnet Mask =
Network Layer 4-25
} 172.17.2.102, 172.17.2.65, 172.17.2.87, 172.17.2.124 } CIDR = } Subnet Mask =
} 10.0.0.0/8
} 127.0.0.0/8
} 169.254.0.0/16 Link-Local
} 172.16.0.0/12 Private network RFC 1918 } 192.0.0.0/24
} 192.0.2.0/24
} 192.88.99.0/24 IPv6 to IPv4 relay RFC 3068 } 192.168.0.0/16 Private network RFC 1918 } 198.18.0.0/15
} 198.51.100.0/24 TEST
} 203.0.113.0/24 TEST
} 224.0.0.0/4
} 240.0.0.0/4
} 255.255.255.255
Network Layer 4-26
Network Layer 4-27
} hard-coded by system admin in a file
} Windows: control-panel->network->configuration->tcp/ip-
} UNIX: /etc/rc.config
} DHCP: Dynamic Host Configuration Protocol: dynamically get
} “plug-and-play”
Network Layer 4-28
Can renew its lease on address in use Allows reuse of addresses (only hold address while connected an “on”) Support for mobile users who want to join network (more shortly)
} host broadcasts “DHCP discover” msg
} Src=0.0.0.0 Dst=255.255.255.255
} DHCP server responds with “DHCP offer” msg
} Src=DHCP Server’s IP Dst=255.255.255.255
} host requests IP address: “DHCP request” msg
} Src=0.0.0.0 Dst=255.255.255.255
} DHCP server sends address: “DHCP ack” msg
}
Src=DHCP Server’s IP Dst: 255.255.255.255
Network Layer 4-29
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.2 223.1.3.1 223.1.3.27
Network Layer 4-30
DHCP server: 223.1.2.5 arriving client
time
DHCP discover src : 0.0.0.0, 68 dest.: 255.255.255.255,67 yiaddr: 0.0.0.0 transaction ID: 654 DHCP offer src: 223.1.2.5, 67 dest: 255.255.255.255, 68 yiaddrr: 223.1.2.4 transaction ID: 654 Lifetime: 3600 secs DHCP request src: 0.0.0.0, 68 dest:: 255.255.255.255, 67 yiaddrr: 223.1.2.4 transaction ID: 655 Lifetime: 3600 secs DHCP ACK src: 223.1.2.5, 67 dest: 255.255.255.255, 68 yiaddrr: 223.1.2.4 transaction ID: 655 Lifetime: 3600 secs
Network Layer 4-31
} address of first-hop router for client } name and IP address of DNS sever } network mask (indicating network versus host portion of
Network Layer 4-32 } connecting laptop needs its IP
DHCP UDP IP Eth Phy
DHCP DHCP DHCP DHCP DHCP
DHCP UDP IP Eth Phy
DHCP DHCP DHCP DHCP DHCP
❒ DHCP request encapsulated
❒ Ethernet frame broadcast
❒ Ethernet demux’ed to IP
168.1.1.1
Network Layer 4-33 } DCP server formulates DHCP
DHCP UDP IP Eth Phy
DHCP DHCP DHCP DHCP
DHCP UDP IP Eth Phy
DHCP DHCP DHCP DHCP DHCP
❒ encapsulation of DHCP
❒ client now knows its IP
Network Layer 4-34
Message type: Boot Reply (2) Hardware type: Ethernet Hardware address length: 6 Hops: 0 Transaction ID: 0x6b3a11b7 Seconds elapsed: 0 Bootp flags: 0x0000 (Unicast) Client IP address: 192.168.1.101 (192.168.1.101) Your (client) IP address: 0.0.0.0 (0.0.0.0) Next server IP address: 192.168.1.1 (192.168.1.1) Relay agent IP address: 0.0.0.0 (0.0.0.0) Client MAC address: Wistron_23:68:8a (00:16:d3:23:68:8a) Server host name not given Boot file name not given Magic cookie: (OK) Option: (t=53,l=1) DHCP Message Type = DHCP ACK Option: (t=54,l=4) Server Identifier = 192.168.1.1 Option: (t=1,l=4) Subnet Mask = 255.255.255.0 Option: (t=3,l=4) Router = 192.168.1.1 Option: (6) Domain Name Server Length: 12; Value: 445747E2445749F244574092; IP Address: 68.87.71.226; IP Address: 68.87.73.242; IP Address: 68.87.64.146 Option: (t=15,l=20) Domain Name = "hsd1.ma.comcast.net."
Message type: Boot Request (1) Hardware type: Ethernet Hardware address length: 6 Hops: 0 Transaction ID: 0x6b3a11b7 Seconds elapsed: 0 Bootp flags: 0x0000 (Unicast) Client IP address: 0.0.0.0 (0.0.0.0) Your (client) IP address: 0.0.0.0 (0.0.0.0) Next server IP address: 0.0.0.0 (0.0.0.0) Relay agent IP address: 0.0.0.0 (0.0.0.0) Client MAC address: Wistron_23:68:8a (00:16:d3:23:68:8a) Server host name not given Boot file name not given Magic cookie: (OK) Option: (t=53,l=1) DHCP Message Type = DHCP Request Option: (61) Client identifier Length: 7; Value: 010016D323688A; Hardware type: Ethernet Client MAC address: Wistron_23:68:8a (00:16:d3:23:68:8a) Option: (t=50,l=4) Requested IP Address = 192.168.1.101 Option: (t=12,l=5) Host Name = "nomad" Option: (55) Parameter Request List Length: 11; Value: 010F03062C2E2F1F21F92B 1 = Subnet Mask; 15 = Domain Name 3 = Router; 6 = Domain Name Server 44 = NetBIOS over TCP/IP Name Server ……
Network Layer 4-35
[nike]$ ifconfig em1 Link encap:Ethernet HWaddr 84:2B:2B:42:A5:7E inet addr:128.192.101.135 Bcast:128.192.101.191 Mask:255.255.255.192 inet6 addr: fe80::862b:2bff:fe42:a57e/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 lo Link encap:Local Loopback inet addr:127.0.0.1 Mask:255.0.0.0 inet6 addr: ::1/128 Scope:Host UP LOOPBACK RUNNING MTU:16436 Metric:1 virbr0 Link encap:Ethernet HWaddr 52:54:00:BC:51:80 inet addr:192.168.122.1 Bcast:192.168.122.255 Mask:255.255.255.0 UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 [nike]$ route -n Kernel IP routing table Destination Gateway Genmask Flags Metric Ref Use Iface 128.192.101.128 0.0.0.0 255.255.255.192 U 0 0 0 em1 192.168.122.0 0.0.0.0 255.255.255.0 U 0 0 0 virbr0 169.254.0.0 0.0.0.0 255.255.0.0 U 1002 0 0 em1 0.0.0.0 128.192.101.129 0.0.0.0 UG 0 0 0 em1 [nike]$ arp -n Address HWtype HWaddress Flags Mask Iface 128.192.101.186 ether c8:60:00:9b:5d:a3 C em1 128.192.101.174 ether 00:26:b9:8e:10:56 C em1 128.192.101.129 ether 00:12:f2:ef:8b:00 C em1 [nike]$ cat /etc/resolv.conf nameserver 128.192.1.9 nameserver 8.8.8.8
Network Layer 4-36
128.192.101.135 84:2B:2B:42:A5:7E 128.192.101.129 00:12:f2:ef:8b:00
8.8.8.8 Src IP: 128.192.101.135 Dst IP: 8.8.8.8 Src Port: 54321 Dst Port: 53 Src Eth: 84:2B:2B:42:A5:7E Dst Eth: 00:12:f2:ef:8b:00 www.microsoft.com ?
Network Layer 4-37
Network Layer 4-38 “Send me anything with addresses beginning 200.23.16.0/20”
200.23.16.0/23 200.23.18.0/23 200.23.30.0/23
Fly-By-Night-ISP Organization 0 Organization 7 Internet Organization 1 ISPs-R-Us “Send me anything with addresses beginning 199.31.0.0/16”
200.23.20.0/23
Organization 2
Network Layer 4-39
“Send me anything with addresses beginning 200.23.16.0/20”
200.23.16.0/23 200.23.18.0/23 200.23.30.0/23
Fly-By-Night-ISP Organization 0 Organization 7 Internet Organization 1 ISPs-R-Us “Send me anything with addresses beginning 199.31.0.0/16
200.23.20.0/23
Organization 2
Network Layer 4-40
} allocates addresses } manages DNS } assigns domain names, resolves disputes
Network Layer 4-41
10.0.0.1 10.0.0.2 10.0.0.3 10.0.0.4 138.76.29.7
Network Layer 4-42
} range of addresses not needed from ISP: just one IP address for
} can change addresses of devices in local network without
} can change ISP without changing addresses of devices in local
} devices inside local net not explicitly addressable, visible by
Network Layer 4-43
} outgoing datagrams: replace (source IP address, port #) of every
} remember (in NAT translation table) every (source IP address, port
} incoming datagrams: replace (NAT IP address, new port #) in dest
Network Layer 4-44
10.0.0.1 10.0.0.2 10.0.0.3
S: 10.0.0.1, 3345 D: 128.119.40.186, 80
10.0.0.4 138.76.29.7
S: 128.119.40.186, 80 D: 10.0.0.1, 3345
S: 138.76.29.7, 5001 D: 128.119.40.186, 80
S: 128.119.40.186, 80 D: 138.76.29.7, 5001
Network Layer 4-45
} (65,536 – 1024) simultaneous connections with a single LAN-
} 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
} address shortage should instead be solved by IPv6
} server address 10.0.0.1 local to LAN
} only one externally visible NATted
} e.g., (123.76.29.7, port 2500) always
Network Layer 4-46
10.0.0.1 10.0.0.4
138.76.29.7
v learn public IP address (138.76.29.7) v add/remove port mappings (with
Network Layer 4-47
10.0.0.1 10.0.0.4
138.76.29.7
} NATed client establishes connection to relay } External client connects to relay } relay bridges packets between two connections
Network Layer 4-48
138.76.29.7
10.0.0.1
Network Layer 4-49
} Datagram format } IPv4 addressing } ICMP } IPv6
} Link state } Distance
} Hierarchical routing
} RIP } OSPF } BGP
Network Layer 4-50 } used by hosts & routers to
} error reporting: unreachable host,
} echo request/reply (used by ping) } network-layer “above” IP: } ICMP msgs carried in IP datagrams } ICMP message: type, code plus first 8
Network Layer 4-51
} Source sends series of UDP
} First has TTL =1 } Second has TTL=2, etc. } Unlikely port number
} When nth datagram arrives to nth
} Router discards datagram } And sends to source an ICMP
} Message includes name of router&
} When ICMP message arrives,
} Traceroute does this 3 times
} UDP segment eventually arrives at
} Destination returns ICMP “host
} When source gets this ICMP
Network Layer 4-52
} Datagram format } IPv4 addressing } ICMP } IPv6
} Link state } Distance
} Hierarchical routing
} RIP } OSPF } BGP
Network Layer 4-53 } Initial motivation: } IPv4 offers only 32-bit addresses } space soon to be completely allocated } See IANA IPv4 Address Space Registry } IPv6 => 128-bit addresses } ~3.4E+38, i.e., ~6.7E+23 addresses per m2 } Additional motivation: } header format helps speed processing/forwarding } header changes to facilitate QoS
} fixed-length 40 byte header } no fragmentation allowed (MTU discovery is used, instead) } Fragmentation can happen only at the source, not at the routers
} 2001:DB8:0000:0000:0202:B3FF:FE1E:8329
} 2001:DB8:0:0:0202:B3FF:FE1E:8329 } 2001:DB8::0202:B3FF:FE1E:8329
} Similar to CIDR notation for IPv4 } 2E78:DA53:1200::/40
Network Layer 4-54
Network Layer 4-55
Network Layer 4-56
Network Layer 4-57
} additional message types, e.g. “Packet Too Big” } multicast group management functions
Network Layer 4-58
} no “flag days” } How will the network operate with mixed IPv4 and IPv6
} How does it work? (assuming core supports IPv6)
Network Layer 4-59
IPv6 IPv6 IPv6 IPv6 tunnel
IPv6 IPv6 IPv6 IPv6 IPv4 IPv4
Network Layer 4-60
IPv6 IPv6 IPv6 IPv6 tunnel
IPv6 IPv6 IPv6 IPv6
IPv4 IPv4
Flow: X Src: A Dest: F data Flow: X Src: A Dest: F data Flow: X Src: A Dest: F data
Flow: X Src: A Dest: F data
A-to-B: IPv6 E-to-F: IPv6 B-to-C: IPv6 inside IPv4 B-to-C: IPv6 inside IPv4
} Cryptographic agreement (key exchange) } Encryption of payload } Data integrity } Origin authentication (no spoofing!)
Network Layer 4-61