Hello, I have dietpi running on rpi4.
It works as a hotspot and ovpn gateway in my home lan thanks to dietpi hotspot option.
Had to set some iptable rules to route lan and hotspot traffic through tun0.
With my laptop connected over ethernet the speed is really decent with vpn connected about 130mbit.
But over internal wifi hotspot it only gets about 40mbit down and this is right next to the pi. The range is really not so good.
So i bought a 3.0 USB LAN Adapter with AX88179 from UGREEN.
It gets listed under the usb devices in dietpi so my guess is it should work ootb.
Now it needs to be configure as eth1 device. And here my struggle begins.
Already did a research and tried adding it in /etc/network/interfaces but that messed up the network so a recovery from backup was needed.
What should be the entry in stock /etc/network/interfaces to get it working?
The plan is to connect a wifi repeater as lan bridge (AP) and with different subnet like the wifi hotspot has so it acts like a guest network maybe.
Then to hopefully get the full 130mbit through wifi 4.
I already tried to connect the repeater to my main lan with rpi as gateway but this wont work as expected other then my laptop which uses the rpi as gateway the repeater just uses the plain connection to my router even with rpi as gateway.
Another idea I have is to use a WLAN Dongle as hotspot instead of the internal modul. So I bought a ALFA Networks AWUS036ACHM which should also work ootb with raspbian.
What steps are needed so dietpi hotspot uses the external WiFi instead of wlan0?
Could someone please advice me on how to do both ways or maybe only the wlan1 Hotspot thing? Before I go further on is there a possibility to tell dietpi config to use the dongle as hotspot or does it need more advanced config? Also maybe someone could say something about my thoughts with eth1 as guest hotspot. 
Better to create your custom configuration within sub folder /etc/network/interfaces.d
. This way the original configuration will stay intact, and you could play with your new interface
Some manual steps are needed as we have hard code wlan0 within our install script. Basically, all files for serving hotspot and DHCP server needs to be adjusted.
@Joulinar thx for your answer. I will give it a shot. 
I try my best to improve my skills to realize this project but also Google isnt really a help in this case.
But if I get eth1 to work I still have to struggle with something like a dhcp service I guess? Because Im planning to use a different subnet then my main lan.
So would maybe better to invest some time in the external Wifi Dongle…
Could you help me with the config maybe?
I don’t have all files at hand, but you can start with following to check hostapd
and sc-dhcp-server
configuration.
/etc/hostapd/hostapd.conf
/etc/dhcp/dhcpd.conf
/etc/default/isc-dhcp-server
Might be quite some manual work to change interface, you could have a look to our install code to check what we do, and which configs are applied. It’s just 100 lines of code 
https://github.com/MichaIng/DietPi/blob/b510d2bfe2153417314aa0bc3ce791412eb2bf0a/dietpi/dietpi-software#L7837-L7939
@Joulinar
I looked into these files and read the lines of code. Meanwhile I had some thoughts about instead of fiddeling around with the configs why not tell the system that wlan1 (external wifi) now is wlan0.
So I found this…
In my case as I use the ALFA Networks AWUS036ACHM which utilizes a Mediatek chipset
I had to add a file called /etc/udev/rules.d/72-static-name.rules which now has the following content
ACTION==“add”, SUBSYSTEM==“net”, DRIVERS==“mt7610u”, NAME=“wlan1”
First I had the wrong driver name inserted so the hotspot disappeared. Was able to activate it in dietpi-config but disabled itself after some seconds with status disconnected. After changing the driver entry to mt7610u and after a reboot the connection was fine and hotspot useable again. So I guess it’s working as expected.
Problem is when I do a Speedtest on my Mobile over the hotspot I get similar speeds as with the internal iface before.
If I check iwconfig or iw list I probably can see two devices but can’t say which one is wlan 0 or 1.
How can I check if wlan 0 is the dongle?
Maybe also there is no lag of speed from the internal pi4 module, could it be it’s an config issue?
In hotspot settings there are only the wifi4 frequencies listed.
maybe @MichaIng knows how to check which adapter is using which interface name.
I’m pretty sure that eth0
and wlan0
are used by the onboard adapters and eth1
and wlan1
by the USB adapters. For WiFi you can disable the onboard adapter in dietpi-config
network settings so that the USB adapter becomes wlan0
. For Ethernet you need to replace eth0
in /etc/network/interfaces
with eth1
and reboot (+plugging the cable correctly, of course), at best before installing/setting up the WiFi Hotspot. But should also work to just reinstall the WiFi Hotspot or re-apply network settings after both changes were done.
1 Like
OK @MichaIng
But the goal with ethernet was to have both interfaces running at same time but internal should connect to my home lan and eth1 external should become something like a guest network with different subnet like hotspot installation uses.
When I deactivate wifi in dietpi-config am i still able to config the hotspot option?
Is there also a way to deactivate internal modul from terminal?
What about the wifi speeds? The dongle is ac, is there a way to let hotspot use the 5ghz channels?
our install script requires wlan0
and eth0
explicitly. It’s not very dynamic atm.
When deactivating only “onboard WiFi”, then yes. This is a dedicated option outside of the WiFi submenu.
Not sure what you mean? You need to do it via dietpi-config
, which can be called from any terminal.
With some customisations, I think. Add/set the following in /etc/hostapd/hostapd.conf
:
ieee80211n=1
ieee80211ac=1
wmm_enabled=1