Return to BSD News archive
Path: euryale.cc.adfa.oz.au!newshost.anu.edu.au!newshost.telstra.net!act.news.telstra.net!psgrain!usenet.eel.ufl.edu!gatech!swrinde!howland.reston.ans.net!agate!sklower From: sklower@oboe.CS.Berkeley.EDU (Keith Sklower) Newsgroups: comp.unix.bsd.freebsd.misc Subject: Re: Multiple IP Addresses on same Machine Date: 27 Feb 1996 02:37:06 GMT Organization: University of California, Berkeley Lines: 35 Message-ID: <4gtqoi$f3q@agate.berkeley.edu> References: <312D11C8.41C67EA6@telstra.net> NNTP-Posting-Host: oboe.cs.berkeley.edu In article <312D11C8.41C67EA6@telstra.net>, Wayne Farmer <wayne@telstra.net> wrote: }AS I had posted on this subject previously, I thought I would add }something that does not appear to have been included in other comments }on the subject. } }To add another IP address, do the following : } }ifconfig "network_interface" inet a.b.c.d netmask 255.255.255.255 alias }route add route add a.b.c.d localhost } }where network interface is ed0, ep0 etc. } }The 255.255.255.255 is required if you wish to talk to yourself using }that IP address (e.g. web serving multiple virtual domains) Not True! The "route add a.b.c.d localhost" is what makes you able to talk to yourself. Specifying a netmask of all ones lets you avoid an error message by puting in a bogus entry in the routing table, which will never be matched by anything, and could possibly confuse the arp code. If you leave out the netmask you may get an error message saying "File Exists", but what's happening is that the second ifconfig can't add a route to the routing table because there's already an implied route for the same high order bits, but that's actually OK. I agree that it would be better if the ifconfig command were smarter and didn't report the EEXIST error to the user and did the localhost hack for you, or better yet, somebody fixes the bug that requires it. (Haven't had time to track that one down yet.) }Most previous answers have omitted the netmask. With good reason!