Use an Alias to Have Two IP’s on One Network Interface

I’m often configuring some random new network device that needs you to connect to it via the network using some default IP address it shipped with.  Well, rather then disconnecting you computer from the network by changing its IP to match the default of this new device just use an ifconfig alias.

An alias will allow you to keep your current IP address on a network interface while adding a second one.  So you can have two IP addresses on one network interface.  You can still use the original to pull up reference material or search for information while, at the same time, connect to the default IP of a device you are setting up.  To do this you use the command line tool “ifconfig”.  So, if I wanted to add the IP 10.20.30.1 (mask 255.255.255.0) to interface en0 I would issue the command:

Now you have the functional original IP on your machine as well as the alias IP 10.20.30.1.  To remove the alias all you have to do is issue the command:

You’ll notice the sudo when issuing these commands.  You do need administrative rights to the computer to add or remove network IP aliases.




Interested In A Free Installer?

Our custom Wifi On/Off script has been a popular post!
This script automatically turns off the wireless interface on a computer when it is connected to a wired network, and turn the wireless interface back on when it is disconnected from the wired network.
This script has two main benefits:
  1. Network connection failover
  2. Eliminates unnecessary wireless traffic, and Multi-homed computers.
We are now offering a pkg installer for this script to anyone that signs up for our mailing list.