Over a million developers have joined DZone.

Create VIPs On Mac OSX

Virtual IPs are so damn useful it hurts sometimes. On Mac OS X 10.1 and above, they're extremely easy to create:

Create a VIP on the same subnet as the primary interface(netmask must be 0xFFFFFFFF):

# ifconfig en1 inet netmask alias

Create a VIP on a different subnet:

# ifconfig en1 inet netmask alias

(Note: you may have to sub en0 for en1. Use ifconfig -a to find out what interfaces are available)

Now you have another IP that you can bring stuff up on that won't collide with other stuff running on the same port. 

This is in no way limited to Rails but we can use it to illustrate. Create a VIP for using the ifconfig command above. Then add a line to your /etc/hosts file as follows:  myapp

Now bring Rails up bound to that address on port 80:

$ cd devel/myapp
$ ./script/server -b myapp -p 80

http://myapp/ should now be on Rails.

The best of DZone straight to your inbox.

Please provide a valid email address.

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}