Why I cannot ping the ip after I bridged them?

8,427

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).

Share:
8,427

Related videos on Youtube

J.R.
Author by

J.R.

Software engineer

Updated on September 18, 2022

Comments

  • J.R.
    J.R. over 1 year

    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.

    • Frank Thomas
      Frank Thomas over 6 years
      you can't ping it from a wired or wireless device? if wireless, did you configure IPTables for "Client Isolation"?
    • Daniel B
      Daniel B over 6 years
      So, just to clarify: You have a working wired network. You want to allow your phone access to the internet via this existing network. To that end, you’re trying to make your Pi into a wireless access point. Correct?
    • J.R.
      J.R. over 6 years
      @DanielB Yes. I have already done it followed some instructions. But I am not very sure with the bridge and do not understand why I cannot ping these two ports
    • Daniel B
      Daniel B over 6 years
      If you followed a guide, please provide a link if possible! As for the bridge ports: See grawity’s answer. He’s got that topic covered.
  • J.R.
    J.R. over 6 years
    Hey I edited my question for some of your points. So the dhcpd on the pi is for the phone that connected with the pi via wifi. There's another dhcpd on the LAN for the eth0 port, this dhcpd runs on the real router. I got it, so after the bridge is done. The IP of eth0 and wlan0 do not have any meaning. And I can just assign a ip to the wlan0 and ping it from my phone? But in this case as I said, my phone got a address that are in the same subnet of the eth0. So I probably can only ping the br0 if its ip is set as a ip in the same subnet?
  • user1686
    user1686 over 6 years
    A bridge does not divide subnets. (That's why it's called a bridge!) If your eth0 was in the 192.168.1.x subnet, and you bridged it to wlan0, then br0 will be in the same subnet, and your Wi-Fi will be in the same subnet as well. You do not need a 2nd DHCP server for Wi-Fi, because you already have one.
  • J.R.
    J.R. over 6 years
    I got. Many Thnx! So it means the most of the commercial routers sold in the markets are using iptables to re-direct from wifi to lan right? Cause I can login my router via wifi on the browser with a static ip. If the wlan0 and eth0 of the routers are bridged, then the wlan0 will not be able to have a static ip.
  • Daniel B
    Daniel B over 6 years
    @J.R. No. A good resource for stuff like that is OpenWrt’s default configuration: Bridged LAN and WiFi, routed WAN (with NAT using IPTables, yes). The bridge itself is the interface you should be looking at.
  • J.R.
    J.R. over 6 years
    so eventually if I want to have a static ip as the interface to communicate with I will always need the NAT...Cause only NAT offers the functionality to divide the outter net from the inner net. Your explanation rly helped alot, thnx!
  • Daniel B
    Daniel B over 6 years
    No. NAT is entirely unrelated. Also, why would you want to create a new network? If that’s your goal, you followed the wrong guide.
  • user1686
    user1686 over 6 years
    @J.R.: No, most home "wireless routers" also simply bridge Ethernet and WiFi into one LAN. (They only route between LAN and WAN.) How do they make the router's IP address work? Well, I've already answered that in my post.
  • J.R.
    J.R. over 6 years
    @DanielB nah, I do want to create a new network. I mean, I want a static IP address for the Pi so I can ping without researching what kind of dynamic IP is given for the Pi . In this case, I pretty much need a NAT.
  • Daniel B
    Daniel B over 6 years
    No, you don't. You also don't need a separate network to give it a static IP address. Your existing network can already accommodate that.
  • user1686
    user1686 over 6 years
    tl;dr: configure the address on br0