setfib with mpd - ifconfig on p-t-p link trouble

Julian Elischer julian at elischer.org
Sat Jun 28 22:39:59 UTC 2008


Julian Elischer wrote:
> serg vasilyev wrote:
>> Hi !
>> there's must be a restriction in ifconfig or in kernel that preventing 
>> from
>> adding a multiple p-t-p interface with same destination address.
>> i'm trying to build a test system with setfib and multiple mpd instances
>> which are creating PPPoE connection to same destination gateway and 
>> run into
>> problem with second p-t-p interface.
>> mpd did not add an IP and gateway for it
> 
> 
> this is a misunderstanding of what setfib does.
> You can only have one point to poitn interface with the same 
> destination  address.
> Having multiple routing tables does not automatically make it
> possible to have tow tunnels to the same place,
> (though theoretically maultipath routing might make this possible)
> because you still need to specify the remote address to specify
> the route's action. If you have multiple p2p links with the same
> remote address, you cannot specify which interface to use for a
> particular route.
> 
> 
>>
>> setfib 1 mpd1 -p /tmp/mpd1.pid -f mpd1.conf
>> sleep 2
>>  setfib 2 mpd2 -p /tmp/mpd2.pid -f mpd2.conf
>>
>> on a first interface ng0 i have both src ip and dst ip but on second i 
>> have
>> nothing
>>
>> # ifconfig ng0
>> ng0: flags=88d1<UP,POINTOPOINT,RUNNING,NOARP,SIMPLEX,MULTICAST> mtu 1492
>>         inet x.x.x.x --> y.y.y.y netmask 0xffffffff
>> # ifconfig ng1
>> ng1: flags=88d1<UP,POINTOPOINT,RUNNING,NOARP,SIMPLEX,MULTICAST> mtu 1492
>>
>> when i try to add ip's personally
>> # ifconfig ng1 z.z.z.z y.y.y.y
>> ifconfig: ioctl (SIOCAIFADDR) File exist
>>
>>  How to remove the given restriction on an ifconfig or kernel or 
>> something
>> else
>> P.S. Sorry for my english...
> you MAY be able to manually remove the link addresses from both
> routing tables after adding the first p2p link,
> and then add the second interface, and then
> remove the link address from the first fib,
> and add back the first link route from the first p3p link to teh first FIB.
> 
> but I have not tested this.
> 
> currently, adding an interface addres teh link layer route to ALL fibs, 
> leaving it up to the admin to remove them from the fibs he does
> not want them in. This was a decision I took but the other option would 
> have been to add it to only the 'current' fib, which would have
> been even more disruptive.
> 
> ok I tested this with gre tunnels:
> 
> ifconfig gre0 create
> ifconfig gre1 create
> ifconfig gre0 1.1.1.1 2.2.2.2
> # remove conflicting routes
> setfib -0 route delete 2.2.2.2
> setfib -1 route delete 2.2.2.2
> #now set up the second link
> ifconfig gre1 3.3.3.3 2.2.2.2
> # and remove the rotue we don't want
> setfib -0 route delete 2.2.2.2
> # and replace it with the one we DO want,
> # (or one that is equivalent)
> setfib -0 route add 2.2.2.2 -iface gre0
> 
> 
> wsa05:rjulian 34] ifconfig
> [...]
> gre0: flags=9011<UP,POINTOPOINT,LINK0,MULTICAST> mtu 1476
>         inet 1.1.1.1 --> 2.2.2.2 netmask 0xff000000
> gre1: flags=9011<UP,POINTOPOINT,LINK0,MULTICAST> mtu 1476
>         inet 3.3.3.3 --> 2.2.2.2 netmask 0xff000000
> 
> 
> wsa05:rjulian 35] setfib -0 netstat -rn
> Routing tables
> 
> Internet:
> Destination        Gateway            Flags    Refs      Use  Netif
> [...]
> 2.2.2.2            3.3.3.3            UH          0        0   gre1
> [...]
> wsa05:rjulian 36] setfib -1 netstat -rn
> Routing tables
> 
> Internet:
> Destination        Gateway            Flags    Refs      Use  Netif
> [...]
> 2.2.2.2            gre0            UGHS        0        0    gre0
> [...]
> wsa05:rjulian 37]
> 
> which would do what you want.
> now to make mpd know how to do that :-)

actually
setfib -1 route add 2.2.2.2 -iface gre0 -gateway 1.1.1.1
seems to do even better ..

wsa05:rjulian 6] setfib -1 route add 2.2.2.2  -interface gre0 -gateway 
1.1.1.1
add host 2.2.2.2: gateway gre0
wsa05:rjulian 7] setfib -1 netstat -rn
Routing tables

Internet:
Destination        Gateway            Flags    Refs      Use  Netif [...]
2.2.2.2            1.1.1.1            UHS         0        0   gre0
[...]
wsa05:rjulian 8]


> 
> 
>> _______________________________________________
>> freebsd-net at freebsd.org mailing list
>> http://lists.freebsd.org/mailman/listinfo/freebsd-net
>> To unsubscribe, send any mail to "freebsd-net-unsubscribe at freebsd.org"
> 
> _______________________________________________
> freebsd-net at freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-net
> To unsubscribe, send any mail to "freebsd-net-unsubscribe at freebsd.org"



More information about the freebsd-net mailing list