Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 4 May 2018 00:23:20 -0700
From:      Doug Hardie <bc979@lafn.org>
To:        Arthur Chance <freebsd@qeng-ho.org>
Cc:        Nick Garrido via freebsd-questions <freebsd-questions@freebsd.org>
Subject:   Re: UDP packet transmission
Message-ID:  <DF5ACD55-5F2F-4742-8E27-03F90279BC48@mail.sermon-archive.info>
In-Reply-To: <3e93f140-af24-fba0-65f2-70c772a338f8@qeng-ho.org>
References:  <91591EE5-91EA-4C79-BE7B-A5F9F53CFADA@mail.sermon-archive.info> <3e93f140-af24-fba0-65f2-70c772a338f8@qeng-ho.org>

Next in thread | Previous in thread | Raw E-Mail | Index | Archive | Help

> On 4 May 2018, at 00:03, Arthur Chance <freebsd@qeng-ho.org> wrote:
>=20
> On 04/05/2018 05:05, Doug Hardie wrote:
>> I have a somewhat unusual situation and have not found a solution for =
it.  I have a remote machine running 12 current.  It has two independent =
internet connections.  They are from two different sources and have =
different IP addresses.  One is a fixed IP address and the other =
dynamic.  The purpose is to be able to access the device if one of those =
interfaces is down.  It is only accessed when problems occur.  Typically =
that is when the fixed address is not accessible.  The problem is there =
is no way to know the dynamic address.
>>=20
>> To address this, I tried sending a UDP packet through the dynamic IP =
link to another machine at a fixed IP address.  It records the IP =
address that originated the packet and logs it.  Hence, I can easily =
find the last dynamic IP that was used and access the device through =
that.  However, to make that happen, I need to be able to send a UDP =
packet that goes through a specific interface and does not use the =
routing table.
>>=20
>> The most frequent approach I have found is to bind the socket to only =
the dynamic IP address's interface.  However, that does change the =
originating IP address in the packet to that interface, but continues to =
transmit via the interface found in the routing table.
>>=20
>> Another suggestion was to use raw sockets.  However, all the reading =
on that (Stevens et al) indicate that the packet will still be =
transmitted on the interface selected in the routing table.
>>=20
>> Yet another suggestion was to change the routing table temporarily, =
send the packet, and then change it back.  Besides a lot of potential =
for weird stuff, it would break a number of other connections going =
through the fixed IP address. =20
>>=20
>> I am hoping there is another solution that would be better.  Thanks,
>=20
> Why not use setfib to give the UDP packet sending process its own
> routing table?

Never encountered that before.  Great solution.  Thanks,


-- Doug





Want to link to this message? Use this URL: <http://docs.FreeBSD.org/cgi/mid.cgi?DF5ACD55-5F2F-4742-8E27-03F90279BC48>