12
Can a server's eth & wifi share the same IP address?
(lemmy.world)
From Wikipedia, the free encyclopedia
Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).
Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word "Linux" in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.
Community icon by Alpár-Etele Méder, licensed under CC BY 3.0
It's perfectly possible on Linux to have several network adapters with the same IP address, or several default routes.
Most server applications will listen to 0.0.0.0 address, which means all network interfaces. Any incoming TCP connection will remember it's network interface, and the server will send responses to the same interface.
This will not work for UDP connections, and for outgoing TCP connections - they will always choose the network interface with the lowest metric, which you can print with
ip rcommand.This does not include advanced techniques like bridge or bonding or iptables routing - you need to run special commands in the terminal, which you cannot do just by clicking your mouse in system settings app.
Is it possible to configure interfaces this way? Yes.
Will it work? No, not without bonding, and not with WiFi as one of the interfaces.
Will UDP packets produce an error when sent or will they simply be received twice, potentially causing errors/issues?
Nope. The server receives UDP packet from WiFi and sends reply over Ethernet, which simply gets lost in your router. From the Linux side there's no error, it sent the packet somewhere, and what happens next is your router's problem.
That's the think about UDP packets... receipt isn't acknowledged as part of the protocol. It's send and forget. I'm not sure a UDP packet sent to my server would get lost but I'm not 100% certain there couldn't be situations where the packet is received by the server on both interfaces, essentially duplicated. It's been almost 30 years since I wrote programs that utilized UDP for communicating. I'm definitely a little rusty. 😄
Unless its rudp.