Networking
Networkingπ
IP Address, Mask, Gatewayπ
IPv4π
Four 8-bit numbers 0-255.0-255.0-255.0-255
- subnet mask
- gateway server: where to send packages?
- DNS server: resolve domain names to IPs
Portsπ
IANA (Internet Assigned Numbers Authority): Service Name and Transport Protocol Port Number Registry ^d2523a
Excerpt
1 2 3 4 |
|
Technologies and Protocolsπ
What is a protocol?1
In networking, a protocol is a standardized set of rules for formatting and processing data. Protocols enable computers to communicate with one another.
Protocolsπ
1 2 3 4 5 |
|
OSI Modelπ
7 layers to differentiate protocols
- layer 1: physical layer
- layer 2: data link layer
- layer 3: network layer
- layer 4: transport layer
- layer 5: session layer
- layer 6: presentation layer
- layer 7: application layer
Wirelessπ
Securityπ
Network Managersπ
Netplanπ
Load Balancingπ
- nginx: HTTPq
- HAProxy: TCP/HTTP
- LVS (Linux Virtual Server)
Toolsπ
Tags: #tech/networking/tools
General toolkit ^0fd526
- ICMP
- ping and traceroute
- wireshark
- NSLookpup
- Netstat
- Network Management
- Show and debug
- Discovery …
- …
ip
#tech/networking/tools/ip
-
network namespaces
- create virtual route/network between VM and host (K8s Documentation)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
# create network namespace for VM sudo ip netns add myns ip netns list # execute command in new network namespace sudo ip netns exec myns ip addr # create a virtual interface pair, it has two virtual interfaces which are connected by a virtual cable sudo ip link add veth-a type veth peer name veth-b # move one interface to new namespace sudo ip link set veth-b netns test1 # assign IP addresses and bring interfaces up sudo ip addr add 192.168.1.1/24 dev veth-a sudo ip link set veth-a up sudo ip netns exec myns ip addr add 192.168.1.2/24 dev veth-b sudo ip netns exec myns ip link set dev veth-b up # we should be able to ping interface `b` ping 192.168.1.2
host
: DNS lookup utility
1 |
|
netstat
: part of net-tools
and considered deprecated, functionality is now provided by ip
and ss
1 |
|
Alternatives to deprecated net-tools
programs @StackExchange
arp
βip n
(ip neighbor
)ifconfig
βip a
(ip addr
),ip link
,ip -s
(ip -stats
)iptunnel
βip tunnel
iwconfig
βiw
nameif
βip link
, ifrenamenetstat
βss
,ip route
(fornetstat -r
),ip -s link
(fornetstat -i
),ip maddr
fornetstat -g
)
Tags: #tech/networking/nc (netcat): scan for (open) ports
1 2 3 4 5 |
|
Tags: #linux/tools/lsof: list open (network) files, show ports and mappings
1 2 3 4 |
|
Tags: #tech/networking/tools/ss ^06f80a
1 2 3 4 5 6 7 8 9 10 11 12 13 |
|
nmap: Network exploration tool and security / port scanner. Not commonly pre-installed.
open source tool for network exploration and security auditing
1 |
|
Tags: #tech/networking/tools/dnsmasq: A lightweight DHCP and caching DNS server
Tags: #tech/networking/tools/dig (Domain Information Groper): DNS lookup utility
- find CNAMEs and IPs for hostnames
1 |
|
Tags: #tech/networking/tools/resolvctl: #linux/systemd (not present on openSUSE)
Send control commands to the network name resolution manager, or resolve domain names, IPv4 and IPv6 addresses, DNS records, and services.
Config at /etc/resolv.conf
specifying DNS servers, but usually managed by some program, e.g. netconfig
.
Tags: #tech/networking/tools/nslookup: (interactively) query Internet name servers
1 |
|
traceroute
: print the route packets trace to network host
1 |
|
Wiresharkπ
See also my notes on Wireshark
Tags: #tech/networking/tools/wireshark: the worldβs foremost and widely-used network protocol analyzer
Website | Documentation | Wiki
Tags: #tech/networking/tshark: Dump and analyze network traffic
Securityπ
See my notes on networking security
SSL Labs: Check website certificate, protocols, keys, etc.
Authenticationπ
Principlesπ
Packetsπ
- MTU (Maximum Transmission Unit) ^mtu
maximum packet size that can be transmitted over your network
Packet Problemsπ
- faulty packets lead to CRC errors (e.g. cable issue)
- business environment switches usually drop these, consumer devices might forward packets anyway
- even when connected to the switch, the NIC might drop it, Wireshark still can’t see it then (old NICs might still forward) => Wireshark is only good for OSI layers 2-7, other tools required for layer 1
Main issues
- delay
- jitter (variation in arrival of packets)
- packet loss
Fragmented packets pose security problems as they can be able to avoid signature detection as firewall’s signature detection would require putting them back together. This would mean a lot of processing, so they are often dropped. For example Google drops ping attempts with size 4096 bytes. Thus fragmented packets can hint at security issues. On modern networks they shouldn’t be present anymore.
Detecting Wireshark being used on a network: with active name resolution disabled Wireshark is passive, but tools can look for promiscuous NIC behaviour.
Packet Priorityπ
Packets have tags to determine priority and ensure Quality of Service (QoS). In most cases this should be reassigned when external packets enter a network as own priorities on traffic are safer to use.