Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Setting up a multihoming ethernet network Network
Not sure if this has been reported before....

In OS X it is possible to assign more than one IP address to a single ethernet card. You might use this for instance if you wanted to use one IP as an external (public) IP and another as an internal-only secure IP for admin or whatever your needs are.

I was trying to do this via the Terminal in the same way it is done in other Unix variants. That method is:
 % ifconfig eth0:2 192.168.1.132 up
However, it's even easier in OS X. I cannot take credit for discovering this though - it is listed in an article at AFP548.

Let's say you currently have your machine IP set to 192.168.1.100 and you want to add a virtual IP address of 192.168.1.101 so both IP's point to your machine.
  1. Open Network Preferences pane.
  2. Selct "Active Network Ports" from the "Show" pull-down menu. Highlight your ethernet interface and hit the duplicate button.
  3. Configure the NEW ethernet interface with IP 192.168.1.101 and the other items as desired. The article at AFP548 states you should use netmask 255.255.255.255 or you will run into trouble. I ignored that and used my standard 255.255.255.0 and other items the same as my original IP.
Now point your web browser to 192.168.1.101 and it should access your machine via the new interface. Modify your Apahce prefs a bit with virtual servers (search "virtual server" here at macosxhints) and you can point everything going to your new interface at 192.168.1.101 to go wherever you want.
    •    
  • Currently 4.33 / 5
  You rated: 4 / 5 (3 votes cast)
 
[9,938 views]  

Setting up a multihoming ethernet network | 4 comments | Create New Account
Click here to return to the 'Setting up a multihoming ethernet network' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Why your ifconfig wasn't working
Authored by: drsmithy on Sep 19, '02 08:22:40PM
ifconfig eth0:2 192.168.1.132 up

You were having trouble with this because the syntax is wrong for a BSD (ie: OSX). The command you would need for OSX would be something like:

ifconfig en0 alias 192.168.1.132 netmask 255.255.255.255

The article at AFP548 states you should use netmask 255.255.255.255 or you will run into trouble. I ignored that and used my standard 255.255.255.0 and other items the same as my original IP.

The netmask you should use "depends". If the additional IP you are adding is on the same network as the existing IP, then the netmask should be 255.255.255.255. If the IP is on a different network (eg, if you were adding something like 10.0.0.1 as an alias) then you should use whatever the netmask for that network is. Additional IPs added on that network would use an IP of 255.255.255.255. This is the "right" way to do it, although many ifconfig commands will accept "wrong" netmasks. However, if you look at the output of an "ifconfig interface" command, you will probably find the netmask has been automatically set to 255.255.255.255 anyway.

[ Reply to This | # ]

Why your ifconfig wasn't working
Authored by: dfbills on Sep 27, '02 12:52:36AM

I'm having trouble figuring out exactly how to use Multiple Network Interfaces with Multiple Networks.

What I have:

Ethernet Interface to Cable Modem (public internet namespace)
Dialup Interface to Corporate Network (private intranet namespace)

I can get each to work individually, but when both interfaces are active, only the top one in the network interfaces panel is working.

Is it possible to get these both working simultaneously? How do I know what netmasks to use? (I'm guessing this is the issue.)



[ Reply to This | # ]
Why your ifconfig wasn't working
Authored by: bluehz on Sep 27, '02 08:17:39AM

I had no problems getting this to work EVEN with the wrong netmask. Do you have a firewall in place blocking your new ip?



[ Reply to This | # ]
Why your ifconfig wasn't working
Authored by: getcalf on Sep 27, '02 08:30:22AM

Does anyone have any information of Etherchannel on 10.2 and 10.2Server. Also, is it possible to have two network cards in one Mac with different protocols being served out on the same network?

Thanks



[ Reply to This | # ]