Show Menu

Networking Final Cheat Sheet (DRAFT) by

Computer Networking

This is a draft cheat sheet. It is a work in progress and is not finished yet.

4.4 Subnets

Commun­ication internal, able without router.
Amount of IP bits must match, indicated by /x on address, x is amount of bits for matching in subnet, rest used for host.
Sometimes can be repres­ented using an IP address, in binary all bits that are 1 are the amount for subnet.

4.4 NAT

In routers, has public and private addresses, wraps private address in public NAT.
Private addresses either 10.0.0 or 192.168.1.
NAT makes forwarding table, associates internal IP and port with NAT IP and new chosen NAT port.
Each socket will have its own entry.

4.4 Adressing

Addressing is dotted decimal, a.b.c.d, each decimal separating a byte.
Roughly 2^32 addresses with IPv4.

DHCP, Interf­aces, ICMP

DHCP is client­/server setup, assigns IP from pool, releases once host is done.
Interf­aces: a connection with a host/r­outer and link, associated with IP addresses.
ICMP, protocol, error commun­ica­tion, above IP

Forwarding Table

Tells you what link to send to based on destin­ation IP.
Splits the destin­ation IPs into ranges in the forwarding table.
Choose range with longest match.
To make, split destin­ation IP ranges by looking at where bits deviate.

4.5 Types of Routing Algorithms

All routers have the knowledge of the network system. Link state algori­thms. Dijkstra's algorithm.
Routers only know inform­ation about neighbors. Learns network through neighbors. Distance vector algori­thms.
Changes slowly over time.
Changes more quickly.


What does network layer do? Transports segments, wraps segments in datagram, in every host, uses IP.
How do routers work? Use routing algorithm to create forwarding table. Move datagrams from input to output, use switching fabric. Works on layer 3.
Key network functions: Routing: Determine the route to dest. Forwar­ding: Deciding the correct output port to send a packet on. Forwarding tables tell router where to send datagram.

Hierar­chical Routing

Divide network into small groups. A router is chosen as gateway to outside networks. All routers in group run same routing algorithm.

4.4 classful IP and CIDR

Class A:
8 bits network, 24 bits host.
Class B:
16 bit network, 16 bits host.
Class C
24 bit network, 8 bits host.
Classless (CIDR):
allows any choice of # bits for network.

4.4 Fragme­ntation

Break data to fit on link.
Formula for fragme­nting datagram: ceiling (datagram – IP header / MTU – IP header)
Formula for fragme­nting raw data: ceiling (bytes / MTU – IP header – transport layer header)

4.4 IPv6

Removed fragme­nta­tion. Increased address size to 128 bits. 40 byte fixed header.
Version: IP version.
Traffic class: type of traffic.
Payload length: how much data.
Next header: upper layer protocol to deliver to.
Hop limit: how many hops allowed.
Source and dest. addresses: 128 bits.
Data: what data is transp­orted.

4.4 IPv4

Protocol version:
what version running.
Header length:
length of header, fixed 20 bytes + optional field.
Type of the data:
Different types of datagrams exist.
Datagram length:
data + header
identify fragments of IP datagram, data from same datagram has same number
indicate beginning of fragme­ntation or if allowed, uses 3 bits. First bit always 0. Second bit is 0 or 1, 0 means fragment, 1 means can’t. Last bit 0 or 1, 0 means no more fragments, 1 means more.
used to rebuild fragment.
Time to live:
How many hops before dropped, resets at router, drop at 0.
Upper layer:
upper layer protocol to pass to.
Header checksum:
check for errors
Source and dest. IP:
32 bits.
data carried.
allows increase in header.

5.1 Link layer

What is it?
Getting messages from one link to next, one hop commun­ica­tion.
How does info change?
From link to link.
What are transm­ission units?

5.1 Link layer services

Framing: putting datagrams into frames.
Link Access: rules for multiple users accessing link.
Reliable delivery: uses re-tra­nsm­issions and ACKs. For direct connection links. Only used on error prone links.

5.3 Types of links

Point to ponit
Broadcast: many users share link.

5.3 MAC protocols

MAC protocols allow link sharing.
Channel partit­ioning: No collis­ions, commun­icate on time intervals.
Random access: if collis­ions, randomly choose time to resend.

5.4 MAC addresses

MAC is fixed. IP can change.
MAC 48 bits, in hex
Host has both MAC and iP.

Ethernet Frames

Wakes up the receiver for transm­ission.
Source and Dest MAC
tell you sender and receiver, 48 bits, hex.
Must be between 46-1500 bytes, data sent.
Error correction
Tells you the upper layer protocol.

Ethernet topology

hosts connect to same link.
hosts connect to switch, switch moves traffic, reduces traffic to router, forwards within subnet, uses MAC address.

5.4 ARP

Maps MAC to IP
Above link layer, below network layer. ARP packets carried by link layer.
Creates tables to map IP and MAC. Entries last approx. 20 mins.

5.4 ARP sending in subnet

Check ARP table for mapping.
If mapping is there, send frame.
If mapping not there, ARP query.
Broadcast ARP query for who has an IP.
Host with IP responds directly to query host.
Table updated with MAC/IP mapping.

5.4 ARP sending outside subnet

Can't have destio­nat­ion's MAC.
Use MAC for next hop link (router) as destin­ation MAC.
Source IP and Dest IP stay same. Source MAC and Dest. MAC change.


Operates on layer 2, link layer device, transp­arent to host (no IP or MAC).
Self learns by recording interface and MAC of sent frames that cross it. Builds own forwarding table.
If no entry in forwarding table, broadcasts frame to all interf­aces. Those with the wrong MAC drop it.