Skip to content

Instantly share code, notes, and snippets.

@nastra
Last active June 9, 2016 10:35
Show Gist options
  • Save nastra/3a72fbb7a421b010b73f09752561658b to your computer and use it in GitHub Desktop.
Save nastra/3a72fbb7a421b010b73f09752561658b to your computer and use it in GitHub Desktop.
Adding loopback interfaces
#!/bin/bash
echo "Will add $1 loopback interfaces, starting at 127.0.0.2"
ifaces=$(expr $1 + 2)
for ((i=2;i<$ifaces;i++))
do
sudo ifconfig lo0 alias 127.0.0.$i up
echo "Added loopback interface 127.0.0.$i"
done
@nastra
Copy link
Author

nastra commented Jun 9, 2016

Usage: ./add-loopback.sh 5 will add 5 loopback interfaces, starting at 127.0.0.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment