Introduction to Networking
Introduction
Networking Overview
Network - enables two computers to communicate with each other
/24 - allows computers to talk to each other as long as the first three octets
/25 - divides this range in half
Work From Home setup:

Networking - delivery of mail or packages sent by one computer and received by the other
Uniform Resource Locator (URL)/Fully Qualified Domain Name (FQDN) - website address which we enter into our browser
URL - (
https://www.hackthebox.eu/example?floor=2&office=dev&employee=17)FQDN - (
www.hackthebox.eu)
Networking Structure
Network Types
Wide Area Network (WAN)
Internet
Local Area Network (LAN)
Internal Networks (Ex: Home or Office)
Wireless Local Area Network (WLAN)
Internal Networks accessible over Wi-Fi
Virtual Private Network (VPN)
Connects multiple network sites to one LAN
Wide Area Network (WAN) - address that is generally accessed by the internet. Also, a large number of LANs joined together. It uses BGP.
Local Area Network (LAN)/Wireless Local Area Network (WLAN) - typically assigned IP addresses for local use.
Virtual Private Network (VPN)
Site-To-Site VPN - share entire network ranges. Use to join network over the internet as same as local.
Remote Access VPN - creating a virtual interface that behaves as if it is on a client's network
SSL VPN - Typically these will stream applications or entire desktop sessions to your web browser
Global Area Network (GAN)
Global network (the Internet)
Metropolitan Area Network (MAN)
Regional network (multiple LANs)
Wireless Personal Area Network (WPAN)
Personal network (Bluetooth)
Networking Topologies
Network Topology - is a typical arrangement and physical and logical connection of devices in a network
Transmission Medium Layout - used to connect devices in the physical topology of the network e.g. for glass fiber media, this is cabling plan
Physical Topology - placement of nodes, how they connect using physical cables
Logical Topology - how signals act on the network media or how the data will be transmitted from one device to another
3 Areas of network topology
Connections
Wired Connections
Wireless Connections
Coaxial cabling
Wi-Fi
Glass fiber cabling
Cellular
Twisted-pair cabling
Satellite
Nodes - Network Interface Controller (NICs) - are the transmission medium's connection points to transmitters and receivers of electrical, optical, or radio signals in the medium.
Repeaters
Hubs
Bridges
Switches
Router/Modem
Gateways
Firewalls
Classifications
Point-To-Point Topology - simplest topology of device. Direct and straightforward physical link exists between two host

Bus Topology - all hosts are connected in transmission medium. There is no central network component that control and process it, using coaxial cable

Star Topology - maintains a connection to all hosts. Each host is connected to a central network component via a separate link. And the central component will handle the forwarding function to pass the data to the destination

Ring Topology - is such that each host or node is connected to the ring with two cables. 1 for incoming and 1 for outgoing. Typically, the transmission medium is accessed sequentially from station to station using a retrieval system from the central station or a token. A token is a bit pattern that continually passes through a ring network in one direction, which works according to the claim token process

Mesh Topology - have no fixed topology.
Fully Meshed - This means that the hosts are meshed with each other. used by WAN and MAN for reliability.
Partially Meshed - the endpoints are connected by only one connection.

Tree Topology - is an extended star topology that more extensive local networks have in this structure.

Hybrid Topology - combination of two or more topologies that are interconnected

Daisy Chain Topology - multiple hosts are connected by placing a cable from one node to another. Used by CAN

Proxies
Proxy - when a device or service sits in the middle of a connection and acts as a mediator. It is on the Layer 7 of OSI model
Mediator - critical piece of information it means that the device sits in the middle and must be able to inspect the content of the traffic
Proxy Types
Dedicated Proxy/Forward Proxy - is when a client makes a request to a computer, and that computer carries out the request. Filtering the outgoing requests. e.g. BurpSuite

Reverse Proxy - reverse of Forward Proxy. Filtering incoming response. The most common goal with a Reverse Proxy, is to listen on an address and forward it to a closed-off network. e.g. ModSecurity, WAF

(Non-) Transparent Proxy -
Transparent Proxy - the client doesn't know about its existence. Intercepts the client's communication requests to the Internet and acts as a substitute instance.
Non-transparent Proxy - we must be informed about its existence.
Networking Workflow
Networking Models
Communications has two networking model (ISO model and TCP/IP model)

OSI (Open Systems interconnect) Model - reference that can be describe and define as the communication between systems
TCP/IP (Transmission Control Protocol/Internet Protocol) Model - responsible for switching and transport of data packets on the internet

PDU (Protocol Data Unit) - In a layered system, devices in a layer exchange data in a different format



OSI Model
The goal in defining the
ISO/OSIstandard was to create a reference model that enables the communication of different technical systems via various devices and technologies and provides compatibility
Application
Among other things, this layer controls the input and output of data and provides the application functions.
Presentation
The presentation layer's task is to transfer the system-dependent presentation of data into a form independent of the application.
Session
The session layer controls the logical connection between two systems and prevents, for example, connection breakdowns or other problems.
Transport
Layer 4 is used for end-to-end control of the transferred data. The Transport Layer can detect and avoid congestion situations and segment data streams.
Network
On the networking layer, connections are established in circuit-switched networks, and data packets are forwarded in packet-switched networks. Data is transmitted over the entire network from the sender to the receiver.
Data Link
The central task of layer 2 is to enable reliable and error-free transmissions on the respective medium. For this purpose, the bitstreams from layer 1 are divided into blocks or frames.
Physical
The transmission techniques used are, for example, electrical signals, optical signals, or electromagnetic waves. Through layer 1, the transmission takes place on wired or wireless transmission lines.
TCP/IP Model
IP is located in network layer or layer 3
IP is located in transport layer or layer 4
Application
The Application Layer allows applications to access the other layers' services and defines the protocols applications use to exchange data.
Trransport
The Transport Layer is responsible for providing (TCP) session and (UDP) datagram services for the Application Layer.
Internet
The Internet Layer is responsible for host addressing, packaging, and routing functions.
Link
The Link layer is responsible for placing the TCP/IP packets on the network medium and receiving corresponding packets from the network medium. TCP/IP is designed to work independently of the network access method, frame format, and medium.
Logical Addressing
IP
Due to many hosts in different networks, there is a need to structure the network topology and logical addressing. Within TCP/IP, IP takes over the logical addressing of networks and nodes. Data packets only reach the network where they are supposed to be. The methods to do so are network classes, subnetting, and CIDR.
Routing
IP
For each data packet, the next node is determined in each node on the way from the sender to the receiver. This way, a data packet is routed to its receiver, even if its location is unknown to the sender.
Error & Control Flow
TCP
The sender and receiver are frequently in touch with each other via a virtual connection. Therefore control messages are sent continuously to check if the connection is still established.
Application Support
TCP
TCP and UDP ports form a software abstraction to distinguish specific applications and their communication links.
Name Resolution
DNS
DNS provides name resolution through Fully Qualified Domain Names (FQDN) in IP addresses, enabling us to reach the desired host with the specified name on the internet.
Addressing
Network Layer
Network Layer/Layer 3 - controls exchange of data packets
Layer 3 responsible for these functions:
Logical Addressing
Routing
Protocols - represent a collection of rules for communication in the respective layer
IPv4/IPv6
IPsec
ICMP
IGMP
RIP
OSPF
IPv4 Addresses
Addressing network is done via IPv4/IPv6 address
IPv4/IPv6 - is the unique postal address and district of the receiver building
MAC - exact floor and apartment of receiver
IPv4 - consists of 32-bit binary number combined into 4 bytes consisting 8-bit groups (octets) ranging from 0-255
Binary
0111 1111.0000 0000.0000 0000.0000 0001
Decimal
127.0.0.1
A
1.0.0.0
1.0.0.1
127.255.255.255
255.0.0.0
/8
127
16,777,214 + 2
B
128.0.0.0
128.0.0.1
191.255.255.255
255.255.0.0
/16
16, 384
65,534 + 2
C
192.0.0.0
192.0.0.1
223.255.255.255
255.255.255.0
/24
2, 097, 152
254+2
D
224.0.0.0
224.0.0.1
239.255.255.255
Multicast
Multicast
Multicast
Multicast
E
240.0.0.0
240.0.0.1
255.255.255.255
reserved
reserved
reserved
reserved
Subnetting - separation of classes into small network
Subnet Mask - describes but positions which IP address act as network part or host part
Default Gateway - name of router in IPv4 addresses, common to the default gateway name the first or last assignable to IPv4 address
Broadcast Address - connect all devices to in a network with each other
Broadcast - message in a network transmitted to all participants, last IPv4 address is used for that
Binary system - system that uses only 1 and 0
Example IP address:
192.168.10.391st Octet Value:
192
2nd Octet Value: 168
3rd Octet Value:
104th Octet Value:
39
1st
128 + 64 + 0 + 0 + 0 + 0 + 0 + 0
192
2nd
128 + 0 + 32 + 0 + 8 + 0 + 0 + 0
168
3rd
0 + 0 + 0 + 0 + 8 + 0 + 2 + 0
10
4th
0 + 0 + 32 + 0 + 0 + 4 + 2 + 1
39
IPv4 Binary Notation - 192.168.10.39
IPv4 - Decimal to Binary of
Class C
1st
128 + 64 + 32 + 16 + 8 + 4 + 2 + 1
255
2nd
128 + 64 + 32 + 16 + 8 + 4 + 2 + 1
255
3rd
128 + 64 + 32 + 16 + 8 + 4 + 2 + 1
255
4th
0 + 0 + 0 + 0 + 0 + 0 + 0 + 0
0
Subnet Mask
Classless Inter-Domain Routing (CIDR) - is a method of representation and replaces the fixed assignment between IPv4 address and network classes (A, B, C, D, E)
CIDR suffix - division is based on subnet mask
IPv4: 192.168.10.39
Subnet Mask: 255.255.255.0
CIDR: 192.168.10.39/24
Subnetting
Subnetting - division of an address range in IPv4 addresses into smaller address range
Subnet - logical statement of a network that uses IP addresses with same network addresses
Example:
IPv4 Address:
192.168.12.160Subnet Mask:
255.255.255.192CIDR:
192.168.12.160/26
Network Part (All yellow)
IPv4
1100 0000
1010 1000
0000 1100
1010 0000
192.168.12.160/26
Subnet Mask
1111 1111
1111 1111
1111 1111
1100 0000
255.255.255.192
Bits
/8
/16
/24
/32
Host Part (All yellow)
IPv4
1100 0000
1010 1000
0000 1100
1010 0000
192.168.12.160/26
Subnet Mask
1111 1111
1111 1111
1111 1111
1100 0000
255.255.255.192
Bits
/8
/16
/24
/32
Network Address - vital for delivery of packet
Subnet Mask - determine where separation occurs
Separation of Network and Host Parts:
IPv4
1100 0000
1010 1000
0000 1100
10 | 10 0000
192.168.12.160/26
Subnet Mask
1111 1111
1111 1111
1111 1111
11 | 00 0000
255.255.255.192
Bits
/8
/16
/24
/32
Under 4th Octet
10|is the part of network address, make host part all0's -> 10 | 00 0000, so the network address wil be192.168.12.128Under 4th Octet
|10 0000is the part of host address, make host part all1's -> 10 | 11 1111, so the broadcast address wil be192.168.12.191
Network Address
192.168.12.128
First Host
192.168.12.129
Other Hosts
...
Last Host
192.168.12.190
Broadcast Address
192.168.12.191
Subnet in to smaller networks use this ->
2^n = valueExample:
Subnet:
192.168.12.128/26Required subnets:
4
To get the 2 bits, 2^2 = 4, n = 2
Increase the CIDR to 2 bits /26 + 2 = /28 (changes all in yellow)
IPv4
1100 0000
1010 1000
0000 1100
1010 | 0000
192.168.12.160/28
Subnet Mask
1111 1111
1111 1111
1111 1111
1111 | 0000
255.255.255.240
Bits
/8
/16
/24
/32
64 divide 4 subnets = 64 / 4 = 16 host range
1
192.168.12.128
192.168.12.129
192.168.12.142
192.168.12.143
192.168.12.128/28
2
192.168.12.144
192.168.12.145
192.168.12.158
192.168.12.159
192.168.12.144/28
3
192.168.12.160
192.168.12.161
192.168.12.174
192.168.12.175
192.168.12.160/28
4
192.168.12.176
192.168.12.177
192.168.12.190
192.168.12.191
192.168.12.176/28
SHORTCUT ON SUBNETTING
Get the CIDR value of given IPv4 Address and get the remainder when dividing by 8 (modulo)
Subtract 8 to 3
Raise 2 to the difference of CIDR value and 3
The value you get minus 1
Add this to the given IPv4 address and that is the range
If the problem has subnets, divide the range to given subnets
Example:
IPv4 address:
10.200.20.0/27Subnet:
4
Steps:
/27is the CIDR value, get the remainder =27 % 8= 3Subtract 8 to 3 (ALWAYS 8-n, IT IS FIXED) =
8 - 3= 5Raise 2 to 5 (ALWAYS 2^n, IT IS FIXED) =
2 ^ 5= 32Subtract the value to 1 (ALWAYS n-1, IT IS FIXED) =
32 - 1= 31Add the host value to base IPv4 address =
10.200.20.0=0 + 31= 31 = 10.200.20.0 to 10.200.20.31
If the given has subnet (OPTIONAL):
To get the subnets, divide 32 (IN THE STEP 3), to given subnet 4 =
32 / 4= 8Subtract the value to 1 (ALWAYS n-1, IT IS FIXED) =
8 - 1= 7Add the host address
10.200.20.0to 7 = 0 + 7 = 7 = 10.200.20.0 to 10.200.20.7 (FIRST SUBNET)Add the host address
10.200.20.8to 7 = 8 + 7 = 15 = 10.200.20.8 to 10.200.20.15 (SECOND SUBNET)Add the host address
10.200.20.16to 7 = 16 + 7 = 23 = 10.200.20.16 to 10.200.20.23 (THIRD SUBNET)Add the host address
10.200.20.24to 7 = 24 + 7 = 31 = 10.200.20.24 to 10.200.20.31 (FOURTH SUBNET)
To visualize:
Range IPv4 Address:
10.200.20.0 to 10.200.20.31Subnets:
4
1
10.200.20.0
10.200.20.1
10.200.20.6
10.200.20.7
10.200.20.0/27
2
10.200.20.8
10.200.20.9
10.200.20.14
10.200.20.15
10.200.20.8/27
3
10.200.20.16
10.200.20.17
10.200.20.22
10.200.20.23
10.200.20.16/27
4
10.200.20.24
10.200.20.25
10.200.20.30
10.200.20.31
10.200.20.24/27
Questions:
1. Submit the decimal representation of the subnet mask from the following CIDR: 10.200.20.0/27
2. Submit the broadcast address of the following CIDR: 10.200.20.0/27
3. Split the network 10.200.20.0/27 into 4 subnets and submit the network address of the 3rd subnet as the answer.
4. Split the network 10.200.20.0/27 into 4 subnets and submit the broadcast address of the 2nd subnet as the answer.
MAC Addresses
Media Access Control (MAC) address - physical address for our network interfaces
Several different standards of MAC:
Ethernet (IEEE 802.3)
Bluetooth (IEEE 802.15)
WLAN (IEEE 802.11)
Example of MAC address:
DE:AD:BE:EF:13:37DE-AD-BE-EF-13-37DEAD.BEEF.1337
Binary
1101 1110
1010 1101
1011 1110
1110 1111
0001 0011
0011 0111
Hex
DE
AD
BE
EF
13
37
MAC address consist of total of 6 bytes
Binary
1101 1110
1010 1101
1011 1110
1110 1111
0001 0011
0011 0111
Hex
DE
AD
BE
EF
13
37
Organization Unique Identifier (OUI) (Yellow) - first half of the address (3 bytes/24 bits)
Individual Address Part or Network Interface Controller (NIC) (Red) - last half, assigned by manufacturers
Address Resolution Protocol (ARP) - is used in IPv4 to determine the MAC addresses associated with the IP addresses
Reserved MAC addresses called Local Range:
02:00:00:00:00:00
06:00:00:00:00:00
0A:00:00:00:00:00
0E:00:00:00:00:00
MAC Unicast - last 2 bits in the first octet signifies if the address is Unicast (0) or Multicast (1) (Yellow), packet sent will reach only 1 specific host, last bit in 1st octet is 0
Binary
1101 1110
1010 1101
1011 1110
1110 1111
0001 0011
0011 0111
Hex
DE
AD
BE
EF
13
37
MAC Multicast - packet is sent only once to all hosts, last bit in 1st octet is 1 (Yellow)
Binary
0000 0001
0000 0000
0101 1110
1110 1111
0001 0011
0011 0111
Hex
01
00
5E
EF
13
37
MAC Broadcast - data packets is sent to all members of a network, All 1 (Yellow)
Binary
1111 1111
1111 1111
1111 1111
1111 1111
1111 1111
1111 1111
Hex
FF
FF
FF
FF
FF
FF
Global OUI - second to last bit of first octet is 0
Binary
1101 1100
1010 1101
1011 1110
1110 1111
0001 0011
0011 0111
Hex
DC
AD
BE
EF
13
37
Locally Administered - second to last bit of first octet is 1
Binary
1101 1110
1010 1101
1011 1110
1110 1111
0001 0011
0011 0111
Hex
DE
AD
BE
EF
13
37
Address Resolution Protocol (ARP) - is a network protocol used to resolve network layer (layer 3) IP address to link layer (layer 2) MAC address to facilitate LAN
ARP Resolution - device with matching IP address responds with its own MAC address, and then the 2 devices can communicate directly using their MAC address
ARP Request - request is broadcast to all devices in a LAN and it contains the IP address of the destination
ARP Reply - when device receives ARP request, it sends an ARP Reply to the requesting device with its MAC address

