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

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
 
#new
http://panticz.de/nmap-ip-and-portscan

VLAN

# show VLANs
cat /proc/net/vlan/config
 
# old
# scan ip from mac
NET=192.168.0
for ((i=1; i<=254; i++));do
  ping -c 1 ${NET}.$i 2>&1 >/dev/null
  arp -a ${NET}.$i
done
 
 
NET=10.100.0
for ((i=200; i<=230; i++));do
    ping -c 1 ${NET}.$i 2>&1 > /dev/null || echo ${NET}.$i
done
 
# fix interface name
echo 'SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="02:01:02:03:04:05", ATTR{dev_id}=="0x0", ATTR{type}=="1", NAME="eth0"' >> /etc/udev/rules.d/70-persistent-net.rules

Network namespaces
https://matthewarcus.wordpress.com/2018/02/04/veth-devices-network-namespaces-and-open-vswitch/

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

ethtool

ethtool -s eth0 msglvl 0

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