Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 17 Mar 2011 17:06:11 +0200
From:      Georgi Iovchev <freebsd@pulsar.bg>
To:        freebsd-net@freebsd.org
Subject:   Re: select default outgoin IP for adapter with multiple ips, may be bug
Message-ID:  <1979209159.20110317170611@pulsar.bg>
In-Reply-To: <alpine.BSF.2.00.1103161409310.6104@ai.fobar.qr>
References:  <1786430936.20110316151336@pulsar.bg> <alpine.BSF.2.00.1103161409310.6104@ai.fobar.qr>

next in thread | previous in thread | raw e-mail | index | archive | help

   >>= ; Hello.
   >> I am having some troubles configuring adapter with multiple ips, >>
   And I believe I have found a bug.
   >> The explanation is a bit long... Here it is:
   >> XX.YY.2.33/30 at ISPs side used as my default gw
   >> XX.YY.2.34/30 at my side
   >> I have network XX.YY.95.0/24 routed to me
   >> I dont have internet on XX.YY.2.34, but I have on XX.YY.95.0/24
   >> I am trying to configure adapter vlan199 conected to ISP
   >> to use ip XX.YY.95.1 as default ip (src-address) for outgoing traf=
   fic.
   >> I expected that when I add XX.YY.95.1 as first IP and XX.YY.2.34 a=
   s second it will be ok.
   >> But the order does not matter - XX.YY.2.34 is always used as outgo=
   ing IP.
   >> When I ping google.com .. I dont get replies,
   >> but when I ping -S XX.YY.95.1 google.com - I get replies.
   >> Here is the only way that I have found to select XX.YY.95.1 as def=
   ault outgoing address:
   >> add XX.YY.95.1/32 on the adapter,
   >> create static route to my default gw (XX.YY.2.34),
   >> create default route,
   >> add the other ip to the adapter.
   >> ifconfig vlan199 create
   >> ifconfig vlan199 vlan 199 vlandev fxp0
   >> ifconfig vlan199 up
   >> ifconfig vlan199 XX.YY.95.1/32
   >> route add -host XX.YY.2.33 -iface vlan199
   >> route add default XX.YY.2.33
   >> ifconfig vlan199 add XX.YY.2.34/30
   >> But drawback is that I cannot achieve such order in rc.conf.
   >> (add ip then routes then again ip)
   >> The other problem is that if delete the default gw and add it agai=
   n,
   >> or change it to the same one, then the default outgoing ip resets =
   to XX.YY.2.34.
   >> This is why I think that there is someting wrong,
   > Right, the order you add IPs and routes shouldn't matter.  I wond=
   er
   > why it does.
   >> may be bug may be I am doing it wrong I dont know.
   >> I have tried this on FreeBSD 8.2-RELEASE.
   >> I believe on older freebsd versions the default outgoing ip for ad=
   apter
   >> is the one at the top from ifconfig adapter.
   > FreeBSD since 7.2 has been doing "more proper" source address
   > selection for unbound outgoing connections.  The solution is call=
   ed
   > bind.  Another solution to try might be setfib(8).
   > /bz
   Thanks. But this is not a good solutio= n for me.
   I have tried the above example on FreeBSD 8.1-RELEASE box and the
   behaviour= is the same.
   May be it is kind of feature.
   Georgi Iovchev



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