0

So I want to setup a network bridge between my ethernet connection and the wlan adapter such that the raspberry 3 acts as a device where my chromecast can connect to and shares the internet connection over ethernet, where the raspberry pi is connected to a router.

There are tons of instructions out there to do this, but I need a static IP on my ethernet connection, which then should be shared to the chromecast that is connected via wlan to my raspberry. Is that possible?

I tried to follow the instructions here: https://wiki.debian.org/BridgeNetworkConnections#Manual_bridge_setup but now my raspberry does not conenct to the internet anymore properly.

And also from the last section here: https://www.raspberrypi.org/documentation/configuration/wireless/access-point.md

I hope someone can help me, here are my files:

cat /etc/os-release

PRETTY_NAME="Raspbian GNU/Linux 9 (stretch)"
NAME="Raspbian GNU/Linux"
VERSION_ID="9"
VERSION="9 (stretch)"
ID=raspbian
ID_LIKE=debian
HOME_URL="http://www.raspbian.org/"
SUPPORT_URL="http://www.raspbian.org/RaspbianForums"
BUG_REPORT_URL="http://www.raspbian.org/RaspbianBugs"

/etc/network/interfaces (here the last part that is uncommented I though is what needs to be done, but it makes the raspberry not connect to the internet anymore, so I commented it out.)

# interfaces(5) file used by ifup(8) and ifdown(8)

# Please note that this file is written to be used with dhcpcd
# For static IP, consult /etc/dhcpcd.conf and 'man dhcpcd.conf'

# Include files from /etc/network/interfaces.d:
#source-directory /etc/network/interfaces.d


# The loopback network interface
auto lo
iface lo inet loopback
# The primary network interface

auto eth0
iface eth0 inet static
        address 128.131.60.73
        netmask 255.255.252.0
    gateway 128.131.60.1
        dns-nameservers 128.130.4.3 128.131.4.3


# WLAN
auto wlan0
allow-hotplug wlan0
iface wlan0 inet manual
wireless-power off


# Netzwerkbrücke
#auto br0
#iface br0 inet static
#        address 128.131.60.73
#        netmask 255.255.252.0
#        gateway 128.131.60.1
#        dns-nameservers 128.130.4.3 128.131.4.3

#bridge_ports eth0 wlan0

/etc/dhcpcd.conf

# A sample configuration for dhcpcd.
# See dhcpcd.conf(5) for details.

# Allow users of this group to interact with dhcpcd via the control socket.
#controlgroup wheel

# Inform the DHCP server of our hostname for DDNS.
hostname

# Use the hardware address of the interface for the Client ID.
clientid
# or
# Use the same DUID + IAID as set in DHCPv6 for DHCPv4 ClientID as per RFC4361.
# Some non-RFC compliant DHCP servers do not reply with this set.
# In this case, comment out duid and enable clientid above.
#duid

# Persist interface configuration when dhcpcd exits.
persistent

# Rapid commit support.
# Safe to enable by default because it requires the equivalent option set
# on the server to actually work.
option rapid_commit

# A list of options to request from the DHCP server.
option domain_name_servers, domain_name, domain_search, host_name
option classless_static_routes
# Most distributions have NTP support.
option ntp_servers
# Respect the network MTU. This is applied to DHCP routes.
option interface_mtu

# A ServerID is required by RFC2131.
require dhcp_server_identifier

# Generate Stable Private IPv6 Addresses instead of hardware based ones
slaac private


denyinterfaces wlan0
denyinterfaces eth0

/etc/hostapd/hostapd.conf

interface=wlan0
bridge=br0
#driver=nl80211
ssid=WLANPi
hw_mode=a
channel=7
wmm_enabled=0
macaddr_acl=0
auth_algs=1
ignore_broadcast_ssid=0
wpa=2
wpa_passphrase=passphrase
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP
rsn_pairwise=CCMP
wa4557
  • 103
  • 1
  • 3

1 Answers1

1

The problem is that the Raspberry Pi Foundation does not show in its example Setting up a Raspberry Pi as an access point in a standalone network (NAT) how to configure a static ip address to the bridge. You can use Setting up a Raspberry Pi as an access point - the easy way if you like. Just go direct to the section Setting up an access point with a bridge and follow it. I have added four lines in /etc/systemd/network/12-br0_up.network to fit your needs by setting static ip addresses.

With old style networking you setup interfaces in one file /etc/network/interfaces. With systemd you do not have one file, instead you use a file for each interface in directory /etc/systemd/network. In the example eth0 is set with /etc/systemd/network/04-br0_add-eth0.network. Look at the Name= under [Match]. As member of a bridge it does not need any ip address because a bridge works only with mac addresses. Instead the ip address is given to the bridge br0.

Ingo
  • 42,961
  • 20
  • 87
  • 207