Hi all.
I have this network:
My IP: 10.0.0.50/32
My Default gateway: 10.0.0.1/32
The problem is that the 0.0.0.0 route is unreachable.
I cannot change my ip to 10.0.0.50/24 because 10.0.0.20 is not connected with me.
I must use the gateway.
On linux i used this:
ip addr add 10.0.0.50/32 dev eth0
ip link set eth0 up
ip route add 10.0.0.1/32 dev eth0
ip route add default via 10.0.0.1
The problem is that your gateway address must fall inside the network. Put the 10.0.0.50/24 back in. Point your default route to 10.0.0.1.
It doesn’t matter that 10.0.0.20 is not connected with you. To handle that exception, set a specific /32 route for that address which will take precedence over the /24 route.
I can’t believe this could possibly work. If it did, then there is a lot of “understanding” given in the linux system you are using. The fact is that interface routing on anything other than a tunnel is incorrect. Even if it works, does not make it the right way to do things. I’ve explained this in my blog here: http://blog.butchevans.com/2008/07/mikrotiks-interface-routing-option/
You SHOULD do as Tom suggested:
/ip address add address=10.0.0.50/24 interface=ether1
/ip route add gateway=10.0.0.1
/ip route add dst-address=10.0.0.20/32 gateway=10.0.0.1
I’m not certain that will work, but it’s worth a shot. Another thing to think about is fixing the network design that put you in this situation in the first place. What you are describing should not happen with a proper design.