ARP Spoofing - used to intercept or manipulate traffic on the network, secure using firewall or IDS, attack in which we send falsified ARP messages to LAN (Pretend like a legitimate address), can be done using Ettercap or Cain & Abel

IPv6 Addresses
IPv6 - successor of IPv4, 128 bit long
prefix - identifies the host and network parts
Internet Assigned Numbers Authority (IANA) - responsible for IPv4 and IPv6 addresses
Dual Stack - IPv4 and IPv6 can be made available simultaneously
Advantages of IPv6:
Larger Address Space
Address self-configuration (SLAAC)
Multiple IPv6 addresses per interface
Faster Routing
End-to-end encryption (IPsec)
Data packages up to 4 GByte
Bit length
32-bit
128-bit
OSI layer
Network Layer
Network Layer
Addressing range
~ 4.3 billion
~ 340 undecillion
Representation
Binary
Hexadecimal
Prefix notation
10.10.10.0/24
fe80::dd80:b1a9:6687:2d3b/64
Dynamic Addressing
DHCP
SLAAC / DHCPv6
IPsec
Optional
Mandatory
4 different types of IPv6
Unicast - addresses for single interface
Anycast - addresses for multiple interface, one of them receives the packet
Multicast - addresses for multiple interface, all receives same packet
Broadcast - do not exist and realized with multicast addresses
Hexadecimal System (hex) - make the binary more readable, 16 (0-F)
Binary
1100 000
1010 1000
0000 1100
1010 0000
Hex
C0
A8
0C
A0
Decimal
192
168
12
160
IPv4 parts
Network Prefix (network part) - identifies the network, range and subnet
Interface Identifier/Suffix (host part) - formed from 48-bit MAC address, default prefix length is /64
Protocols & Terminology
Networking Key Terminology
Wired Equivalent Privacy
WEP
security protocol commonly used to secure wireless networks
Secure Shell
SSH
secure network protocol to log into and execute commands in a remote host
File Transfer Protocol
FTP
network protocol used to transfer files in a network
Simple Mail Transfer Protocol
SMTP
protocol used to send and receive emails
Hypertext Transfer Protocol
HTTP
client-server protocol to send and receive data over the internet
Server Message Block
SMB
protocol used to share files, printers, and other resources in a network
Network File System
NFS
protocol used to access file in a network
Simple Network Management Protocol
SNMP
protocol used to managed network devices
Wi-Fi Protected Access
WPA
wireless security protocol to protect wireless networks in an unauthorized access
Temporal Key Integrity Protocol
TKIP
security protocol used in wireless networks but less secure
Network Time Protocol
NTP
to synchronize time in a network
Virtual Local Area Network
VLAN
way to segment network into multiple logical networks
VLAN Trunking Protocol
VTP
layer 2 protocol used to establish and maintain a VLAN spanning multiple switches
Routing Information Protocol
RIP
distance-vector routing protocol used in LANs and WANs
Open Shortest Path First
OSPF
an IGP for routing traffic within a single Autonomous System in an IP network
Interior Gateway Routing Protocol
IGRP
Cisco proprietary protocol designed for routing Autonomous System
Enhanced Interior Gateway Routing Protocol
EIGRP
advanced distance-vector routing protocol that is used to route IP traffic in a network
Pretty Good Privacy
PGP
encryption program used to secure emails, files and other types of data
Network News Transfer Protocol
NNTP
used for distributing and receiving messages in a newsgroup across the internet
Cisco Discovery Protocol
CDP
Cisco proprietary protocol that allows administrators to discover and manage cisco devices in a network
Hot Standby Router Protocol
HSRP
protocol used in Cisco devices to provide redundancy when router or network devices fail
Virtual Router Redundancy Protocol
VRRP
protocol used to provide automatic assignment of available IP router in a host
Spanning Tree Protocol
STP
used to ensure loop-free topology in Layer 2 ethernet networks
Terminal Access Controller Access-Control System
TACACS
protocol that provides centralized authentication, authorization, and accounting for network access
Session Initiation Protocol
SIP
signaling protocol used for establishing and terminating real-time voice, video and multimedia sessions in an IP network
Voice Over IP
VOIP
technology used to create telephone calls over internet
Extensible Authentication Protocol
EAP
framework for authentication that supports multiple authentication methods, such as passwords, digital certificates, one-time passwords, and public-key authentication
Lightweight Extensible Authentication Protocol
LEAP
Cisco proprietary wireless authentication protocol, based on EAP used in Point-to-Point Protocol
Protected Extensible Authentication Protocol
PEAP
security protocol that provides encrypted tunnel for wireless networks
Systems Management Server
SMS
systems management solution that helps organitions manage their networks, systems and mobile devices
Microsoft Baseline Security Analyzer
MBSA
a Microsoft tool used to monitor and detect security vulnerabilities within Windows computers
Supervisory Control and Data Acquisition
SCADA
type of industrial control system to monitor and control industrial processes
Virtual Private Network
VPN
technology that allows to create and secure encrypted connection to a network over the internet
Internet Protocol Security
IPsec
protocol that provides secured and encrypted communication over the network
Point-to-Point Tunneling Protocol
PPTP
protocol used to create a secure, encrypted tunnel for remote access
Network Address Translation
NAT
technology that translates private IP addresses into single public address
Carriage Return Line Feed
CRLF
Combines two control characters to indicate the end of a line and a start of a new one for certain text file formats
Asynchronous JavaScript and XML
AJAX
technique used to create dynamic web pages using JavaScript and XML/JSON
Internet Server Application Programming Interface
ISAPI
allows to create performance-oriented web extensions for web servers using a set of APIs.
Uniform Resource Identifier
URI
syntax to identify a resource on internet
Uniform Resource Locator
URL
subset of URI, including the protocol and domain name
Internet Key Exchange
IKE
protocol used in VPNs to provide authentication and encryption for data transmission and protect data from tampering and eavesdropping
Generic Routing Encapsulation
GRE
protocol used to encapsulate data transmitted within the VPN tunnel
Remote Shell
RSH
program under Unix that allows executing commands and programs on a remote computer
Last updated