diff --git a/snippets/arp.fish b/snippets/arp.fish new file mode 100644 index 0000000..aeee7b1 --- /dev/null +++ b/snippets/arp.fish @@ -0,0 +1,31 @@ +#!/usr/bin/fish + +### +# Linux +# ------------------ +### + +# Display the current entries +arp +arp --numeric + +# Answer requests for 10.0.0.2 on eth0 with the MAC address for eth1 +arp --device 'eth0' --use-device -s '10.0.0.2' 'eth1' 'pub' +arp -i eth0 -Ds 10.0.0.2 eth1 pub + +# Delete the ARP table entry for 10.0.0.1 on interface eth1 +# Will match published proxy ARP entries *and* permanent entries +arp -i 'eth1' -d '10.0.0.1' + + +### +# Mac OS X +# ------------------ +### + +# Display the current entries +arp -a + +# Delete entries +arp -d -a +arp -d -i 'en0' 'nas.lan' diff --git a/snippets/route.fish b/snippets/route.fish new file mode 100644 index 0000000..1621000 --- /dev/null +++ b/snippets/route.fish @@ -0,0 +1,41 @@ +#!/usr/bin/fish + +### +# Linux +# ------------------ +### + +# Display the contents of the current routing table +route +route -n + +# Add routes +route add -net '192.56.76.0' netmask '255.255.255.0' metric '1024' dev 'eth0' +route add -net '192.57.66.0' netmask '255.255.255.0' gw 'astro' +route add -net '224.0.0.0' netmask '240.0.0.0' dev 'eth1' +route -6 add '2001:0002::/48' metric '1' dev 'eth2' + +# Add default routes +# Default routes will be used when no other route matches +# The gateway *must* be be on a directly reachable route +route add 'default' gw 'dijkstra' +route add 'default' gw '192.168.100.1' + +# Delete routes +# Since the Linux routing kernel uses classless addressing, one pretty much always has to specify the netmask as seen in +# 'route -n' +route del -net '192.56.76.0' netmask '255.255.255.0' + +# Delete the current default route +# It is either labeled 'default' or has '0.0.0.0' in the destination field of the current routing table +route del 'default' + + +### +# Mac OS X +# ------------------ +### + +# Flush the routing tables of all or specified gateway entries +route flush +route -n flush -inet6