The internet network layer consists of:
- Path selection algorithms
- Traditionally implemented in routing protocols (OPSF, BGP)
- Can also be implemented in SDN controller
- Responsible for forwarding table, which dictates what routers should do given an IP packet
- IP protocol
- Dictates format of datagram
- Controls how hosts/routers/etc. are addressed, how to handle packets
- ICMP protocol
- Control protocol
- Responsible for how errors are reported, how routers can signals themselves

Datagram Format (IPv4)
- Typically has TCP/UDP segment, could find an ICMP message
- Start - 4-bit version nnumber
- Header length is necessary - size of IPv4 header is not static, changes depending on optional headers
- Length field is 16-bit field that gives total size of data
- In practice, packets are 1500 bytes or less
- Max size of IPv4 is dictated by MTU data link technology
- Service type marks packet according to level of service required by IP packet
- In practice, only 6 of 8 bits are used to differentiate between IP packets (diffserv protocol)
- Remaining 2 bits are used for ECN mechanism (marking packet for congestion)
- TTL is time to live, designates remaining max hops
- Upper-layer ID identifies protocol in payload of IP datagram
- TCP - value 6
- UDP - value 17
- ICMP - value 1
- 16-bit identifier for IP packet
- 1-bit flags for fragmentation/reassembly
- Header checksum
- Applied for header of datagram
- Tested by routers to check for failure (dropped if checksum fails)
- Errors in payload of datagram will not be detected by IP layer (IP layer only tests for errors in IP datagram header)
- 32-bit source/destination IP address
- Optional fields include timestamp, series of routers taken, etc.
- Minimum size of IP datagram:
- 20 Bytes for TCP
- 20 Bytes for IP
- Total: 40 bytes + app layer overhead for TCP + IP