Add secondary IP iproute2
Assign a secondary IP/prefix live; note: not persisted across reboot
ip addr add 10.0.0.5/24 dev <name> && ip addr show dev <name>
more iproute2
all 12 commands →
Set interface MTU
ip link set dev <name> mtu 9000 && ip link set dev <name> up
JSON addr to jq
ip -j a | jq -r '.[] | select(.operstate=="UP") | .ifname + " " + (.addr_info[]?.local // "-")'
Which route is chosen
ip route get <ip>
Source-based policy routing
ip rule add from <ip> table 100 && ip route add default via 192.168.1.1 dev <name> table 100
Run command in netns
ip netns add test && ip netns exec test ip -br a