Thursday, November 20, 2008

Adding a new IP Address in Mac OSX

Theres a simple way to add a new IP address. In my case, I need to handle multiple virtual hosting & lots of load balancing.

Heres a neat way:

ifconfig [E] alias [NEW IP ADDRESS] netmask 255.255.255.255

eg.

ifconfig en0 alias 10.1.1.11 netmask 255.255.255.255

If you need to have a dedicated hostname to a IP address, then edit /etc/hosts

add a new line

[IP ADDRESS] [HOSTNAME]

Remember to press TAB to separate the IP address and the hostname.

eg

127.0.0.1 coolness.com

Have fun.

No comments: