How to route traffic out through ethernet and WiFi on the same subnet?

burnedfaceless used Ask the Experts™
I am a college student without a lot of money so I am turning one of my Raspberry Pis into a router.

I followed these instructions in general to create a Raspberry Pi that plugs directly into my modem and creates a WiFi network.

Some other things I did were to install Fail2Ban and other basic security things when I first launched the Pi.

I have some devices that will need to connect by Ethernet. I have a USB to Ethernet adapter and a Ethernet Switch. I was hoping to have the internet sent through the USB to Ethernet adapter (ETH 0) to my Switch, that can plug into devices that need a wired connection.

I need the internet that goes out of the eth1 device and out of the wlan0 device to be on the same subnet. How do I set this up where they are both on the same subnet?
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Ajay ChananaMCSE-2003/08|RHCSA| VCP5/6 |vExpert2018
Distinguished Expert 2017

If your ethernet and wireless is provided by same device then  why you think it will give different network ?

It should provide the same ip range.


In order to route traffic through the eth1 port on the Raspebrry Pi I believe I need to enter the IP Address I assign to it under option-routers in /etc/dhcp/dhcpd.conf.

When I did this it said they needed to be on different subnets.
nociSoftware Engineer
Distinguished Expert 2018

So what you need to do is to Bridge the eth0 & eth1   into br0 and then run DHCP & the Ip address of the pi on the Bridge.
see man brctl   for more info on this.

Also verify the "vlan_bridge=..." setting in the hostapd.conf file.

I'm still confused. What exactly do you want to route from and to? If the Raspberry PI is acting as a router, that would imply  two separate networks. Are you trying to separate WiFi and Ethernet into two networks? They don't have to be on separate networks. So can you explain a bit more in what you are trying to do from a network level? Thanks.
In the paper you followed, it appears that the internet-side address is in and the LAN side is in  And, I believe this uses an Ethernet port to the modem, right?

Also, it has which is the LAN supporting the original intended WiFi.
You want Ethernet on the LAN as well.
So you added a USB to Ethernet adapter for the LAN side.

So, yes, the two Ethernet interfaces have to be on separate networks.  One for the WAN/Internet and one for the LAN.
WLAN in this case appears to mean Wireless LAN and is using the same subnet as your intended Ethernet LAN devices.

You may have to bridge the WiFi LAN to the added USB Ethernet .. but certainly not the two Ethernet ports!

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial