1

I am working on Raspberry pi 3B+ (Having Ethernet and wlan both).

Currently i am trying to create a bridge connection between my Ethernet port and tap which i am using for other purpose.

Below settings works fine if i want to have dhcp conenction.

# interfaces(5) file used by ifup(8) and ifdown(8)
auto lo
iface lo inet loopback

auto wlan0
#allow-hotplug wlan0
iface wlan0 inet dhcp   
    wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf

#iface default inet dhcp

auto eth0
iface eth0 inet dhcp

# bridge
auto br0
iface br0 inet dhcp
#   address 192.168.0.120
#   netmask 255.255.255.0
#   network 192.168.0.0
#   broadcast 192.168.0.255
#   gateway 192.168.0.1
#   dns-nameservers 192.168.0.1
    pre-up ip tuntap add tap0 mode tap
    pre-up brctl addbr br0
    pre-up brctl addif br0 eth0
    pre-up brctl addif br0 tap0
#   pre-up ip link set eth0 up
    pre-up ip link set tap0 up
#   post-down ip link set eth0 down
    post-down ip link set tap0 down
    post-down ip link set br0 down
    post-down brctl delif br0 eth0
    post-down brctl delif br0 tap0
    post-down brctl delbr br0
    post-down ip link del tap0
    bridge_ports eth0 tap0
    bridge_stp off
    bridge_fd 0
    bridge_maxwait 0

What i want to achieve is to have static IP address for bridge connection or Ethernet connection.

Note: If i change in above code as static ip for br0 connection then it does take static ip. But now i am not able to connect (ping) to wlan or ethernet or bridge connection. But i do able to ping to (raspberrypi.local)

sample for static code

bridge

auto br0
iface br0 inet static
    address 192.168.0.120
    netmask 255.255.255.0
    network 192.168.0.0
    broadcast 192.168.0.255
    gateway 192.168.0.1
    dns-nameservers 192.168.0.1
    pre-up ip tuntap add tap0 mode tap
    pre-up brctl addbr br0
    pre-up brctl addif br0 eth0
    pre-up brctl addif br0 tap0
#   pre-up ip link set eth0 up
    pre-up ip link set tap0 up
#   post-down ip link set eth0 down
    post-down ip link set tap0 down
    post-down ip link set br0 down
    post-down brctl delif br0 eth0
    post-down brctl delif br0 tap0
    post-down brctl delbr br0
    post-down ip link del tap0
    bridge_ports eth0 tap0
    bridge_stp off
    bridge_fd 0
    bridge_maxwait 0
4
  • Which DHCP server programme are you using? Commented Dec 20, 2019 at 8:42
  • 1
    Why do you need a static IP address? Commented Dec 20, 2019 at 8:43
  • @LegendusMaximus I need static IP address as whomsoever connect to pi they able to ping or connect via same ip address. Commented Dec 20, 2019 at 13:25
  • What operating system do you use? Is it Raspbian Buster? Raspbian prefers to use dhcpcd as networking system and old style Debian ifupdown isn't used and you have to take care to configure dhcpcd to coexist with ifupdown. Did you respect it?
    – Ingo
    Commented Dec 21, 2019 at 12:15

1 Answer 1

0

You could specify that you want the PI to be given a static IP address via the router admin page if you have access to that.

1
  • No i will be not having access of it. Commented Dec 20, 2019 at 13:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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