Networks

# 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

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

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

# 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