Networking Basics
The Internet is a worldwide wide-area network comprised of smaller WANs and LANs (local-area networks). Its origins began with ARPAnet and packet-switching experiments in the 1960s, and involved cross-network gateways joining CSnet, NSFnet, and other international networks. Over time, protocols like TCP/IP, SMTP, and HTTP standardized traffic across the web and allowed developers to bring high-level functionality to non-technical users.
Internet Backbone
The Internet backbone is an informal name for Tier 1 networks that have access to all other top-level networks on the web. This is usually because these networks have ownership of some amount of fiber-optic linkage between networks. For example, AT&T, Deutsche Telekom, and Verizon are Tier 1 networks.
Network Types
Point-to-point Networks
- PPP: Uses a smaller frame with the flag sequence, address and control bytes (which always have the same values
0xff 0x03
), followed by the protocol, payload and frame check sequence.
Multipoint/Broadcast Networks
- Ethernet: Aside from a preamble and start of frame delimiter, Ethernet data frames also include a destination and source MAC address, an ether type, the payload itself, and a frame check sequence, which is used to determine that no corruption took place in transit. The internet is a collection of ethernet networks connected via PPP connections.
TCP/IP
The TCP/IP protocol model consists of four layers (compare this with the seven OSI model layers): link, network, transport, and application.
- Link: Cabling, hardware and device drivers
- Network: Routing across nodes in the network
- Transport: Application-agnostic, sending and receiving of packets between hosts
- Application: Host applications, whatever is needed by the data
Framing
Because a sequence of bits has no clear beginning or end, data transmissions are often delimited into sets called frames. In certain implementations like HDLC (High-Level Data Link Control), these frames are separated by a flag sequence like 01111100
. Because of this, any sequence of five consecutive 1s is bit packed with a 0 that is ignored by the client. Ethernet uses a different strategy that uses a period of inactivity called a preamble for 56 bits of alternating 1s and 0s, and then a start of frame delimiter (10101011
). Typical frames are between 64 and 1500 bytes.
OSI Model Layers
- Physical: The medium (wire, fiber, radio, etc…) for transmitting communications as raw bits
- Data Link: Facilitates the transfer between two physical addresses (usually MAC addresses) on the same network. Layer 2 commonly refers to Ethernet, but also includes other protocols like ARP and VLAN/VTP.
- Network: Determines the physical and logical (IP, ICMP), IP header, communication between identified end devices
- Transport: (TCP/UDP), segment, transfer and reassembly of messages (for reliability)
- Session: Determines connection sessions for communications
- Presentation: Usually for defining the format
- Application: (HTTP, HTTPS, DNS)
TCP
Small packets with sequence numbers and error detection.
Three-way Handshake
- SYN
- SYN/ACK
- ACK
- FIN ends the connection
Terminology
- Baud Rate: Symbols per second. A symbol is a high/low voltage value.
- Bit Rate: Bits per second. Multiple bits can be packed into a baud with novel encoding techniques.
Resources
protocol data units
- layer 4 segments
- router is layer 3
- packets
- switch is layer 2
- frame
- layer 1 bits
http tcp/80 https tcp/443 dns (tcp OR udp) 53 ntp network time protocol udp/123 dhcp dynamic host configuration protocol udp/67
DHCP
- A device on the network broadcasts a Discover message to all devices on the subnet.
- The DHCP server responds with an Offer message. The requesting device may receive multiple offers, but will accept the first message it receives and take the IP of the DHCP server from it.
- The requesting device sends a Request message to the DHCP server using its newfound IP.
- The DHCP server returns an Acknowledgement message to provide the device with an IP, subnet mask, default gateway, and possibly other information.
If a DHCP server is on a separate subnet, any routers between it and the requesting device must be configured to be a relay agent.
IPv6 DHCP servers respond with the prefix and host portions of the IP, and possibly the IP address of the DNS server on the network. Alternatively, a host can receive network prefix information from the router using the Network Discovery Protocol (or NDP), and generate its own host IP portion from its MAC address using a process called EUI-64. In this case, the DHCP server would only be used for additional network information such as the DNS server address.
Network Address Translation
NAT
Routers maintain a NAT table that map local IP addresses to global IPs.
Dynamic NAT is many-to-many.
Port Address Translation (PAT), one global to many local IPs.
Network Time Protocol
UDP port 123 stratum number is the believability of a time source stratum numbers cannot be higher than 15
QoS
Quality of Service
“managed unfairness”
- classification and marking
- queueing (buffering) and queue separation for different classifications
Ethernet
Carrier Since Multiple Access Collision Detection (CSMA/CD). On occasion data collides when multiple nodes attempt to send at the same time. If this happens, each node waits (I believe a random amount of time) before resending.