ip

Link

ip -d link show eth0.8
ip link show eno1
 
ip link set eth0 up
ip link set dev <interface> up
ip link set dev <interface> down
 
ip link del docker0
 
# shutdown interface
ip addr del 10.0.0.2/24 dev eth0
ip link set eth0 down
 
# Configure MTU
ip ad | grep mtu
ip link set dev eth0 mtu 1400
 
# Configure VLAN
ip link add link eth0 name eth0.100  type vlan id 100

Address

ip addr show eth0
 
ip addr add 192.168.1.33/24 dev eth0
ip addr add 192.168.0.111/24 dev eth0:1
 
# remove ip
ip addr del 10.22.30.44/16 dev eth0
ip addr flush dev eth0

Route

ip route show default 0.0.0.0/0
 
sudo ip route del default
sudo ip route add default via 192.168.1.254
sudo ip route add 10.0.3.123 dev tun0 scope link
sudo ip route add 10.23.0.0/16 via $(getent hosts vpn.example.com | cut -d" " -f1)
 
# route
#dep# sudo route add -net 192.168.254.0 gw 192.168.1.34 netmask 255.255.255.0 dev tap0
sudo brctl addbr br10
sudo ip link set dev br10 up
sudo ip route add 192.168.33.0/24 via 10.0.3.100 dev lxcbr0
 
# block route to
iptables -A OUTPUT -d 10.0.1.15 -j DROP
 
# block route without iptables
ip route add prohibit 10.0.1.15/32
 
# test (two routing tables)
echo "1 admin" >> /etc/iproute2/rt_tables
echo "2 users" >> /etc/iproute2/rt_tables
ip rule add from 192.168.122.40/32 dev eth0 table admin
ip rule add from 192.168.123.41/32 dev eth1 table users
ip route add default via 192.168.122.1 dev eth0 table admin
ip route add default via 192.168.123.1 dev eth1 table users
 
ip -4 route get 8.8.8.8
 
# show routing table
ip route

Bridge
http://panticz.de/brctl

# remove bridge
ip link set dev br10 down
brctl delbr br10
 
# delete interface
ip link delete br0

Bridge

apt install -y bridge-utils
brctl addif br0 enp0s8
ip addr flush dev enp0s8
ip link set br0 up
dhclient br0

Namespaces
https://unix.stackexchange.com/questions/210982/bind-unix-program-to-specific-network-interface

ip netns ls
ip netns exec qrouter-1111-2222-3333-4444-5555 ip a
ip netns pids qdhcp-1111-222-333-444-555-6666 | xargs ps -o pid,command -p

Bonding

ip link add bond0 type bond mode 802.3ad
ip link set eth0 master bond0
ip link set eth1 master bond0
ifdown eth0 && ifdown eth1 && ifup bond0
cat /proc/net/bonding/bond0
 
# Get error / dropped packet statistics
sudo netstat -i

Links
https://p5r.uk/blog/2010/ifconfig-ip-comparison.html
https://wiki.archlinux.org/index.php/VLAN
https://www.cyberciti.biz/tips/configuring-static-routes-in-debian-or-red-hat-linux-systems.html
https://www.cyberciti.biz/faq/howto-linux-configuring-default-route-with-ipcommand/
http://www.tecmint.com/ip-command-examples/
https://tty1.net/blog/2010/ifconfig-ip-comparison_en.html