raspbian-recipes icon indicating copy to clipboard operation
raspbian-recipes copied to clipboard

No longer working

Open jaylfc opened this issue 4 years ago • 19 comments

Hi,

I love these scripts and have used them for a while now. Since the Raspbian update they no longer work. I tried changing my default by to iptables legacy and unmasked dnsqmask and the script now runs without errors but doesn’t actually work.

Any ideas?

Thanks in advance!

jaylfc avatar May 05 '20 17:05 jaylfc

I really haven't got time to test script recently

arpitjindal97 avatar May 05 '20 17:05 arpitjindal97

I wish I knew enough to fix it, I’ll keep playing around, if I manage anything I’ll post on here!

jaylfc avatar May 05 '20 18:05 jaylfc

Any news on this? Got the same problem!! Script work fine. It runs without errors, but the devices I connect to the ethernet are simply not detected nor assigned an IP

albertfaromatics avatar May 22 '20 13:05 albertfaromatics

I do not RPi right now with me.

Can u guys try to execute the steps in scripts 1 by 1 in console and see which lines throws error ?

arpitjindal97 avatar May 22 '20 13:05 arpitjindal97

Just run the code of wifi-to-eth-route 1 by 1, no errors. I can check in ifconfig that eth0 has a correct IP of 192.168.2.1, with correct mask and gate

Connected my PC to the ethernet of the raspberry. Nothing happens

albertfaromatics avatar May 22 '20 14:05 albertfaromatics

Ok now it worked. I just rebooted the RPI and now it worked. I need to do some more testing I think

albertfaromatics avatar May 22 '20 14:05 albertfaromatics

I never got it to function correctly due to the change of networking system in the latest version. I manually created a bridge following Debian guides in the end.

jaylfc avatar May 22 '20 14:05 jaylfc

Ok so after some more testing:

  • If I add the script to /etc/rc.local, to run at boot, I get the following: · ifconfig configured properly. with IP and mask. · I can see the DHCPREQUEST on syslog of my computer May 22 16:27:27 raspberrypi dnsmasq-dhcp[803]: DHCPREQUEST(eth0) 192.168.2.36 30:9c:23:17:fe:17 May 22 16:27:27 raspberrypi dnsmasq-dhcp[803]: DHCPACK(eth0) 192.168.2.36 30:9c:23:17:fe:17 DESKTOP-L671BNR · My computer gets IP, but no internet connection, and I cannot ping it from the Raspberry
  • If I DO NOT add the script to run at boot to /etc/rc.local · ifconfig OK again as before, with correct · same as before, DHCPREQUEST on syslog · My computer gets IP AND Internet connection. I can ping and ssh from Raspberry

albertfaromatics avatar May 22 '20 14:05 albertfaromatics

I never got it to function correctly due to the change of networking system in the latest version. I manually created a bridge following Debian guides in the end.

Do you have the script? I'm struggling to create it.....

albertfaromatics avatar May 22 '20 14:05 albertfaromatics

@jaylfc Can u provide clean steps here ?, we can add that to README

arpitjindal97 avatar May 22 '20 14:05 arpitjindal97

I’m out right now, I will have to find the page I used in my history. I will post as soon as back :)

jaylfc avatar May 22 '20 14:05 jaylfc

This is the page I used I think:

https://raspberrypi.stackexchange.com/questions/88214/setting-up-a-raspberry-pi-as-an-access-point-the-easy-way

jaylfc avatar May 22 '20 14:05 jaylfc

I think you are using eth-to-wifi, no? So you are getting internet to the rpi from the ethernet and creating a WiFi AP.

I need the other way around: I have internet on WIFI and I want to connect my computer to the ethernet port of the RPI

albertfaromatics avatar May 22 '20 14:05 albertfaromatics

Nope, I have my pi sharing incoming from wlan0 to Ethernet. I plugged a router into it to create a new separate network and all devices have internet and local connectivity.

jaylfc avatar May 22 '20 17:05 jaylfc

Still not working for me.

I've seen that if I run the script WITHOUT anything connected to the ethernet, and then I connect a switch to the port, then it works

If the script is run with something already connected to the ethernet port of the raspberry, it fails

albertfaromatics avatar May 25 '20 10:05 albertfaromatics

Ok, give me a few hours, I just realised I could open my bash history file and see exactly what I did to get it working. I will post later :)

jaylfc avatar May 25 '20 13:05 jaylfc

_**Make sure to:

update-alternatives --config iptables

Change to legacy.**_

The dnsmasq service may need unmasking after installation.

Here is what I did, I have pasted the entire file under each nano command, you should be able to just replace unless you have already made some critical changes to your configs.

####start####

sudo apt-get install dnsmasq sudo nano /etc/dhcpcd.conf

######start of file#####

interface eth0 static ip_address=192.168.220.1/24 static routers=192.168.220.0

hostname

Use the hardware address of the interface for the Client ID. clientid

Persist interface configuration when dhcpcd exits. persistent

Rapid commit support. Safe to enable by default because it requires the equivalent option set on the server to actually work. option rapid_commit

A list of options to request from the DHCP server. option domain_name_servers, domain_name, domain_search, host_name option classless_static_routes

Respect the network MTU. This is applied to DHCP routes. option interface_mtu

A ServerID is required by RFC2131. require dhcp_server_identifier

Generate SLAAC address using the Hardware Address of the interface #slaac hwaddr

OR generate Stable Private IPv6 Addresses based from the DUID slaac private

######end of file######

sudo service dhcpcd restart sudo mv /etc/dnsmasq.conf /etc/dnsmasq.conf.orig sudo nano /etc/dnsmasq.conf

#####start of file####

interface=eth0 # Use interface eth0 listen-address=192.168.220.1

Specify the address to listen on Bind to the interface server=8.8.8.8 # Use Google DNS domain-needed

Don'tforward short names bogus-priv # Drop the non-routed address spaces. dhcp-range=192.168.220.50,192.168.220.150,12h # IP range and lease time

####end of file####

sudo nano /etc/sysctl.conf

####start of file####

net.ipv4.ip_forward=1

####end of file####

sudo sh -c "echo 1 > /proc/sys/net/ipv4/ip_forward" sudo iptables -t nat -A POSTROUTING -o wlan0 -j MASQUERADE sudo reboot sudo systemctl restart dnsmasq.service sudo systemctl daemon-reload sudo sh -c "iptables-save > /etc/iptables.ipv4.nat" sudo nano /etc/rc.local

####start of file####

#!/bin/sh -e

rc.local This script is executed at the end of each multiuser runlevel. Make sure that the script will "exit 0" on success or any other value on error. In order to enable or disable this script just change the execution bits. By default this script does nothing. Print the IP address _IP=$(hostname -I) || true if [ "$_IP" ]; then printf "My IP address is %s\n" "$_IP" fi

iptables-restore < /etc/iptables.ipv4.nat

exit 0

####end of file####

sudo nano /etc/iptables.ipv4.nat

####mine looks like this####

Generated by iptables-save v1.8.2 on Sun May 17 21:34:45 2020 *filter :INPUT ACCEPT [8429:5899839] :FORWARD ACCEPT [0:0] :OUTPUT ACCEPT [7033:785423] -A FORWARD -i wlan0 -o eth0 -m state --state RELATED,ESTABLISHED -j ACCEPT -A FORWARD -i eth0 -o wlan0 -j ACCEPT COMMIT

Completed on Sun May 17 21:34:45 2020 Generated by iptables-save v1.8.2 on Sun May 17 21:34:45 2020 *nat :PREROUTING ACCEPT [183:33480] :INPUT ACCEPT [183:33480] :OUTPUT ACCEPT [197:14662] :POSTROUTING ACCEPT [20:2492] -A POSTROUTING -o wlan0 -j MASQUERADE COMMIT

Completed on Sun May 17 21:34:45 2020 ####end of file####

sudo systemctl restart dnsmasq.service sudo systemctl daemon-reload

####end###

If its not working maybe reboot.

Hope this helps!

jaylfc avatar May 26 '20 22:05 jaylfc

Hi everyone, is your problem solved?

I seem to meet the same problem and created a PR for a fix I would offer you to test (if applicable) https://github.com/arpitjindal97/raspbian-recipes/pull/50

Any help is welcome! =)

Vincent14 avatar Mar 08 '21 12:03 Vincent14

Well I don't think the problem is solved.. I found out that the script still only works when there is nothing connected to the ethernet-port. I have to boot the Pi, execute the script, and only then connect a device to the ethernet port, otherwise it will not work. Devices will get an ip-address, but always state 'no internet connection'. I don't know how to help directly, but I'm loving the script so I'm hoping we can solve this thing together.

vincentkoevoets avatar May 11 '21 22:05 vincentkoevoets