I'm wondering if I understand routing correctly?

The context is that I have a Mikrotik AP with a USB LTE modem plugged in. I'm looking at the routing section in the router settings. It's all default configuration. The router has an external IP address of 192.168.1.106, and an internal IP address of 192.168.50.1.

The first route is that everything destined for 0.0.0.0, so the wider internet, has to go through 192.168.1.1, so the internet gateway.

The last route is for internal traffic, everything destined for an address in the .50 subnet goes through bridge.

But what is the difference between the first sand second route?

#networkingtools #mikrotik
@stfn I'm not a networking expert. But it looks like the modem has a 192.168.1.0/24 subnet, so anything for .1 goes through that? I'm guessing without the 2nd one, nothing would be able to find 192.168.1.1.
@adam @stfn Or, if the modem shows the same IP on multiple interfaces, it wouldn't have a rule to choose which interface to use (AFAIK it'd use all, then, which isn't efficient).
@skolima @adam @jpl @the_purple_nightmare @blotosmetek

So, the first route says "in order to go to the internet, go through 192.168.1.1" and the second route says "in order to go to 192.168.1.0/24, so e.g. 192.168.1.1, go through the lte1 interface".

So any packet coming from my phone at 192.168.50.254 to the internet goes through the bridge, wants to go to 192.168.1.1 and in order to reach that address, it's directed through the lte1 interface.
@stfn @skolima @adam @jpl @blotosmetek exactly that. That's the reason why one exists on your bridge for 192.168.50.0/24. If a packet gets to your router with a destination in that subnet, it knows to leave via the bridge interface.

Anything where the subnet is not known directly by the router needs the next hop (i.e 192.168.1.1) to be resolvable by an interface that is directly connected
@the_purple_nightmare @skolima @adam @jpl @blotosmetek hmmm, right, thanks. I think what I find confusing is the mix of IP addresses and interface names.
@stfn @the_purple_nightmare @skolima @adam @jpl it gets even more complicated when you have multiple IPs on the same interface…
@stfn @skolima @adam @jpl @blotosmetek if you think of it more like

- Routes with an IP as a next hop need to find the interface with that IP
- Routes with an interface as a next hop already know the interface

Next hop resolution can have multiple steps, but the last step must be to resolve to an interface, otherwise the router doesn't know where to physically send the packet.

Bear in mind you could have routes where the next hop is not directly connected to the router. For example

0.0.0.0/0 via 192.168.2.1
192.168.2.0/24 via 192.168.1.1
192.168.1.0/24 via lte

The default route is still valid, but it had to resolve the next hop twice to find out which interface this is on. You'll see this happen more with routing protocols and dynamic routing, but it is possible to do this with static routes too
Manual:Using scope and target-scope attributes - MikroTik Wiki

@adam @stfn Exactly, the second route is necessary for the first one to work.
@stfn the second is what's called a "direct" route, in that 192.168.1.0/24 is directly connected to the LTE interface.

This is due to something called next hop recursive lookup. 0.0.0.0/0 goes via 192.168.1.1. Without the "direct" route, any lookup for 192.168.1.1 would go nowhere, because the routing table doesn't know anything about that route.

Generally this is how all routing works, in that all a router does is send traffic out via an interface. Whether the destination for that packet is directly connected, or via another router doesn't change that.
@the_purple_nightmare thanks again! Once I'm back home from holidays, I will try to re-create that from scratch on a different router to make sure I understand it correctly
@stfn The second route is the "connected" route of the lte1 interface, which says that 192.168.1.0/24 is directly connected to the interface. The first route says that the whole Internet can be reached via 192.168.1.1 - a host directly connected to lte1, according to the second.