LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Ubuntu (https://www.linuxquestions.org/questions/ubuntu-63/)
-   -   Ubuntu 20.04 with Raspberry Pi 3B plus (https://www.linuxquestions.org/questions/ubuntu-63/ubuntu-20-04-with-raspberry-pi-3b-plus-4175678747/)

vsayanam 07-15-2020 02:10 AM

Ubuntu 20.04 with Raspberry Pi 3B plus
 
Recently I tried connecting wlan0 of RPi 3 with Ubuntu-20.04 using Ethernet cable. This is to avoid using wi-fi adapter in the desktop. There are many elaborate suggestions in Google but simple instructions are needed. Using Google and Github postings the following steps were carried out:
1. Set up RPi 3 B+ with mobile hotspot, using built-in wi-fi adapter.
2. Configure RPi's Ethernet adapter as follows:

$sudo nano /etc/network/interfaces.d/eth0

Enter the code as below:

auto eth0
iface eth0 inet static
address 192.168.1.20
netmask 255.255.255.0
Save the code.
3. We now need to forward the ip from wlan0 to eth0. So we enter:

$sudo sysctl -w net.ipv4.ip_forward=1

4. Next, we allow the traffic through firewall:

$sudo iptables -A FORWARD --in-interface eth0 -j ACCEPT
$sudo iptables --table nat -A POSTROUTING --out-interface wlan0 -j MASQUERADE

5, In the desktop or laptop running Ubuntu we enter the Ethernet address as 192.168.1.50, netmask as 255.255.255.0, gateway as 192.168.1.20 (same as given for RPi). This is also possible from CLI as:

$sudo ifconfig eth0 192.168.1.20 netmask 255.255.255.0
$sudo route add default gw 192.168.1.20

This will work until reboot.For permanent setup, please enter:

$sudo sysctl -p /etc/sysctl.conf
$sudo apt install iptables-persistent

I had to reboot a few times to get this working.

pan64 07-15-2020 03:09 AM

the title is misleading, what you wrote is confusing (at least for me). And finally I have no any idea if you need any help. Do you have an issue to solve?

michaelk 07-15-2020 05:07 AM

I agree with pan64 this looks like a guide to setting up the Pi as a WiFi bridge/extension and not a hot spot.


All times are GMT -5. The time now is 04:04 PM.