issues accessing internet from a raspberrypi via ethernet

Hi everybody!
I have this setup:
-internet connection from a smartphone acting as hotspot;
-desktop PCs (manjaro gnome 3.34) connected to the smartphone via WIFI;
-a raspberryPI modelB (latest raspbian) connected to a PC via ethernet.

Rpi and PC can see each other in LAN and I can even login via SSH.
When I want to join the internet from RPI through the LANned PCS, I have no access (RPi WIFI is not an option).
I only tried changing dhcpd.conf in RPI and set a basic static profile, eg:
static 192.168.123.104/24
router 192.168.123.1
dns 208.67.222.222

Any advice?
Thank you!

Did you set up your Destop PC to share the internet connection? Do you use a static IP setup between your RPI and your PC, or some kind of DHCP running on your PC.

Make sure your PC can forward IP packages and make sure your set up a NAT between your RPI-PC and PC-Wifi network. You should use different sub nets for each of these networks.

You can find more detailed instructions in the wiki.
https://wiki.archlinux.org/index.php/Internet_sharing

Hi!
Thank you for your reply!
PHONE <-wifi automatic DHCP=fully automatic 192.168.43.x -> PC (Static) <- LAN eth0 static 192.168.123.x -> RPI (DHCPd with static eth0 entry)

According to ARCHwiki:

sysctl net.ipv4.ip_forward=1 --> OK

then:
sudo ip link show
sudo iptables -t nat -A POSTROUTING -o wlp2s0 -j MASQUERADE
sudo iptables -A FORWARD -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT
sudo iptables -A FORWARD -i enp3s0 -o wlp2s0 -j ACCEPT

RESULT: NOT WORKING YET

I get:
ip route show
default via 192.168.43.1 dev wlp2s0 proto dhcp metric 600
192.168.43.0/24 dev wlp2s0 proto kernel scope link src 192.168.43.169 metric 600
192.168.123.0/24 dev enp3s0 proto kernel scope link src 192.168.123.101 metric 100

Doubt: on PC network manager, as I establish static IP 192.168.123.101 net mask 255.255.255.0, which gateway address is correct? 192.168.123.1?

Than you!

The following is only for the PC - RPI network.

PC with a static IP ( Sometimes the NetworkManager isn't too happy about static IP setups if it can't detect an up link. This is often the case if the RPI does reboot or is off.)

PC settings:

IP:      192.168.123.101
Netmask: 255.255.255.0

Do not set up a Gateway, also DNS is not required. It should look like this
Untitled

Of course you can use 192.168.123.1 if you want.

On the RPI set it up like that

IP: 192.168.123.104
Netmask: 255.255.255.0
Gateway: 192.168.123.101
DNS: 208.67.222.222

The Gateway needs to be the IP of your PC. Because the RPI need to send all the packages to your PC and your PC needs to recognize that it is the target. The PC does not need a gateway in this PC - RPI network, because it is the target. It will route the packages thru the NAT to the wifi interface. Your PC needs only a Gateway on the PC - Smartphone Network. But this is usually set up by NM with information form the DHCP of your Smartphone.

Thank you, Xabbu.
Rpi goes on throwing this error: temporary failure in name resolution

Just for sake: in rpi > /etc/dhcpcd.conf:
profile eth0
static ip_address=192.168.123.104/24
static router=192.168.123.101
static domain_name_servers=208.67.222.222

UPDATE:
in /etc/dhcpcd.conf (RPI):
changing "profile eth0" to "interface eth0"+reboot
did the magic!
Now internet sharing is active (it is only dead slow, in my case)

Thank you again, Xabbu

This depends on how you set up your DNS. Also I never used DHCP Client to set up a static IP address.
I did not try the last releases of Manjaro ARM, but in the past there were a problem with to many DHCP Clients starting and doing wired things. Simply verify if the correct IP and routes are created on the RPI.

Usually debug somethings like this try to ping first.
All from the RPI

ping  -c 4 192.168.123.101

then ping the wifi interface address

ping -c 4 192.168.43.169

then try to ping your Smartphone

ping -c 4 192.168.43.1

The IP addresses form the 192.168.43.0/24 network might be wrong. Check if they are correct.

Now you can try to ping a real internet IP

ping -c 4 8.8.8.8

If that all works, you can check your DNS setup. Do you use systemd-resolved or the good old resovle.conf with something like openresolv?

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.

Forum kindly sponsored by