5

I am running Arch Linux (on a Raspberry Pi 3) and tried to connect both the Ethernet and the Wi-Fi to the same network. route shows me the following:

$ route
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
default         gateway         0.0.0.0         UG    1024   0        0 eth0
default         gateway         0.0.0.0         UG    1024   0        0 wlan0
192.168.1.0     0.0.0.0         255.255.255.0   U     0      0        0 eth0
192.168.1.0     0.0.0.0         255.255.255.0   U     0      0        0 wlan0
gateway         0.0.0.0         255.255.255.255 UH    1024   0        0 eth0
gateway         0.0.0.0         255.255.255.255 UH    1024   0        0 wlan0

ip addr shows me the following:

$ ip addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether b8:27:XX:XX:XX:XX brd ff:ff:ff:ff:ff:ff
    inet 192.168.1.103/24 brd 192.168.1.255 scope global dynamic eth0
       valid_lft 85717sec preferred_lft 85717sec
    inet6 fe80::ba27:ebff:fee4:4f60/64 scope link
       valid_lft forever preferred_lft forever
3: wlan0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether b8:27:YY:YY:YY:YY brd ff:ff:ff:ff:ff:ff
    inet 192.168.1.102/24 brd 192.168.1.255 scope global dynamic wlan0
       valid_lft 85727sec preferred_lft 85727sec
    inet6 fe80::ba27:ebff:feb1:1a35/64 scope link
       valid_lft forever preferred_lft forever

Both wlan0 and eth0 interfaces were able to get an IP address from the router.

But it turns out that only one of these interfaces ever works. The other interface cannot be pinged and is not connectable. Usually it's the Ethernet that works but sometimes it's the Wi-Fi.

What's happening? What can I do to make this work?

  • I assume IPv4? It works on my Ubuntu desktop after ARP starts working. What address are you pinging from? What address are you pinging? What does arp show on each side. What does tcpdump -i <interface> -v arp show on all relevant interfaces on both sides? Can you get a packet capture on the switch/router? – Mikel Apr 29 '17 at 16:25
  • Yes, I'm using IPv4. I'm pinging192.16.1.103 and 192.168.1.102, the two IP addresses assigned. – rityzmon Apr 29 '17 at 16:27
  • From another machine on 192.168.1.0/24? Please add arp output to your question. – Mikel Apr 29 '17 at 16:28
  • 1
    See also lwn.net/Articles/45373 – Mikel Apr 29 '17 at 16:36
4

As you have found out, from the routing perspective, while possible, it is not ideal to have addresses from the same network in different interfaces.

The routing expects a different network per interface, and ultimately one of them will take precedence over the other in routing, since they overlap.

The advised solution for having more than one interface connected to the same network is to aggregate them together in a bridge interface.

The bridge interface will "own" the IP address, and the actual real interfaces are grouped as a virtual single entity under br0.

allow-hotplug eth0
iface eth0 inet manual

allow-hotplug wlan0
iface wlan0 inet manual

auto br0
iface br0 inet dhcp
    bridge_ports eth0 wlan0

Debian Linux: Configure Network Interfaces As A Bridge / Network Switch

  • But still with the bridge, in most topologies, only one of them will wind up getting used because the other one will be shut down by spanning tree — or if spanning tree is turned off then you will have a devastating loop in the network. – Celada May 1 '17 at 8:55
  • @Celada They end up being a single entity, and work quite well. I have had such setup working for years to create a single entity out of my wireless and cabled network at home to be able to stream from wireless to my Apple TV (in the wired network), and it works beautifully. – Rui F Ribeiro May 1 '17 at 9:02
  • it talks stp by default, at home my switch is not smart enough to understand it. – Rui F Ribeiro May 1 '17 at 9:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.