Just a scratch to network commands to help you in your daily routines


GENERAL NOTES
DOMAIN NAME SERVER RELATED COMMANDS
hostname -IAll IP addresses for the host
hostname --fqdnLong host name (Fully Qualified Domain Name (FQDN)). Option aliasses are --long and -f
dig domain_name any +noall +answerTo view all the record types (A, MX, NS, etc.), use any option
dig domain_name mx +noall +answerTo view only MX (=Mail eXchange) records
dig domain_name ns +noall +answerTo view only NS (=Name Server) records
dig @dns_server domain_nameUse a Specific DNS server
nslookup domain_name dns_serverUse a specific DNS server (not mandatory)

NETWORK SETUP RELATED COMMANDS
routeShow the IP routing table. Can also be used to modify routes
ifconfigDisplay all interfaces which are currently available, even if down. -a option is default option so no need to use it
ifconfig eth0Display only eth0 interface

EXCELLENT NETWORK TOOLS
iptrafIn my opinion one of the best real time terminal traffic analyzer. All distros require to install this afterwards. Launch with iptraf or iptraf -i eth0 to monitor only specific network interface
nloadNeed to quickly visualize network traffic on terminal? This is your tool. All distros require to install this afterwards. Launch with nload or nload eth0 eth1 to monitor only specific network interface(s)
tcpdump -i eth0 'port 80'Want to break the atom? This is your real time terminal tool to see every little traffic detail. This example will print out all traffic to eth0 interface and port 80 (http)
netstat -taupenSwiss army knife of terminal network analysis. This will show open ports with PID & program. Simply too many options to list here - please refer to this site for excellent one-liners to detect e.g. DoS
nmap -v -sS 192.168.0.0/24nmap is the tool to do thorough port scans. This example does TCP SYN (half-open) scanning for IP range
lynx hostnameYeah, I am old school - terminal browser has saved me huge amount of time
telnet hostname 25Telnet is unsecure but it is swiss army knife to do quick checks like check port 25 in this example
nc -z hostname start_port-end_portNetcat is a handy little tool to do for example quick port scan and much more

IP ADDRESSES
24-bit block (/8 prefix, 1 × A): 10.0.0.0 - 10.255.255.255
20-bit block (/12 prefix, 16 × B): 172.16.0.0 - 172.31.255.255
16-bit block (/16 prefix, 256 × C): 192.168.0.0 - 192.168.255.255
IANA-reserved private IPv4 network ranges (24-bit block has 16777216, 20-bit block has 1048576 and 16-bit block has 65536 IP addresses)
169.254.0.0/16Link-local addressing for IPv4 networks
There are good terminal and graphical tools to calculate network parameters such as sipcalc (terminal), gip (graphical), whatmask (terminal) and ipcalc (terminal) plus several online tools like this

MISC HELPFUL STUFF
curl ifconfig.meBehind NAT? No worries, this shows your public IP address. Sometimes curl is not installed by default though
wget -qO- ifconfig.me/ipBehind NAT? No worries, this shows your public IP address (slow method). Sometimes wget is not installed by default though
lynx -dump ifconfig.me | grep 'IP Address'Behind NAT? No worries, this shows your public IP address. Sometimes lynx is not installed by default though
8.8.8.8 and 8.8.4.4Google lightning fast public free DNS service
pool.ntp.orgPool of NTP servers to use