1

I have device A and B. I need them networked together (see eachother on arp-scans etc). Device B has WiFi, but device A has Ethernet. Basically I just want the Pi to act like a simple router (maybe this isn't the right term) for an internal network.

How can I configure the Pi to host a WiFi network over wlan0 (hostapd + dnsmasq I guess) but also allow a client to connect via Ethernet in the same way a client connects over WiFi (including DHCP)?

Quick Note:

I've already had it almost working, but the Ethernet client was under 192.168.2.X while the WiFi clients were on 192.168.1.X. They could access each other by IP address, but were still on separate networks, which isn't what I want.

Below is a diagram of what I want:

Diagram

3
  • 1
    I think that you want a network bridge
    – jsotola
    Commented May 17, 2019 at 3:17
  • Does it is just a stand alone network or is there an additional uplink to an another internet router?
    – Ingo
    Commented May 17, 2019 at 9:49
  • @Ingo Standalone network
    – NaxNir
    Commented May 17, 2019 at 12:46

2 Answers 2

0

Usually different interfaces are connected to different subnets on a router and ip packets are routed from one subnet to others and routing tables determine to what subnet they should go. But you want that all devices have ip addresses from the same subnet. This can be done by "merging" the interfaces into a bridge. This way the separate subnets become one big broadcast domain that behaves like one big subnet.

I have made such a bridge with an uplink to an internet router at Configuring Raspberry pi as Router, Wifi and Ethernet Bridge. The setup is divided into two parts. First setting up the bridge and then create the uplink. Just follow only the first section Setting up an access point (wlan0) and bridge it with wired ethernet (eth0), then you should have what you want.

6
  • I appreciate the answer and will definitely be using it, but do you think it's possible for me to translate it to a classic hostapd+dnsmasq+dhcpcd setup?
    – NaxNir
    Commented May 17, 2019 at 18:47
  • @NaxNir It is possible of course. You can look at the official tutorial raspberrypi.org/documentation/configuration/wireless/…. It does not have your situation but it shows how to make an access point and how to setup a bridge. Combine it the right way it should give you the solution. At a glance it seems that you only have to make a dhcp server available on the bridged network and then connect your device to the wired port instead of the uplink router.
    – Ingo
    Commented May 17, 2019 at 20:13
  • When connecting it doesn't serve me an IP.
    – NaxNir
    Commented May 17, 2019 at 23:21
  • Update: installing haveged fixed the issue.
    – NaxNir
    Commented May 18, 2019 at 0:03
  • @NaxNir That's curious. Random numbers should not be an issue. The RasPi has a hardware random number generator that is managed by rngd from rng-tools. That is installed by default on latest Raspbian version. Seems you are not running an up to date installation. I suggest to use rng-tools instead of haveged.
    – Ingo
    Commented May 18, 2019 at 0:38
0

Your question omits detail e.g. what the devices are, and what you expect them to be able to access.

The following should come close to what you stated you want to do i.e. allow B to access A.
Access Point

Frankly you would be better to either connect to your router (or buy a cheap router). The Pi makes a poor router (slow, limited ports), and would cost more.

2
  • The devices are a soundboard (A) and a phone (B). I think it is not relevant to the question. I expect the devices to access eachother and the Pi. I am close to what I want, but not exactly there, so that documentation, while useful, isn't a help to me. I am using a Pi because I already have a spare one.
    – NaxNir
    Commented May 17, 2019 at 6:03
  • @NaxNir try adding a dhcp-range for eth0
    – Milliways
    Commented May 17, 2019 at 7:00

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.