When hosting some web services, it really makes sense to sometimes to have more than one IP on a machine. This is extremely useful when using SSL certs and you want to have IP-based virtual hosting.
On the Mac, this is very easy. All you have to do is
- Go to System Preferences -> Network.
- Select Network Port Configurations from the Show menu.
- Select the interface you want to add the extra IP to (for example, Built-in Ethernet), and click Duplicate.
- Now you can name it something like ‘Built-in Ethernet .YYY’ for your other IP.
- Hit apply.
- Now, in the Show menu, select the new port config you just made.
- Make your changes, and hit apply.
- Your done!
- Go to the /etc/sysconfig/network-scripts/ directory
- Copy the interface file that you want to add the IP to, and give it the same name as the current file, with ‘:0’ added (or :1, :2, depending on how many IPs are on this interface).
cp ifcfg-eth0 ifcfg-eth0:0
- Edit the new file, and you only have to change a few things
- Change IPADDR= to your new IP address
- Change DEVICE= to add :0 (depending if this is the 2nd IP on that interface)
- remove DHCP_HOSTNAME (or set it to what it needs to be)
- remove the HWADDR entry
- Save the file that you just were working on
- Restart the network interfaces
Listening To: ‘March of the Pigs’ by NIN