Skip to content

Instantly share code, notes, and snippets.

@kf0jvt
Last active December 22, 2015 03:09
Show Gist options
  • Save kf0jvt/6408513 to your computer and use it in GitHub Desktop.
Save kf0jvt/6408513 to your computer and use it in GitHub Desktop.
Review of basic networking topics. #class
# OSI Model
1. Physical - electrical voltage on the wire
2. Data link - **ethernet** communication between two hosts on the same network
3. Network - **IP** - used for getting packets to the right network
4. Transport - **TCP/UDP** - quality control and error correction
5. Session - magic layer
6. Presentation - magic layer
7. Application - magic layer
## OSI Model Exercise
Draw a picture of a network with several IP subnets and talk through the process of getting traffic from one host on one network to another host on another network. Walk up and down the OSI model for each step in the process.
+ Host A checks the destination IP and determines that it is not on the local network. Send traffic to default gateway.
+ Host A checks the IP address of the default gateway and determines that it is on the local network.
+ Host A uses ethernet to send traffic to the default gateway.
+ Host A ethernet traffic is converted to electrical signals and applied to the line.
+ Default gateway detects the electrical signals and decodes the ethernet frame.
+ Default gateway checks the destination ethernet address and determines that it is the intended destination.
+ An unrelated host on the network also decodes the ethernet frame and checks the destination ethernet address. It is not the intended recipient and takes no action.
+ Default gateway checks the destination IP address and figures out the next hop. Process starts over while the packet is forwarded to the next hop.
# IP Address and Subnet Mask revisited
The IP address of a machine is actually representing two things, the network that the host is attached to and the address of the host itself. In the same way that a telephone number represents the geographic area in which a phone is located and the unique number of the phone itself. The subnet mask is what tells a computer what part of the IP address signifies the network and what part signifies the individual host.
# Transmission Control Protocol
There is a three-way handshake that TCP uses to establish a connection
+ The client sends a SYN packet to the server.
+ The server responds with SYN ACK to indicate that it has acknowledged the SYN packet
+ The client responds with ACK to let the server know that the connection is established.
## TCP Exercise
Set up a NIC in promiscuous mode and capture the traffic. Then use netcat to connect to some port. View the traffic with wireshark
1. tcpdump -npi eth0 -w example.pcap &
2. nc www.google.com 80
3. wireshark example.pcap
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment