Add the piratebox to a wired network

Posted by Heortex 
This forum is currently read only. You can not log in or make any changes. This is a temporary situation.
Now, this forum is in read-only mode. You find details Details hereContinue on /r/PirateBox
Add the piratebox to a wired network
February 09, 2018 04:58PM
Hello everyone,

Is it possible to access to the Raspberry pi(rate) box for any user connected on the same wired network? I want to connect the piratebox to a network of desktop which doesn't have WiFi to access it like the computer were accessing it by wifi. I tried to just connect the piratebox by ethernet to the network and access to the url: piratebox.lan

Thank!
Re: Add the piratebox to a wired network
February 09, 2018 05:52PM
Hi,
yes and yes.

If you connect PirateBox via ethernet to your existing wired network, you can access the box by using it's IP address on the wired network. If you activate the avahi daemon, on some OS you can access the piratebox with
Language: PHP
http://alarmpi.local
(note to myself: change the default hostname to piratebox). Depending on your wired network, accessing
Language: PHP
http://alarmpi/
Might work as well. The Upload-Box won't work out of the box, you need to access
Language: PHP
http://alarmpi:8080/

You can also span the PirateBox wifi network over to the wired port. Currently, there is no howto describing that, but it is possible and should be easier supported in the future.... But I haven't had time to work on this.




best regards Matthias
Hey, I'm currently trying the same, e.g. accessing the piratebox from my lan (192.168.0/24).
I can ssh in with the piratebox' LAN IP (192.168.0.10) in this case, but when loading it always starts to automatically redirect my browser to "piratebox.lan" - which it then fails to load.
What can i do in this case?
My priority is working wifi access, and the box will not always be connected via ethernet, but it would be nice if i got that running.
Thanks!
Re: Add the piratebox to a wired network
February 24, 2018 06:12AM
Hi,
if this is the new wish by alot of people....

Per default, the RPi Piratebox does not route between its wifi network and the ethernet Port.

On this topic I already described the changes on OpenWrt, which partly applies here as well for the RPi. The question is, which resolv.conf is valid.

In addition you need to configure the kernel to do packet forwarding:

persistently enable Kernel to do forwarding
cat <<EOF > /tmp/30-ipforward.conf
net.ipv4.ip_forward=1
net.ipv6.conf.default.forwarding=1
net.ipv6.conf.all.forwarding=1
sudo mv  30-ipforward.conf  /etc/sysctl.d/
sudo sysctl -p  /etc/sysctl.d/30-ipforward.conf

Enable IPv4-NAT
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
iptables -A FORWARD -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT
iptables -A FORWARD -i wlan0 -o eth0 -j ACCEPT
Make the changes persistent
sudo iptables-save > iptables.rules
sudo mv iptables.rules /etc/iptables/

Reconfigure PirateBox
Quote

1. Edit /opt/piratebox/conf/dnsmasq_default.conf
2. remove the lines

#dont use resolv.conf
no-resolv
#dont recheck resolv.conf for changes
no-poll

3. add

resolv-file /etc/resolv.conf

based on ArchLinux wiki - internet sharing

This does not replace a full firewall or a full set of routing.
This is just a raw concept, nothing more.

No warranty...

best regards Matthias

edit:
please report back if that is working, so I can create a howto on piratebox.cc



Edited 1 time(s). Last edit at 02/24/2018 06:13AM by Matthias.
First Matthias, May I say that WOW, you answer a LOT of questions. Many of which along the lines of "This is a nice car, how do i turn it into a jet, with no mechanical knowledge, and in about 5 minutes. (Step by step please)" LOL

I would like to voice a request here (as this appears to be the most relevant thread I have found on the subject)
I too am trying to configure my (pi)ratebox to utilize the lan port I have spent the past couple days researching but havenot come up with much.

THe Behavior I am looking for would be the Pi looking at the lan0 on startup and trying to pull an IP from DHCP. If successful Use it, if no DHCP then act as a Piratebox. I don't know if this would involve bridging to Wlan0 or hosting its own IP range. ( I am a fan of simple)

I realize you are a busy guy and (I assume) you have a life :-) If you were able to even give me a short list or direct me to a site etc it would be much appreciated. And I would LOVE to have this as a future feature. (and If I have to come up with the solution I'll happily pass it along for inclusion in the future.

Cheers! Keep bein Awesome!
Re: Add the piratebox to a wired network
March 11, 2019 07:28PM
Thanks for that good suggesiton. I added to our github tracker for not loosing that idea.