e42.uk Circle Device

 

Quick Reference

iproute2 Quick Reference

iproute2 Quick Reference

This is a quick reference to the iproute2 command. All examples are of the form: example then concrete. # at the start of a line is a comment.

Addresses

Adding and Removing an IP address to an interface

ip addr add <ipv4addr>/<masklen> dev <iface>
ip addr add 192.168.10.2/24 dev eth0

ip addr del <ipv4addr>/<masklen> dev <iface>
ip addr del 192.168.10.2/24 dev eth0

(prefixlen is the same as masklen, you need to spend some time with a computer nerd if you don't know that). I'm available most of the time @tribeca23 or please feel free to email me.

ip -6 addr add <ipv6addr>/<prefixlen> dev <iface>
ip -6 addr add 2001:420:3fd9:8ec::b/64 dev eth0

# also ok without the -6
ip addr add <ipv6addr>/<prefixlen> dev <iface>
ip addr add 2001:420:3fd9:8ec::b/64 dev eth0

Routes

IPv6 routes are cool, get IPv6 working on your network!

ip route add <destination>/<prefixlen> via <ipaddress>
ip route add default via 2001:420:3fd9:8ec::2

# route all traffic to 192.168.23.x via 192.168.10.254
ip route add 192.168.23.0/24 via 192.168.10.254

# route the google traffic over the IPv6 network
ip route add 2a00:1450:400c:c01::63/128 via 2001:420:3fd9:8ec::8

# the same but specify the device too
ip route add 2a00:1450:400c:c01::63/128 via 2001:420:3fd9:8ec::8 dev eth1

In an ethernet network you are basically finding the MAC address for the via address (2001:420:3fd9:8ec::8 or 192.168.10.254 or 2001:420:3fd9:8ec::2) and the device (can also be optionally specified if there is any ambiguity) then sending the ethernet frame there.

Quick Links: Techie Stuff | General | Personal | Quick Reference