Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 2 Apr 2003 11:35:32 -0600 (CST)
From:      "Martin A. Brown" <mabrown-linux-net@securepipe.com>
To:        Sashikiran Rachakonda <sashi@cs.pdx.edu>
Cc:        divert@list.anr.mnc.org
Subject:   Re: Question Regarding IP Alias
Message-ID:  <Pine.LNX.4.53.0304021123380.12610@gargoyle.wi.securepipe.com>
In-Reply-To: <Pine.GSO.4.21.0304020904190.8707-100000@sirius.cs.pdx.edu>
References:  <Pine.GSO.4.21.0304020904190.8707-100000@sirius.cs.pdx.edu>

next in thread | previous in thread | raw e-mail | index | archive | help
Under linux, it is not difficult to accomplish this:

# ip link set dev $DEV up
# ip addr add dev $DEV w.x.y.z/24
# ip addr add dev $DEV p.q.r.s/16
# ip route add $DESTINATION via $GATEWAY src p.q.r.s

If an application requests the use of IP address w.x.y.z, there is no way
for the routing code to select the preferred address, but if the
application leaves the source address selection to the kernel, you can use
the "src" parameter as indicated above.

See the iproute2 manual (ip-cref) for a more detailed description of the
source address selection process.  This is HTML output of the TeX source
which is included in the iproute2 distribution.

  http://linux-ip.net/gl/ip-cref/node155.html

And for the record, while linux continues to provide backward compatible
support for traditional IP aliases (eth0:0, eth0:1), these are merely
conventions for representing the IPs which are available on a given
interface.  To see a list of the IPs available on a given interface, you
should use:

# ip addr show dev $DEV

So, Sashi, why did you cross-post this on freebsd and linux lists?  Which
are you using?  Naturally, your use of the "xl0" interface name suggests
that your example is a BSD box.

Good luck with your problem,

-Martin

 : Hi,i have a question regarding the IP Alias. If i bind my interface to 2
 : ip addresses say
 :
 : 		1) ifconfig xl0 add w.x.y.z netmask 255.255.255.0
 : 		2) ifconfig xl0 add p.q.r.s netmask 255.255.0.0
 :
 : Is there a way that i can force the packets coming-out of this interface
 : to have ipSrc = p.q.r.s and not w.x.y.z. My question is is there a way
 : that you can tell the interface to have the IPsrc set to the one we want
 : to, for all packets coming out of this interface.
 :
 : Thanx in Advance,
 : --Sashi.
 :
 :
 :
 : -
 : To unsubscribe from this list: send the line "unsubscribe linux-net" in
 : the body of a message to majordomo@vger.kernel.org
 : More majordomo info at  http://vger.kernel.org/majordomo-info.html
 :

-- 
Martin A. Brown --- SecurePipe, Inc. --- mabrown@securepipe.com



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.LNX.4.53.0304021123380.12610>