# Chapter 1: Computer Networks and the internet

• 1.1 What is the Internet
• 1.1.1 A Nuts-and-Bolts Description
• 1.1.2 A Services Description
• 1.1.3 What is a protocol?
• 1.2 The Network Edge
• 1.2.1 Access Networks
• 1.2.2 Physical Media
• 1.3 The Network core
• 1.3.1 Packet Switching
• 1.3.2 Circuit Switching
• 1.3.3 A Network of Networks
• 1.4 Delay, Loss, and Throughput in Packet-Switched Networks
• 1.4.1 Overview of Delay in Packet-Switched Networks
• 1.4.2 Queuing Delay and Packet Loss
• 1.4.3 End-to-End Delay
• 1.4.4 Throughput in Computer Networks
• 1.5 Protocol Layers and Their Service Models
• 1.5.1 Layered Architecture
• 1.5.2 Encapsulation
• 1.6 Networks Under Attack

1.1 What is the Internet

• 1.1.1 A Nuts-and-Bolts Description
• Devices that are connected are known as hosts or end systems
• End systems are connected together with communication links or network switches
• Packets are information appended with headers
• ISPs are made of multiple packet-switched networks which act as information highways
• Lower level ISPs such as NTT, Sprint, ATT are connected on an international level with fiber optic cables
• End systems run TCP/IP which control sending and receiving packets from the internet
• TCP: Transmission Control Protocol
• IP: Internet Protocol
• 1.1.2 A Services Description
• The internet is an infrastructure for services such as VoIP and web surfing
• Distributed Applications: Applications that have multiple end systems exchanging data
• 1.1.3 What is a Protocol?
• A protocol defines the format and the order of messages exchanged between two or more communicating entities, as well as the actions taken on the transmission and/or receipt of a message or other event

1.2 The Network Edge

• End System=Host because they also run (host) application programs
• Hosts are sometimes divided into 2 subcategories clients and servers
• 1.2.1 Access Networks
• Edge routers are the first router that the end system encounters, for example your home router
• DSLAM: Digital subscriber line access modem located at the CO
• CO: Central Office
• Designed for short distance from the CO
• Cable/Fiber
• CMTS: Cable modem termination system similar to DSLAM
• Fiber to the Home (FTTH)
• ONT: Optical network terminator
• OLT: Optical line terminator
• Both are used to go from light pulses to electrical signals
• All network terminators receive all data and its up to the terminator to disassemble that and find the packets one is looking for
• LAN (Local Area Network): Ethernet and Wi-Fi
• Wide Area Access: 3G and LTE
• Types of Cables and their capabilities
• Refer to the book for more information on this I don’t think this is important right now will update this section if needed later on

1.3 The Network Core

• Network Core: Mesh of packet switches and links that interconnect the Internet’s end systems
• 1.3.1 Packet Switching
• A message/data is split into multiple packets
• A packet then travels between packet switches and communication links such as routers and link-layer switches
• Packets are transferred at the max speed a cable will allow
• L bits per packet R bits/sec total time required is L/R seconds
• Store-and-Forward Transmission
• Receive entire packet before transmitting first bit
• For example if we want to transmit 3 packets
• Let T=L/R
• T to transmit from source to router
• T to transmit first packet from router to destination and to receive second packet at the router
• T to transmit second packet from router to destination and to receive third packet at router
• T to transmit third packet for a total of 4T
• Every packet has multiple links and each link has an output buffer (queue)
• This is used if the input traffic is faster than the output capabilities and all packets wait to be transmitted from here
• If the buffer becomes completely full packet loss will occur if data continues to stream in
• This then introduces queuing delays
• Forwarding Tables and Routing Protocols
• How to determine where to route data to? Use IP addresses
• IP addresses contain sections each representing a level of hierarchy
• forwarding table will match sections of the IP address to a certain destination
• The generation of forwarding is discussed in Chapter 4 however there are routing protocols that are used to automatically generate these tables
• 1.3.2 Circuit Switching
• This is the alternative to packet switching
• If a connection is established that link is completely reserved for that one source and destination versus packet switching where the link is allocated on demand
• Circuit switching creates end-to-end connections between two hosts
• In the picture above if the switch has 1 Mbps capability then each link will be given 250 kbps of bandwidth
• Multiplexing in Circuit-Switched Networks
• A circuit is implemented with FDM or TDM (frequency division multiplexing or time division multiplexing)
• FDM: Divide the frequency spectrum into slices for each link
• TDM: Divide the a frame (time slice) into the number of links (similar to round robin scheduling)
• Packet Switching vs Circuit Switching
• Circuit switching will waste bandwidth if there are dead times during transmission
• Circuit switching will severely limit number of active users
• Packet switching will cause more delays for each individual user
• Packet switching will also drop packets when there are too many users
• However if there is enough downtime, packet switching will be more useful in increasing the number of concurrent users that are actually able to do crap
• 1.3.3 A Network of Networks
• Now we discuss the way ISPs and users are connected
• Access ISP: This is the one a home user pays to get access to the internet
• Regional ISP: Access ISPs pay regional ISPs to get access to the internet
• Tier 1 ISP: Regional ISPs pay Tier 1 ISPs to get access to the internet
• IXP: Internet Exchange Point, these are points which allow ISPs to peer together
• Content Provider: Such as Google, they have a large amount of data centers and servers which are sometimes able to directly make contact with Non tier-1 ISPs allowing them to also circumvent fees when giving access to internet
• Peer: Connect networks together so that all traffic between two sources can share a direct connection
• This is often used to circumvent paying lower level ISPs which bill them based on usage

