Florian helped me off-list:
# route add 10.1.1.13 -iface -cloning 10.2.2.13
does the trick (if you do the same on the other end, of course).
I'm not really sure how this works, or what RTF_CLONING means other
than this comment from the manpage:
-cloning RTF_CLONING generates a new route on use
So .. uhm .. magic! :-)
Anyway, thanks to Florian!
Paul
On Mon, Mar 08, 2021 at 05:10:16PM +0100, Paul de Weerd wrote:
| Hi all,
|
| I'm probably missing something rather obvious, but I can't get route
| -iface to work. According to the manpage:
|
| If the destination is directly reachable via an
| interface requiring no intermediary system to act
| as a gateway, the -iface modifier should be
| specified; the gateway given is the address of this
| host on the common network, indicating the
| interface to be used for transmission.
|
| I'm trying to get this to work on some 'real' system, but reproduced
| on a couple of VMs to rule out other factors. I have two VMs on the
| same host, connected by the same veb(4). Connectivity works if I use
| IP addresses in the same subnet (i.e. I can ping from 10.0.0.1/24 to
| 10.0.0.2/24 if that's what I configure).
|
| On one side I have:
|
| test1# ifconfig vio0 10.1.1.13/24
| test1# route add -iface 10.2.2.13 10.1.1.13
| add host 10.2.2.13: gateway 10.1.1.13
|
| On the other side, I have:
|
| test2# ifconfig vio0 10.2.2.13/24
| test2# route add -iface 10.1.1.13 10.2.2.13
| add host 10.1.1.13: gateway 10.2.2.13
|
| However, pinging from test1 to test2 gives:
|
| test1# ping -c 1 10.2.2.13
| PING 10.2.2.13 (10.2.2.13): 56 data bytes
| ping: sendmsg: Invalid argument
| ping: wrote 10.2.2.13 64 chars, ret=-1
|
| --- 10.2.2.13 ping statistics ---
| 1 packets transmitted, 0 packets received, 100.0% packet loss
|
|
| Yet the route is there:
|
| test1# route get 10.2.2.13
| route to: 10.2.2.13
| destination: 10.2.2.13
| mask: 255.255.255.255
| interface: vio0
| if address: 10.1.1.13
| priority: 8 (static)
| flags: <UP,HOST,DONE,STATIC>
| use mtu expire
| 5 0 0
|
|
| What am I doing wrong here? The destination *is* directly reachable
| via an interface and the gateway given is the IP address of "this
| host" on the common network, just as required by the manpage. At
| least, my read of it .. since it doesn't work, I'm probably
| misunderstanding something here.
|
| I've enabled forwarding (net.inet.ip.forwarding=1) and disabled pf to
| test if they were causing grief, but neither helped. Anyone have a
| cluebat for me?
|
| Thanks,
|
| Paul 'WEiRD' de Weerd
|
| --
| >++++++++[<++++++++++>-]<+++++++.>+++[<------>-]<.>+++[<+
| +++++++++++>-]<.>++[<------------>-]<+.--------------.[-]
| http://www.weirdnet.nl/
|
--
>++++++++[<++++++++++>-]<+++++++.>+++[<------>-]<.>+++[<+
+++++++++++>-]<.>++[<------------>-]<+.--------------.[-]
http://www.weirdnet.nl/