IP Internet Protocol
The Internet network layer
- host, router network layer functions : physical layer -> link layer -> network layer ( routing protocols, IP protocol, ICMP protocol ) -> transport layer (TCP, UDP)
IP datagram format
- IP header : 5 x 32bits ( 5 x 4bytes = 20Bytes + options )
- IP payload : data
Header component
--
-- ver : IP protocol version number [ 4 bits ]
-- head.len : Header length [ 4 bits ]
-- type of service : "type" of datagram
-- length : total datagram length (bytes) [ 16bits ]
--
-- 16-bit identifier
-- flgs
-- fragment offset
--
-- TTL : max number remaining hops ( decremented at each router)
-- Protocol : upper layer protocol to deliver payload to
How much overhead?
- 20 bytes of TCP (header)
- 20 bytes of IP (header)
- = 40 bytes + app layer overhead
A Few notes
- TTL has many purposes, but the most important one is to ensure that datagrams do not circulate forever
- Protocol is what connects network layer to transport layer
- ICMP = 1, TCP = 6, UDP = 17, IPv4 = 4, IPv6 = 41, etc
- Length is 16 bits, includes header + payload
- but IP packets are rarely over 1500 Bytes, why? : L2 Ethernet MTU (Maximun Transport Unit size) : 1500 Bytes, WiFi :2300 Bytes
- Fragmentation (IPv4)
- IPv6 does not allow fragmentation, why? later...
- Internet checksum is for error checking in IP header
- must be re-computed at every router, why? -> TTL change
- IPv6 does not have checksum, why? later..
- Options
- IPv6 does not include options. why? later...
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 serveral datagrams
- "reassembled" only at final destination
- IP header bits used to identifiy, order related fragments
- Examples ) 4000 byte datagram , MTU = 150bytes
-> 4000 large datagram becones serveral smaller datagrams 1500, 1500, 1040 ( header 40 ) fragments
-> fragflag -> last : 0 other : 1, offset -> first : 0, other : datalength / 8
- IPv6 does not allow fragmentation, why? : for speed, for Gbps + don't allow large datagram
IPv4 addressing : introduction
- IP address : 32 bit identifier for host router Interface.
- Must be globally unique ( public IP address )
- Usually written in dotted-decimal form : <8bit>.<8bit>.<8bit>.<8bit>
- Interface : connectio between host/router and physical link
- router's typically have multiple interfaces
- host typically has one or two interfaces ( wired Ethernet, wireless 802.11 )
- IP address associated with each interface!
- Q : How are interfaces actually connected ?
A : Wired Ethernet interfaces connected by Ethernet switches ( aka. hub ),
Wireless WiFi interfaces connected by WiFi AP
Subnets
- IP address
- subnet part - high order bits
- host part - low order bits
- What's a subnet?
- device interfaces with same subnet part of IP address
- can physically reach each other without intervening router
- to determine the subnets : detach each interface from its host or router, creating islands of isolated networks
+ each isolated network is called a subnet
- For "x.x.x.x/Y", /Y is the number of bits used for subnet address
IP addressing : CIDR
- CIDR : Classless InterDomain Routing
- subnet portion of address of arbitrary length
- address format : a.b.c.d/x, where x is # bits in subnet portion of address
- Classful addressing?
- There used to be classes.... : Subnet portion of address fixed.
IP addresses : How to get one?
- Q : How does a host get IP address?
- hard-coded by system admin in a file
- dynamically get address from as server -> DHCP
DHCP : Dynamic Host Configuration Protocol
- Goal : allow host to dynamically obtain its IP address from network server when it joins network( "plug-and-play")
-> can renew its lease on address in use
-> allows reuse of addresses (only hold address while connected/on)
-> support for mobile users who want to join network ( more later )
DHCP overview
-> host broadcasts "DHCP discover" msg [optional]
-> DHCP server responds with "DHCP offer" msg [optional]
-> Host requests IP address : "DHCP request" msg
-> DHCP server sends address : "DHCP ack" msg
DHCP : more than IP addresses
- DHCP can return more than just allocated IP address on subnet
-> address of first-hop router (aka gateway) for client
-> name and IP address of DNS server
-> network mask (indicating netwokr versus host portion of address )
Example
-> Connecting laptop needs its IP address, addr of first-hop router, addr of DNS server -> use DHCP
-> DHCP request encapsulated in UDP, encapsulated in IP encapsulated in 802.1 Ethernet
-> Ethernet frame broadcast (dest : FFFFFFFFFFFF) on LAN, received at router running DHCP server
-> Ethernet demuxed to IP demuxed, UDP demuxed to DHCP
-> DHCP server formulates DHCP ACK containing client's IP address, IP address of first-hop router for client, mane & IP address of DNS server
-> encapsulation of DHCP server, frame forwarded to client, demuxing up to DHCP at client
-> client now knows its IP address, name and IP address of DNS server, IP address of its first-hop router
IP addresses : How to get one? continue
- Q : how does network get subnet part of IP addr?
- A : gets allocated portion of its proviedr ISP's address space
-> ISP's block ( subnet ) and allocated block to organization
- Q : how does an ISP get block of addresses?
- A : ICANN : Internet Corporation for Assigned Names and Numbers
Hierarchical addressing : route aggregation
- Hierarchical addressing allows efficient advertisement of routing information : Out of ISP know just one IP address of Hierarchical addressing ( forwarding table longest prefix match )
NAT : network address translation
Translate one public IP address to private IP address (home network)
- All datagrams leaving local netwokr have some single source : NAT IP address : 138.76.29.7, different source port numbers
- datagrams with source or destination in this network have 10.0.0/24 address for source, destination (as usual)
Motivation
- loca lnetwork uses just one IP address as far as outside world is concerned
-> range of addresses not needed from ISP : just one IP address for all devices
-> can change address of devices in local network without notifying outisde world
-> can change ISP without changing addresses of devices in local network
-> devices inside local net not explicityly addressable/visible by outside work(security, side effect)
Implementation : NAT router must
- outgoing datagrams (in to out)
-> replace (src IP addr, port #) of every outgoing datagram to (NAT IP addr, new port #)
-> remote machine will respond using (NAT IP addr, new port #) as destination addr
- remember (in NAT translation table)
-> every (src IP addr, port #) to (NAT IP addr, new port #) translation pair
- incomming datagrams
-> replace (NAT IP addr, new port #) in dest fields of every incoming datagram with corresponding (src IP addr, port #) stored in NAT table
- 16bit port-number field -> 60,000 simultaneous connections with a single LAN-side address!
- NAT is controversial
-> routers should only process up to layer 3....
-> address shortage should be solved by IPv6
-> violates end-to-end argument : NAT possibility must be taken into account by app designers...
-> NAT traversal : what if client wants to connect to server behind NAT?
IPv6
Motivation : Initial motivation : 32-bit address space 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 + no IP checksum
IPv6 datagram format
- Priority : identify priority among datagrams in flow
- flow label : identify datagrams in same "flow"
- next header : identify upper layer protocol for data
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 + multicast group management functions
Transition from IPv4 to IPv6
- not all routers can be upgraded simultaneously
-> no "flag days"
-> how will network operate with mixed IPv4 and IPv4 routers?
- Tunneling : IPv6 datagram carried as payload in IPv4 datagram among IPv4 routers ( IPv4 datagram 에 IPv6 datagram 을 넣음. IPv4 헤더에 IPv6 가 있다고 알려줌)
IPv6 : adoption
- Google : 8% of clients access services via IPv6
- NIST : 1/3 of all US government domains are IPv6 capable
- Long time for deployment, use : 20 years and counting + tink of application-level changes in last 20 years : WWW, Facebook, streaming media, Skype, ...
Generalized Forwarding and SDN
Each router contains a flow table that is computed an distributed by a logically centralized routing controller
'학교수업 > 네트워크 응용설계' 카테고리의 다른 글
[Applications And Design] 5. Network Layer (0) | 2022.05.25 |
---|---|
4-3 (0) | 2022.05.23 |