I have searched the forums and elsewhere to no avail.
I am running Pi-hole on a Raspberry pi and I like it so far. I used to run IPFire on this Raspberry Pi, but mostly used that for the proxy to block trackers and ads. Pi-hole does a better job at this and makes a lot of sense. But now I need an additional ethernet port on my router - because Pi-hole had to steal one of the ethernet jacks. So I was thinking I could make use of the Pi-hole to free one up by connecting a USB-ethernet-adapter and bridge the connection somehow. What I would like to do is the following:
Pi-hole is running on 10.0.1.2 via ethernet, connected to my router on 10.0.1.1 which is configured to send all DNS-requests to Pi-hole.
Pi-hole has an additional cheap USB ethernet adapter installed. I have previously used this adapter with IPFire as a firewall on said Pi so I the adapter is compatible and working.
Connected to this USB ethernet adapter is a client that I want to get forwarded to the router on 10.0.1.1 so that it gets internet access as if it were connected directly to the router.
I have tried different configurations and tutorials related to bridging connections on Raspbian, and over the years I have learned a lot about networking and linux in general. But things evolve and there are many ways to solve things - and honestly I don't know enough to get this up and working and have to ask here. I could post the different things I have tried in /etc/network/interfaces or dhcpcd.conf but it would'nt make any difference because they are probably wrong anyway. The system hangs when I execute some of the bridge-configs for example. Everytime I have to log in with a keyboard and clean out the files from my changes to get my DNS back online - so it has begun to annoy me to the point where I kindly ask for help. Before Pi-hole I never even opened dhcpcd.conf for example. I ran IPFire for this task for way too long before I bothered with Pi-hole. But I really like it because it runs so fast and allows the Pi to do other stuff too - such as scraping EPG-data, parsing it and so on. If only it could serve a client with internet connection so that I wouldn't have to install an additional switch for this purpose (inside an already tight space) it would be perfect and mean a lot to me.
I want to learn - so I appreciate any pointers in the right direction and I will read up. Or if someone has the ability to just jot this down like "edit this file with this bit of code and you should be up and running in one minute" I would take that too. I'm getting a bit confused with all the different places to edit network configs, and don't know what would be best practie. I have begun to get tired of the trial and error that forces me to hook it up to a TV and flush the configs because I get locked out everytime I fail.
What is the correct way to handle this problem? I noticed that when I created a bridge for example, the bridge seemed to work but the DNS went offline. And when I tried to bring eth1 up with its own static ip the system freezes. I wish to keep Pi-hole active on eth0 and not mess with that. I just want to make sure eth1 (it's client connected to that port) gets through to the router - but it of course has to jump through eth0 to get there.
If anyone has a minute or two I would appreciate it. It would help me free up one ethernet port in my router which Pi-hole took from said client that now needs a new wired connection. There will be no performance issues as the client device very lightweight as it just needs a realiable physical connection but no bandwidth.
Any help appreciated. Hopefully this can help others that have USB-adapters around and wish to free up a wired connection on their routers. Thank you for reading.
I already own several switches that I don't use and thus have them available for this purpose if I have to. But I don't want to use them if I can free up a port with the USB-ethernet-bridge. I have a 5 port 100 Mbit switch with super low energy comsumption (max consumption 1.48W), and an additional gigabit 8 port one that also is very energy efficient at 3.97W max. Plus an additional managed Mikrotik switch that is really nice, it even has SFP. So there's no shortage of network gear lying around.
However, if I can run things more efficient, especially things that are running 24/7, I try to make the effort.
Sure, I could use a wireless adapter for Pi-hole, and get the DNS requests that way - but I want low latency for all DNS requests coming into the Pi-hole and back. So in that case I would just add a switch instead. But I haven't given up on the eth-adapter yet. The client I want to bridge via the USB-ethernet-adapter on eth1 is a very basic "smart-home" controller without Wi-Fi capabilities, so it needs ethernet but barely any data. It would be perfect and make a lot of sense, with less power consumption and less clutter inside the media cabinet which already has a bunch of other stuff and has a shortage of electrical outlets too at this point. Everything is very thought through and designed in a modular way for energy efficiency. Besides, whats nice about Pi-hole is that it's not its own distro so theres the ability to really configure and run other things, compared to many other projects I've ran on other Pis over the years that I wish could handle more things at once.
I appreciate the reply though! But the easy way out with a switch will have to wait until I have banged my head against the wall a little more..
I was thinking maybe Iptables is the way to go to route the traffic once the bridge is up. I've also tried bridge-utils. Just haven't figured it out yet. Things has changed over the years, making networking tutorials obsolete, so it requires a lot of trial and error. I thought I'd ask at least. Appreciate any ideas on where to config, for example Pi-hole seems to not like it when I configure things in /etc/network/interfaces and has it's own changes reflected in dhcpcd.conf when I have tested PI-holes own tool for repairing the install. For example when I edit some IP-related details with the repair command it is added to dhcpcd.conf but I am not sure if that is the only place where I would need to configure the things I want to achieve (bridge type solution), which is why I ask here where hopefully someone with more knowledge in linux network configuration and Pi-hole's config would be able to point me in the right direction.
Have you considered the data throughput of the Pi's USB bus and how that is going to impact things?
I'd do the switch myself, far less long term problem potential.
Not sure if you read my previous posts. I have considered it (as with every Pi-project) and I know for sure that it will not be a problem. The reason for this is that the client I wish to connect just needs a wired connection because that's all it has, and all that client does it basically send a packet or two every now and then to tell a webservice that it is online. There will be a packet or two coming into the client too of course, but it's just a device for controlling lights so there is no problem with the data throughput. As for installing a switch I have mentioned why I don't want to do that.
I have almost every version of Pi there is and I have used this very setup as a firewall between my router and the ISP.
With IPFire running the internal ethernet as RED and the USB ethernet adapter as GREEN along with a Wi-Fi adapter as BLUE. Even though they share the same bus internally there was never any problems with the throughput for our needs, though there is of course speed limitations that comes with it. But I was able to stream video online comfortably so the bandwidth was good. And I even tested playing videogames online with a very good ping with this setup. A first generation Raspberry Pi (B+) doing this, and at the same time filtering the content for trackers and ads with a proxy running along with 30 or so firewall rules. It can handle a lot of stuff if the code running is good and not bloated.
And for this specific purpose Pi-hole is completely on the LAN behind the NAT, with the client just sending a couple extra packets now and then. It will make no difference at all for the throughput. I could even run more demanding clients on the USB ethernet adapter if I decided to switch things around - but this is my optimal configuration since the light-controller isn't very demanding at all in terms of latency and bandwidth.
I am not sure what you mean with this: "I’d do the switch myself, far less long term problem potential."
On the contrary, installing a switch would probably be the best solution long term - but I like to optimize energy consumption and installing a switch for just one extra port goes against me if I can solve it this way instead. A switch is the easy way out, it's not the most efficient solution and it's not solving the problem, its getting around the problem. At least that's my take on it.
I will dig around for some dhcpcd.conf information and see if I can solve it. Just thought I'd ask here first.