Why I cannot ping the ip after I bridged them?

Posted on

Problem :

I made my raspberry pi into a router.

The eth0 is connected with internet, while the wlan0 is served as an accessible point.

So I created a br0, then addif both eth0 and wlan0 to br0. Started dhcpd(so that my phone can get ip from the wlan0) and hostapd. Everything works fine I got internet on my phone from wifi connection with the raspberry pi.

But, I cannot ping the pi with either the wlan0 IP or the eth0 IP. I noticed I got a IP in the same sub net of the eth0. But still, I cannot ping it.

why?
Or is there still a way that I can ping two of them? I know iptables would be an option. But just curious if it’s doable with bridge.

Solution :

I made my raspberry pi into a router.
I created a br0, then addif both eth0 and wlan0 to br0.

That’s not a router. (It’d be a router if it linked two networks together, but right now you have a bridge – which means same subnet on both sides.)

Started dhcpd and hostapd

Somewhat concerned about this – is your Raspberry Pi the only DHCP server in the LAN, or did you accidentally set up a 2nd one?

But, I cannot ping the pi with either the wlan0 IP or the eth0 IP.

When you turn eth0 and wlan0 into bridge ports, they become nothing more than bridge ports. They no longer speak IP even if configured.

Instead, you need to set up the same IP address on the bridge interface br0 (and can remove all addresses from the “port” interfaces).

After adding the bridge, you can no longer ping. You need to check route -n. And then delete the entry of the interface that has been bridged. Once that entry is deleted, you can ping ok. Here is an actual demo in virtualbox: Two Virtualbox Machines Using Host-Only-Adapter. The key command is:

route del -net 192.168.3.0 gw 0.0.0.0 netmask 255.255.255.0 dev enp0s8

Leave a Reply

Your email address will not be published. Required fields are marked *