Route lookup problem

Hello,

I’m setting up a RouterOS instance on a virtual machine hosted on a dedicated server. My provider offers a feature to allow virtual machines to use public ip addresses. Basically, I need to bridge the VM’s interface to the host interface and use a provided public address. A gateway is not reachable from the “failover address” network, and VMs need to use the host default gateway.

For example (with fake private addresses):

The host network settings:

  • Address: 10.0.0.42/24
  • Gateway: 10.0.0.1

The VM network settings:

  • Failover IP: 10.10.0.100

On a linux VM, the configuration used is as follow:

  • ifconfig eth0 10.10.0.100/32
  • route add -host 10.0.0.1 dev eth0
  • route add default gw 10.0.0.1

And all is working fine.

On the RouterOS VM, a similar configuration does not work, the default gateway route doesn’t become “active”.

As said in the wiki, “Routes with interface name as the value of gateway are not used for nexthop lookup” [1], and I think this behavior is the cause of the problem. My questions: why the behavior seem to be different than Linux? How I can solve my problem?

Thanks by advance for your help!
Antoine.

[1] http://wiki.mikrotik.com/wiki/Manual:IP/Route#Nexthop_lookup

yep, it’s a ‘feature’ of routing implementation in RouterOS, as I was said on Europe MUM’2011… I hope they’ll rewrite routing basics in v6… at least… :frowning:

p.s. as a workaround, you can try

/ip address add address=10.10.0.100/24 network=10.0.0.1 interface=ether1
  • it should add more or less correct connected route to routing table, that WILL work for routing lookup for default route. but this is broken at least in last v5.x versions (upto 5.:sunglasses: - as I can see, you cannot change Network value in IP address…

got answer from support. yep, my suggestion is correct:

/ip address add address=10.10.0.100/32 network=10.0.0.1 interface=ether1
/ip route add gateway=10.0.0.1

it DOES work for /32 addresses

Hello,

Thanks for your reply, all is working fine now :slight_smile:!

Antoine.