Created
January 29, 2019 08:49
-
-
Save gielfeldt/d9ce1143361a789b5f38335a0e3a7ad8 to your computer and use it in GitHub Desktop.
Set ip alias on boot
This file contains 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/sh | |
cat << EOL > /Library/LaunchDaemons/com.user.lo0-loopback.plist | |
<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE plist PUBLIC -//Apple Computer//DTD PLIST 1.0//EN http://www.apple.com/DTDs/PropertyList-1.0.dtd > | |
<plist version="1.0"> | |
<dict> | |
<key>Label</key> | |
<string>com.user.lo0-loopback</string> | |
<key>ProgramArguments</key> | |
<array> | |
<string>/sbin/ifconfig</string> | |
<string>lo0</string> | |
<string>alias</string> | |
<string>192.168.251.2/32</string> | |
</array> | |
<key>RunAtLoad</key> <true/> | |
<key>Nice</key> | |
<integer>10</integer> | |
<key>KeepAlive</key> | |
<false/> | |
<key>AbandonProcessGroup</key> | |
<true/> | |
<key>StandardErrorPath</key> | |
<string>/var/log/loopback-alias.log</string> | |
<key>StandardOutPath</key> | |
<string>/var/log/loopback-alias.log</string> | |
</dict> | |
</plist> | |
EOL | |
chmod 0644 /Library/LaunchDaemons/com.user.lo0-loopback.plist | |
chown root:wheel /Library/LaunchDaemons/com.user.lo0-loopback.plist | |
launchctl unload /Library/LaunchDaemons/com.user.lo0-loopback.plist | |
launchctl load /Library/LaunchDaemons/com.user.lo0-loopback.plist |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment