APLawrence.com -  Resources for Unix and Linux Systems, Bloggers and the self-employed

Multiple IP addresses on one interface

My wife's XP machine gets very confused about my MacBook. Sometimes it thinks I'm at but sometimes it thinks "Macbook" is instead. I have no idea why it thinks this: I use a static address always and it doesn't change.. well, except maybe when I'm fooling around with something. Maybe that's when the poor XP gets confused.

Honestly, I feel sorry for it. There it is, the lone Windows machine on the network, surrounded by Linux and Mac boxes. It must get lonely. Oh, once in a great while I'll fire up Windows in a VM on the Mac, but that's rare and usually only lasts a few minutes at best. How would you feel if you were a little XP box, already burdened by a crappy OS and bloated anti-virus software and you were surrounded by happy, carefree Linux and Mac machines that get to do all the fun stuff? Maybe you'd "accidentally" forget a few IP addresses now and then, wouldn't you? Maybe sometimes you'd just feel so sorry for yourself that you'd dive down into your anti-virus software and just stay there, refusing to do anything else..

Of course that annoys my wife. "It can't find Macbook", she informs me, disappointment tinging her voice. I really believe that she thinks my Macbook is deliberately hiding from her machine. Perhaps it's a cruel game OS X enjoys tormenting XP with - "bet you can't find me.. look, I'm over here.. no I'm not!". And the Linux boxes stand off to the side laughing heartily while the bewildered little XP machine once again looks under the router and finds nothing but dust.

I took pity on it and decided to do something to help it out. As it mostly seems to think the Macbook has become when it actually has not, I felt that assigning both addresses to the box would help solve the problem. That's called an "alias" and is a fairly common need. For example, if we want to change the address of a server but a number of clients on the network are hardcoded with the old IP address, adding the old address as an alias solves the problem until we can get around to fixing up the clients.

Note that this can be done while renumbering a network. If your old network was and you are switching to 192.168.2,0, you can give the server its new address and put a alias on the same interface. The clients that haven't yet been switched to the new scheme will happily talk to the alias address.

However, it can be useful when consolidating functions also. I had a client with a file server and a mail server. The file server was at, the mail server was at The mailserver hardware died so we moved it to the machine. As some clients expected to find the mailserver at the 250 address, we simply added that as an alias.

Given the usefulness of this, you'd think it would be easy to do. Actually it is, but both OS X and Linux require that you do this at the command line. I find that particularly odd on OS X as the System Preferences Network Panel does allow you to create VLANS and bond multiple interfaces even on the ordinary client version. But adding an alias? Command line work.

For Linux, it's "ifconfig eth0:0". You could add another with "ifconfig eth0:1" and so on.

For OS X use " sudo ifconfig en0 alias netmask". Note that the netmask is necessary when you are adding an address that is on the same subnet as the first network address for the interface; if it's a different subnet you'd give the proper netmask.

Some Linuxes use a very similar syntax: "ifconfig eth0 --add alias", for example. The "eth0:0" seems to be the most common, though.

So, to help out my wife's XP, I added an alias for on the MacBook. I also added the command to /etc/rc.common so that it will survive reboots. On Linux, I'd put it in /etc./rc.local.

Even Windows XP can do this if you have set a static IP. Just click on the Advanced button in TCP/IP Properties and add under the "IP Settings" tab.

Got something to add? Send me email.

(OLDER)    <- More Stuff -> (NEWER)    (NEWEST)   

Printer Friendly Version

-> -> Multiple IP addresses on one interface


Increase ad revenue 50-250% with Ezoic

More Articles by

Find me on Google+

© Anthony Lawrence

Fri Mar 6 19:42:44 2009: 5618   BrettLegree

Perhaps this "problem" where XP gets confused and can't see Mac or Linux machines was injected by one of the myriad of patches that MS insists you apply but does not explain!

You click for "More Information" and it points you to a KB article that makes no sense at all...

Hmm. I'll have to see if my wife's Vista machine can see my Linux and OS X machines (as they all have static IP addresses too).

Sat Mar 7 23:07:56 2009: 5629   anonymous

Stale cache, my guess is that samba/netbios and that address were once in use, and XP never really seems to get those things sorted back out, I have seen XP refer to other XP machines, and report them in network browsing long after they are gone. I have had very little luck troublshooting this, other than if there's a Samba WINS server, and its configured to win master browser elections (this is pure smb/cifs/MS insanity as far as I am concerned) then these problems go away and stay away, other than that any Windows administrator will tell you how to deal with these problems... refer to the machine by IP instead of name. I have often thought that a nice *nix/Samba box deployed as a router (nat if you need it), handling both LAN DNS and WINS would make a Windows network manageable enough for your standard Windows administrator. If you find these stale references on the XP machine I am extremely interested in where, they seem to persist across network changes (reconfiguring/removing network cards) and reboots, and I've not found them any place I would expect them, like in the registry (although there's another issue with sql servers and the registry ...) or the hosts file, and they don't seem to go away by flushing the dns cache.

Sat Mar 7 23:50:10 2009: 5630   TonyLawrence

The necessity to "fix" Microsoft stupidity by using ip addresses is unfortunately often necessary.. they are such idiot programmers it defies belief.

Mon Nov 22 14:55:39 2010: 9128   anonymous


Nice blog. I have a question. I have two IP addresses and each one operates on a separate VLAN. I want to use the single bond0 to do this. Suggestions?

Mon Nov 22 15:40:49 2010: 9129   TonyLawrence


I am not sure you can. Doesn't the VLAN work from MAC addresses?

Kerio Samepage

Have you tried Searching this site?

Unix/Linux/Mac OS X support by phone, email or on-site: Support Rates

This is a Unix/Linux resource website. It contains technical articles about Unix, Linux and general computing related subjects, opinion, news, help files, how-to's, tutorials and more.

Contact us

Any inaccuracies in this index may be explained by the fact that it has been sorted with the help of a computer. (Donald Knuth)

This post tagged: