the_senate
Posts: 1
Joined: Sun Mar 01, 2020 1:10 am

Is there a way to use a Pi 4 as a router without using eth0?

Wed Jun 03, 2020 5:52 pm

I live in a dorm and they have disabled the wall network ports. I need a wired network for one of my classes and was trying to set up my pi as a router but I keep running into issues. I have a switch and cables, but no wifi/ethernet dongles. My first question is: Is it possible to set up a router that treats the wlan0 adapter as the WAN port and the eth0 as the LAN? All of the guides assume that it will be the other way around. If it is possible, how would I do it? I have been able to get dhcp working and making a local network, but I don't know exactly what I did to do that. And I was unable to get NAT working properly to connect to my wifi network. Are there any guides out there for this specific use case, or something similar?

spcharc
Posts: 20
Joined: Tue Jul 02, 2019 12:23 am

Re: Is there a way to use a Pi 4 as a router without using eth0?

Wed Jun 03, 2020 11:53 pm

Is it possible to set up a router that treats the wlan0 adapter as the WAN port and the eth0 as the LAN? All of the guides assume that it will be the other way around.
Of course it's possible.
If it is possible, how would I do it? I have been able to get dhcp working and making a local network, but I don't know exactly what I did to do that. And I was unable to get NAT working properly to connect to my wifi network.
NAT requires iptable rules. Did you set them?
Something like

Code: Select all

sudo iptables -t nat -A  POSTROUTING -o wlan0 -j MASQUERADE
sudo iptables -A FORWARD -i eth0 -o wlan0 -j ACCEPT
DHCP is not necessary for your purpose, static ip works fine. But using DHCP is more convenient, so you may want to keep it.
Are there any guides out there for this specific use case, or something similar?
You can always Google. Like this one: https://www.instructables.com/id/Share- ... pberry-Pi/

W. H. Heydt
Posts: 12648
Joined: Fri Mar 09, 2012 7:36 pm
Location: Vallejo, CA (US)

Re: Is there a way to use a Pi 4 as a router without using eth0?

Thu Jun 04, 2020 1:06 am

Something else you might want to do...

Since you say you're in a dorm. This presumes that it is run by your college/university. Talk to the instructor of the course that requires that you have access to a wired network and have that worthy take up the issue with higher authorities and get the wired network turned back on.

stan_qaz
Posts: 57
Joined: Sun Sep 30, 2012 6:53 am
Location: Sunny Arizona

Re: Is there a way to use a Pi 4 as a router without using eth0?

Thu Jun 04, 2020 10:21 pm

Not a Pi solution but if the Pi option is stumping you look for a travel router, the usual solution for dorms, hotels and other places where you can't get a wired connection.

Return to “General discussion”