T
T
tugo2021-07-14 21:16:16
linux
tugo, 2021-07-14 21:16:16

Which component in linux decides on which interface to connect to an IP address?

Good afternoon!

Help to understand or find the ends, about what to read.

I have a linux computer (raspberry pi 4 with raspbian if that matters).
It is connected to the Internet via LAN, Wi-Fi and an external 4G modem (well, more theoretically). These devices may fall off randomly - there is no 4G connection, the wi-fi environment is overloaded, or the cable or modem simply has not been inserted.

Which component in linux decides through which device to contact an ip address?
What happens if there is a connection to the router via LAN, but there is no access to the Internet? And through the 4g modem there is. How will this component choose which interface to communicate through? Or is it necessary to somehow interrogate (control) communication devices in hand-to-hand mode and establish communication through a specific device?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
res2001, 2021-07-15
@tugo

All routing is hardwired into the logic of the TCP/IP stack. Managed by the routing table. The default route entry in the routing table is responsible for Internet access. There can be several such routes with different metrics (priorities). The route with the highest priority is used.
There can also be several routing tables - this is an option just for a situation where there are several channels to the Internet and you need to do load balancing or failover (or a hybrid scheme). With the help of competent firewall settings and additional scripts, you can organize all this. You will have to do this yourself, or use third-party software / hardware. But there are tools for such things.
If the Internet is not available on a given route, then the packets will still be sent and will disappear somewhere. So there will be no answers or there will be an answer with an error. Connections will fall off either by timeout or by mistake.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question