1.4 Delay, Loss, and Throughput in Packet-Switched Networks

• 1.4.1 Overview of Delay in Packet-Switched Networks
• A packet suffers multiple types of delays
• Nodal processing, queuing, transmission, propagation delay
• These sum to give a total nodal delay
• Types of Delay
• Processing Delay
• Time required to examine the packet’s header and determine where to direct the packet is part of the processing delay
• May also include checking for bit-level errors
• Usually on the order of microseconds or less
• Queuing Delay
• Time a packet waits to be transmitted onto the link
• Depends on size of the queue, the speed of the link, and the intensity and nature of the traffic at arriving
• On the order of microseconds to milliseconds
• Transmission Delay (Packet pre pushed to link)
• L: Length of packet in bits
• R: Transmission rate in bits/sec
• L/R: Transmission delay in seconds from router A to B
• On the order of microseconds to milliseconds
• Propagation Delay (Packet after pushed to link)
• Time to propagate data from router A to B
• Depends on the media (copper wire, optics, etc)
• s: Propagation speed of link
• d: Distance to travel
• d/s: Propagation delay
• After all bits arrive at router B then B performs forwarding
• Comparing Transmission and Propagation Delay
• Transmission: Time required for the router to push out the packet
• Propagation: Time it takes a bit to propagate from one router to the next
• Total Nodal Delay
• $d_{nodal}=d_{proc}+d_{queue}+d_{trans}+d_{prop}$
• 1.4.2 Queuing Delay and Packet Loss
• $d_{queue}$ is very complicated
• Can vary from packet to packet thus often all estimates are calculated statistically
• a: Average rate at which packets arrive (packets/sec)
• L: Length of packet (assume uniform)
• La/R: Traffic intensity
• If La/R>1 then queue will grow and exceed the size
• Design a system such that $La/R \leq 1$
• Typically, the arrival process to a queue is random and not at preordained time slices
• La/R is not sufficient to categorize traffic intensity
• Packet Loss
• In reality queues have finite capacity
• Once a queue reaches full capacity the next packet that arrives before a spot is opened is dropped
• Performance of a node thus also needs to take into consideration the probability of packet loss
• Often packet loss may be re-transmitted
• 1.4.3 End-to-End Delay
• Defined as delay from source to destination
• Assume N-1 routers and no congestion allowing us to neglect queuing delay
• $d_{end-to-end}=N(d_{proc}+d_{trans}+d_{prop})$
• $d_{trans}=L/R$
• Traceroute
• This is used to trace the number of nodes one hits when resolving an address
• The source sends N special packets (labeled 1 to N) to N-1 routers
• When the nth router receives a packet it does not forward it but sends a message back to the source allowing us to build a roardmap
• Traceroute runs 3 times (sends 3N packets)
• Column 1: nth packet value
• Column 2: name of router
• Column 3: address of router
• Columns 4-6: time taken to reach the nth router
• It is important to note that these times are not constant due to the queuing on the routers which may increase or decrease as the traffic evolves
• Not all routers have names
• End System, Application, and Other Delays
• If an end system wants to transmit into a shared medium (eg. Wi-Fi uses)
• Then it may purposefully delay until all packets are received before continuing
• Packetization delay: The process of converting data into a format which can be stored in packets
• In voice over IP this is turning an analog voice signal into a digital one
• 1.4.4. Throughput in Computer Networks
• Instantaneous Throughput: At any point in time how many bits/sec a destination is receiving data
• Average Throughput: F/T where F=total bits and T=total time
• Let the following which are both measured in bits per second
• $R_{s}$: Rate of link between server and router
• $R_{c}$: Rate of link between router and client
• The bottleneck becomes $min(R_{s}, R_{c})$
• With multiple routers in between the above becomes a minimum of all the rates
• On the left we have a direct link between server and client
• The right we have a pipe (imagine its an ISP) connected to 10 servers and 10 clients
• Often the R capacity of the ISP is much higher than any of the individual connections so that is usually not the bottleneck
• However if it is exceeded the solution will be to ration the total R between the 10 client-server connections either based on priority or evenly
• 1.5 Protocol Layers and Their Service Models
• 1.5.1 Layered Architecture
• A human analog is the airline functionality
• Each component is modular and each higher level component depends on each lower level component where everything is defined by an API (aka just cause the gates change doesn’t mean you can’t load luggage anymore)
• Therefore each layer
• 1. Performs its designated actions
• 2. Uses information provided from a lower level to do so
• Layered architecture provides modularity
• Protocol Layering
• Stack refers to the culmination of all the layers of the protocols
• The same ideas apply
• 1. Performs its designated actions
• 2. Uses information provided from a lower level to do so
• And allows for modularity
• Each layer n often contains components from the layer below
• Protocols can be designed in both hardware and software
• Here for example if layer n provides a reliable delivery message in reality layer n only provides something like error correction while n-1 is the actual main brains of the delivery system
• Application Layer
• Includes HTTP (web) and SMTP (mail) and DNS (domain name system URL->32 bit address)
• Two end systems using an application will use this layer to exchange packets
• Refer to application layer packets as messages
• Transport Layer
• Transports application-layer messages between application endpoints
• TCP: Transmission Control Protocol
• This focuses on guaranteed delivery of application-layer messages and flow control (matching source destination speeds)
• Congestion control to throttle source speed if too much traffic
• UDP: User Datagram Protocol
• Connectionless service to its applications
• No reliability and flow control and no congestion control
• Refer to transport layer packets as segments
• Network Layer
• Moving network-layer packets from one host to another
• TCP/UDP passes a transport-layer segment and a destination address to the network layer
• IP Protocol: Defines the datagram fields and how end systems and routers act on these fields all internet components at network layer must run the IP protocol
• Network-layer packets are known as datagrams
• While network layer sets the destination (routing) the link layer actually facilitates the transfer of datagrams from node to node (host/router)
• There are multiple link layer protocols such as Ethernet/Wi-Fi
• Different link layer protocols handle the datagram deifferently
• Link-layer packets are known as frames
• Physical Layer
• This depends on the physical media used such as cable type (copper/fiber)
• OSI Model
• OSI Model differs by adding 2 new layers (presentation layer, session layer)
• The other 5 layers act in similar manner
• Presentation Layer: Services to allow applications (top level) to properly interpret the data such as de/encrypting messages or de/compression of data
• Session Layer: Allows for delimiting and synchronization of data exchange allowing for checkpoints or data recovery
• 1.5.2 Encapsulation
• Router vs Link Layer Switch
• These are both packet switches but routers operate at level 3 and link-layer switches at level 2
• Hosts (end points) implement all 5 levels
• Note here that each layer adds its own header or some form of change to the M (message)
• For instance the application level message M+H_transport=transport-layer segment encapsulating the application-level message
• In general, each level after processing will contain a payload field and a header field
• 1.6 Networks Under Attack
• Virus: Malware which requires interaction from user to infect user’s device
• Worm: Malware which does not require interaction from user to infect devices
• DoS: Denial of Service
• Vulnerability Attack: Sending specific packets to the destination to stop the service or hinder it
• Bandwidth Flooding: Sending so many packets that the access link becomes so clogged it can’t actually receive legitimate packets
• Connection Flooding: Establish a large amount of half open/fully open TCP connections to block all legitimate connections
• DDoS: Same as a DoS but uses multiple sources (botnet)
• Packet sniffing: To sniff the packets from a source to destination passively as a passive receiver
• IP Spoofing: Create a packet with arbitrary source address, packet content, and destination address and then inject the packets onto the internet
• Can be solved with end point authentication