Networking: Linux
Manual management
IP
Display network intefaces
ip link show
ip link show eth0
Enable network interface
ip link set eth0 up
Disable network interface
ip link set eth0 down
Display assigned addresses
ip addr show
ip addr show eth0
Assign static address
ip addr add 192.168.1.10/24 dev eth0
Remove address from interface
ip addr del 192.168.1.10/24 dev eth0
or (remove all)
ip addr flush eth0
Show routing table
ip route show
Add static route
ip route add 192.168.1.0/24 dev eth0 proto kernel scope link src 192.168.1.10
Delete static route
ip route del 192.168.1.0/24
Add default gateway
ip route add default via 192.168.1.1
Remove default gateway
ip route del default
Display ARP cache
ip neigh show
Add ARP entry
ip neigh add 192.168.1.0 lladdr 20:41:e3:40:c6:b2 dev eth0
Remove ARP entry
ip neigh del 192.168.1.0 dev eth0
Flush ARP entry
ip neigh add 192.168.1.0 lladdr 20:41:e3:40:c6:b2 dev eth0 nud stale
or (all entries)
ip neigh flush all
Change MAC address
ip link set dev eth0 address 20:41:e3:40:c6:b3
Set MTU
ip link set mtu 2000 dev eth0