Networks

Configure static IP

#  /etc/network/interfaces
auto eth0
iface eth0 inet static
address 10.10.0.12
netmask 255.255.255.0
#        network 192.168.0.0
#        broadcast 192.168.1.255
gateway 10.10.0.1
#dns-nameserver 8.8.8.8
dns-nameservers 10.10.1.253 10.10.1.254
dns-search example.com
dns-domain example.com
up route add -net 10.20.0.0 netmask 255.255.0.0 gw 10.10.1.1
 
#iface eth0 inet6 auto
iface eth0 inet6 static
  address 2001:db8:1:2::2
  netmask 64
  gateway fe80::1

Configure by DHCP IP

auto eth0
iface eth0 inet dhcp

Configure manual

auto eno1
iface eno1 inet manual
    bond-master bond0
 
# Example /etc/network/interfaces 
auto lo
iface lo inet loopback
 
# device: eth0
auto  eth0
iface eth0 inet static
  address   178.63.46.216
  broadcast 178.63.46.255
  netmask   255.255.255.192
  gateway   178.63.46.213
 
  # default route to access subnet
  up route add -net 178.63.46.192 netmask 255.255.255.192 gw 178.63.46.213 eth0
  post-up /sbin/route add -net 192.168.0.0 netmask 255.255.0.0 gw 192.168.1.1
 
auto eth0:1
allow-hotplug eth0:1
iface eth0:1 inet static
    address 192.168.1.44/24
 
#new
http://panticz.de/nmap-ip-and-portscan

Bond

cat /sys/class/net/storage/bonding/miimon
# get hardware mac address of interfaces
hwinfo --network  | egrep "Permanent HW Address|SysFS ID"  | egrep -A1 "eth" | paste - - | sort |  column -t
 
# get bond interfaces
lldpctl | egrep "Interface|SysName|PortID" | awk -F  ' *: *' '{print $2}' | awk -F  ',' '{print $1}' | paste - - - | egrep "^e" | awk '{print "'"$NODE"'",$1,$2,$4}' | column -t | sort -u -k 1,2
# get hardware interface id
cat /proc/net/bonding/* | egrep "Interface|HW" | cut -d":" -f"2-" | paste - - | column -t | sort
 
# show error counters
date -Is; cat /proc/net/dev | sed -e 's/|/ /g; s/  / /g' | column -t | awk '/^e/ || NR<=2'

ethtool
https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/6/html/deployment_guide/s1-ethtool

ethtool -s eth0 msglvl 0

tcpdump
https://danielmiessler.com/study/tcpdump/

tcpdump -i eth1 -pn port 67 and port 68

ipcalc

sudo apt install -y ipcalc 
ipcalc 192.168.200.20/24

Routing table(s)

ip route show table all
ip route show table all | grep -Po 'table \K[^\s]+' | sort -u | grep -e "[0-9]"
ip route flush table 200
 
ip addr add 10.0.0.185/24 dev ens7
ip route add default via 10.0.0.1 dev ens7 src 10.0.0.185 table table1
ip rule add from 10.0.0.185/32 table table1
 
ip route add default via 10.0.0.1 dev ens8 src 10.0.0.16 table table2
ip addr add 10.0.0.16/24 dev ens8
ip rule add from 10.0.0.16/32 table table2

Links
# Bandwidth calculator
http://web.forret.com/tools/bandwidth.asp?speed=1000&unit=bps

# Subnet Calculator
http://www.davidc.net/sites/default/subnets/subnets.html