Networking
- Networking Fundamentals: https://www.youtube.com/watch?v=bj-Yfakjllc&list=PLIFyRwBY_4bRLmKfP1KnZA6rZbRHtxmXi
- https://www.reddit.com/r/devops/comments/rpspmu/how_did_you_guys_learn_networking/
- https://lucidmentor.com/networking/
- LAN, peer to peer network
- WAN
- Domain Network
- firewall and its working
- broadcast address (0 vs 255), muticast, anycast, unicast
- Wireshark, Promiscuous mode, monitor mode
Network
- Networks is what transports traffic between hosts
- Logical grouping of hosts which require similar connectivity
- Networks can contain other networks
- These are sometimes called sub-networks or subnet
- Networks connect to other networks
Network Protocols
- A network protocol is a set of rules that allows for data transmissions across different technologies.
Protocols
- ARP - Address Resolution Protocol
- FTP - File Transfer Protocol
- SMTP - Simple Mail Transfer Protocol
- HTTP - Hyper Text Transfer Protocol
- TLS - Transport Layer Security
- SSL - Secure Sockets Layer
- HTTPS - HTTP Secured with TLS/SSL
- DNS - Domain Name System
- DHCP - Dynamic Host Configuration Protocol
Commands
- https://www.windowscentral.com/8-networking-command-tools-every-user-should-know-windows-10
- nmap
- nslookup
- netstat
- ping
- traceroute/tracert
- cat /etc/hosts
- route
- netsh
- lsof
- ip
- arp
- ipconfig/ifconfig
- dig
- nc
- whois
ping
- uses ICMP protocol
- send 10 packets
- shows % packet loss also
ping <ip> -n 10traceroute
- print the route packets take to network host
traceroute example.comtracert
- Available on Windows
- shows hops
- Uses ICMP Time to Live (TTL)
- If stars are in output then, device used in particular hop is not configured to reply to ICMP and UDP traffic
- does not mean that the traffic was not passed successfully
tracert <ip>
# check google DNS
tracert 8.8.8.8
# google website
tracert www.google.comroute
- Manually manipulate the network routing tables
netsh
- Available on Windows
- Check the current Wifi standard
netsh wlan show interfaceslsof
- LiSt Open Files
- Check the process on port
lsof -i:8080- Check all open ports
sudo lsof -PiTCP -sTCP:LISTENnmap
- Network Mapper
- Network exploration tool and port scanner
- See
nmap
# find live hosts in local subnet
nmap -sn 192.168.1.0/24
# find live hosts in local subnet when ICMP is blocked
# (usually slower)
nmap -Pn 192.168.1.0/24
# scan a host when ICMP is blocked
nmap -Pn 192.168.1.10
# find common ports on a host
nmap 192.168.1.10nslookup
- Query Internet name servers interactively
# --- Interactive Mode ---
nslookup
## Check for google.com
> google.com
Server: 10.119.64.1
Address: 10.119.64.1#53
Non-authoritative answer:
Name: google.com
Address: 142.250.194.174
# --- Non-Interactive Mode ---
## Check for example.com
nslookup example.com
## Check for example.com on 8.8.8.8 DNS Server
nslookup example.com 8.8.8.8ss
- Socket Statistics
- part of
iproute2package - It deprecates
netstatfromnet-tools
netstat
- Show network status
- Displays the contents of various network-related data structures
ip
- part of
iproute2package - It deprecates all
net-toolscommands
| Legacy command ( net-tools) | Modern replacement ( ip) | Function |
|---|---|---|
ifconfig | ip addr / ip link | Managing IP addresses and interfaces |
route | ip route | View and alter IP routing tables |
arp | ip neigh | View and configure the ARP neighbor cache |
iptunnel | ip tunnel | Setting up network tunnels over IP |
nameif | ip link set name | Naming network hardware interfaces |
arp
- Displays and modifies the Internet-to-Ethernet address translation tables (ARP Cache) used by the ARP protocol
# Show arp cache
arp -a
# Remove one ARP entry
arp -d 192.168.1.10
# clear all ARP cache entries
sudo arp -a -ddig
- DNS lookup tool with detailed record output
- useful for checking specific DNS record types and DNS server responses
# A record
dig example.com
# MX records
dig example.com MX
# use specific DNS server
dig @8.8.8.8 example.com
# short output only
dig +short example.comnc
- aka
netcat - manual TCP or UDP connectivity checks
- useful for testing open ports and grabbing service banners
# test if TCP port is reachable
nc -vz 192.168.1.10 22
# scan small port range
nc -vz 192.168.1.10 20-30
# send raw HTTP request and read response
printf "GET / HTTP/1.1\r\nHost: example.com\r\n\r\n" | nc example.com 80whois
- shows domain registration and registrar information
- useful for ownership, registration dates, and name server checks
# domain ownership and registrar data
whois example.com
# IP ownership and ASN data
whois 8.8.8.8