Create VIPs On Mac OSX
Join the DZone community and get the full member experience.Join For Free
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 192.168.1.130 netmask 255.255.255.255 aliasCreate a VIP on a different subnet:
# ifconfig en1 inet 192.168.64.25 netmask 255.255.255.0 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 192.168.1.150 using the ifconfig command above. Then add a line to your /etc/hosts file as follows:
192.168.1.150 myappNow bring Rails up bound to that address on port 80:
$ cd devel/myapp $ ./script/server -b myapp -p 80http://myapp/ should now be on Rails.
Opinions expressed by DZone contributors are their own.