0

I have followed the following tutorial to setup Hotspot on RPi with a 4G Dongle.

For 4G Modem i use Sakis 3g Scripts.

It works fine.

But when I try to connect my PC to the ethernet port of the RPi it doesn't work.

I would like to know what changes would be required to done extra to get dhcp service + internet from ppp0 to be provided through eth0. Changes that would be based on the following tutorial

https://frillip.com/using-your-raspberry-pi-3-as-a-wifi-access-point-with-hostapd/

In particular I want that devices can connect by wifi to the access point and with an cable to the ethernet port. All connected devices (ap and eth) are on the same subnet 172.24.1.0/24 and get an ip address by DHCP from the RasPi. Also all devices should connect to each other and should be able to go into the internet provided by the 4G dongle.

How can I achieve this?

edit for questions by ingo

  • Yes. DHCP Server - dnsmasq is running.
  • I am not sure about dhcp available from ppp0 - by the way dnsmasq isn't configured for ppp0.
  • I also have got wwan0
  • ip addr when ppp0 is up is as follows
pi@Numbers:~ $ ip addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether b8:27:eb:4c:e7:08 brd ff:ff:ff:ff:ff:ff
    inet 169.254.168.1/16 brd 169.254.255.255 scope global eth0
       valid_lft forever preferred_lft forever
    inet6 fe80::f3f2:62b6:8d2b:626/64 scope link 
       valid_lft forever preferred_lft forever
3: wlan0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether b8:27:eb:19:b2:5d brd ff:ff:ff:ff:ff:ff
    inet 172.24.1.1/24 brd 172.24.1.255 scope global wlan0
       valid_lft forever preferred_lft forever
    inet6 fe80::ba27:ebff:fe19:b25d/64 scope link 
       valid_lft forever preferred_lft forever
4: wwan0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UNKNOWN group default qlen 1000
    link/ether 00:1e:10:1f:00:00 brd ff:ff:ff:ff:ff:ff
    inet 169.254.62.145/16 brd 169.254.255.255 scope global wwan0
       valid_lft forever preferred_lft forever
    inet6 fe80::b0b4:a7ba:fee8:b03/64 scope link 
       valid_lft forever preferred_lft forever
5: ppp0: <POINTOPOINT,MULTICAST,NOARP,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UNKNOWN group default qlen 3
    link/ppp 
    inet 100.84.30.212 peer 10.64.64.64/32 scope global ppp0
       valid_lft forever preferred_lft forever

DNSMASQ.CONF
interface=wlan0
listen-address=172.24.1.1
bind-interfaces
server=8.8.8.8
domain-needed
bogus-priv
dhcp-range=172.24.1.50,172.24.1.150,12h

Regards Kashyap

  • You have three interfaces, ppp0 from your 4G dongle, wlan0 and eth0. wlan0 is for the access point. I assume the internet connection is through the 4G dongle. On the RasPi is a DHCP server (dnsmasq) running for the access point. Can you confirm this? Is there also a DHCP server available from ppp0? Devices connected to eth0 should get its ip address from what DHCP server? What subnets are on the interfaces? Can you please edit your question and add the output of this command ip addr when ppp0 is up? – Ingo Aug 30 '18 at 8:53
  • @Ingo Just updated the question. – Kashyap Gada Aug 30 '18 at 12:08
  • I also have updated your question with details and with tags. Please correct if it it doesn't match. To be sure with routing on wwan0 and ppp0 can you please add the output from this command ip route show when ppp0 is up? – Ingo Aug 30 '18 at 15:51
  • @Ingo Previous ip routes were routing in/out packets from ppp0 to wlan0. I changed that part to ppp0 to eth0 and it started working. Also assigned static IP in /etc/network/interfaces to eth0 along with dhcp ip range in dnsmasq. – Kashyap Gada Sep 3 '18 at 9:38
  • Does it work now? Please make an answer and explain what you have done. – Ingo Sep 3 '18 at 21:23
0

I did the following to correct my iproute tables

sudo iptables -t nat -A POSTROUTING -o ppp0 -j MASQUERADE
sudo iptables -A FORWARD -i ppp0 -o wlan0 -m state --state RELATED,ESTABLISHED -j ACCEPT
sudo iptables -A FORWARD -i wlan0 -o ppp0 -j ACCEPT

This gave connection to wlan + eth from ppp interface

Thanks @ingo for you suggestions.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.