Skip to content

Instantly share code, notes, and snippets.

@michel-zimmer
Last active August 29, 2015 14:05
Show Gist options
  • Save michel-zimmer/0d0e0f297f3c3a3835c0 to your computer and use it in GitHub Desktop.
Save michel-zimmer/0d0e0f297f3c3a3835c0 to your computer and use it in GitHub Desktop.
/etc/network/if-up.d/homenetwork
#!/bin/sh
# replace _mac_ with a mac adress of an always on network device, like a router
if [ $( /usr/sbin/arp -a | grep -c '_mac_' ) -eq 1 ]; then
cat /etc/hosts.homenetwork > /etc/hosts
else
cat /etc/hosts.publicnetwork > /etc/hosts
fi
cat /etc/hosts.default >> /etc/hosts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment