Last active
August 29, 2017 14:04
-
-
Save toonetown/6015487b1ba11c69afad0b6429ecdd28 to your computer and use it in GitHub Desktop.
Aliases localhost to an address
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [ "$(id -u)" != "0" ]; then sudo "${0}" "$@"; exit $?; fi | |
if [ "${1}" == "-d" ]; then | |
[ -n "${2}" ] || { echo "Usage $0 [-d] <addr> [iface]"; exit 1; } | |
ifconfig ${3:-lo0} -alias ${2} | |
else | |
[ -n "${1}" ] || { echo "Usage $0 [-d] <addr> [iface]"; exit 1; } | |
ifconfig ${2:-lo0} alias ${1} 255.255.255.255 | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment