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
Thanks for the reply. They seem to both be active. I don't have iftop but tcpdump shows traffic on both, though much less on the wifi connection.
ip route shows:
I really didn't think I'd be allowed to statically assign the same IP address to both interfaces, and surprisingly it seems to be working ok. I'm just wondering what I don't know that's going to bite me :)
The "metric 600" on your Wi-Fi adapter indicates to the system that it is a higher cost route than your Ethernet one. So the IP stack will prefer sending packets out via the Ethernet port.
Local devices who haven't heard from you lately will send to whatever device gives them a response to their ARP ("who has IP address X?") request first, and seeing as Ethernet is lower latency than WiFi, they will mostly use your Ethernet adapter as their target when sending data to you.
Devices that have received data from you already will have the MAC address of your Ethernet adapter in their ARP table, so they'll just send packets to that without bothering to issue an ARP request.
Devices off your subnet talk to your router, so they don't care about your MAC address, they'll just use IP to talk to your router, who will then do the ARP request and hand the packets on to your computer via whatever interface answers first.
Thanks for the detailed explanation. Has this always been possible though? Was I just imagining that manually assigning to network adapters the same ip address wasn't possible?
It's often not possible on other operating systems. Especially the consumer versions of a certain operating system starting with "W", that system will refuse to have duplicate IPs.
But essentially it's always been possible (but, probably not preferred these days) to have redundant routes/paths on Unix systems. The way you have it now is more of a side effect of being able to do more complex network setups, like using different interfaces to talk to different subnets, or using a slow link as a backup to a fast link.
With your current setup you should get a slow failover ability, for example if you ping some other device and then unplug your Ethernet cable, you'll have a bit of a pause in replies and then they will start again as the stack switches to the other link.