Useful things with linux networking
iptables -nL | grep -Eo "[[:digit:]]{1,3}\.[[:digit:]]{1,3}\.[[:digit:]]{1,3}\.[[:digit:]]{1,3}" | sort | uniq | xargs -I {} -P 50 ping -W1 -c1 {} | grep -B1 "0 received"
# Get HW address of interface. Split by ':'
interface="eth0"
cat /sys/class/net/$interface/address
# Get operational state of interface (up/down/unknown)
cat /sys/class/net/$interface/operstate
# Get carrier status of network interface (interface must be up).
# 0 if interface is DOWN
# 1 if interface is UP
cat /sys/class/net/$interface/carrier
# Traffic shaping libvirt / Quality of service
<devices>
<interface type='network'>
<source network='default'/>
<target dev='vnet0'/>
<bandwidth>
<inbound average='1000' peak='5000' floor='200' burst='1024'/>
<outbound average='128' peak='256' burst='256'/>
</bandwidth>
</interface>
</devices>
# Debian default gateway /etc/network/interfaces
up route add default gw 62.210.123.1
# Force interface eth0 to 10 Gbit speed
ethtool -s <device> speed 10000 duplex full autoneg off
# For the setting to be persistent across reboots
# edit "/etc/udev/rules.d/71-ethtool.rules"ff and
# add "SUBSYSTEM=="net", ACTION=="add", NAME=="<device>", RUN+="/sbin/ethtool <device> -s speed 100 duplex full autoneg off"