LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 10-22-2019, 08:39 AM   #1
Sphinix
LQ Newbie
 
Registered: Oct 2019
Posts: 4

Rep: Reputation: Disabled
Wink Internet sharing from ppp0 to uap0 [Hotspot] in linux based embedded board


Hi,

I am working on a task ,internet sharing between two interfaces ppp0 and uap0 which is the hotspot interface .

ppp0 gets internet connection . I am able to ping google. And the IP here keeps on changing

uap0 is the interface which is used for hotspot connection of the board. I have set an IP of 192.168.10.1 to this interface and runs an dhcp server. My phone gets connected to the board via uap0 and gets an IP of 192.168.10.2

I am expecting an internet connection in my phone. But it is not happening

internet <-----> ppp0 <-----> uap0 <-----> phone

Once both the interfaces are up , my routing table is something like this
Code:
   Kernel IP routing table
   Destination     Gateway         Genmask         Flags Metric Ref    Use Iface

   0.0.0.0         0.0.0.0         0.0.0.0         U     0      0        0 ppp0

   192.168.10.0    0.0.0.0         255.255.255.0   U     0      0        0 uap0
And I tried below iptable rules
Code:
 echo 0 > /proc/sys/net/ipv4/ip_forward
iptables -P INPUT ACCEPT
iptables -P OUTPUT ACCEPT
iptables -t nat -I PREROUTING -i ppp0 -j DNAT --to-destination 192.168.10.0
iptables  -A FORWARD -m state --state ESTABLISHED -j ACCEPT
iptables -A FORWARD -t filter -i ppp0 -o uap0 -s 10.212.17.0 -p tcp --dport 8
iptables -A FORWARD -t filter -i uap0 -o ppp0 -d 192.168.10.0 -p tcp --sport 80
iptables -t nat -A POSTROUTING -o ppp0 -s 192.168.10.0/24 -j SNAT --to-source 10.212.17.0
echo 1 > /proc/sys/net/ipv4/ip_forward
When I checked whether iptable rules are getting hit, there are no forward packets getting incremented

Whether the iptable rules are proper.? Or should I make any changed to the routing table. I am a newbie to
iptables and NAT related concepts.

Any help would be appreciated.

Last edited by Sphinix; 10-22-2019 at 08:44 AM.
 
Old 10-22-2019, 11:03 AM   #2
business_kid
LQ Guru
 
Registered: Jan 2006
Location: Ireland
Distribution: Slackware & Android
Posts: 10,657

Rep: Reputation: 1182Reputation: 1182Reputation: 1182Reputation: 1182Reputation: 1182Reputation: 1182Reputation: 1182Reputation: 1182Reputation: 1182
ppp0 needs to forward it's own traffic to the internet, and I gather that's happening.

uap0 needs to forward everything to ppp0. Is that happening? are uap0 & ppp0 on the same box?

uap0 also needs to run a dhcp server. The kernel may need to have ipv4 forwarding enabled.

Now I don't wan to do your homework for you. So in the words of Jean-Luc Picard: "Makeit So!"
 
1 members found this post helpful.
Old 10-23-2019, 12:47 AM   #3
Sphinix
LQ Newbie
 
Registered: Oct 2019
Posts: 4

Original Poster
Rep: Reputation: Disabled
Thanks for the reply.

-> uap0 needs to forward everything to ppp0. Is that happening? are uap0 & ppp0 on the same box?

uap0 and ppp0 belongs to a single board. From the output of "watch -n1 iptables -vL", the forward packets count is zero. So I concluded the forwarding is not happening.

-> uap0 also needs to run a dhcp server. The kernel may need to have ipv4 forwarding enabled.
 
Old 10-23-2019, 12:47 AM   #4
Sphinix
LQ Newbie
 
Registered: Oct 2019
Posts: 4

Original Poster
Rep: Reputation: Disabled
Hi ,

Thanks for the reply.

-> ppp0 needs to forward it's own traffic to the internet, and I gather that's happening.

Yup. This is happening.

-> uap0 needs to forward everything to ppp0. Is that happening? are uap0 & ppp0 on the same box?

From the output of "watch -n1 iptables -vL I can see no increment in number of packets forwarded . I believe,packet forwarding is something that need attention
uap0 and ppp0 belong to same board

->uap0 also needs to run a dhcp server. The kernel may need to have ipv4 forwarding enabled.

uap0 has a dhcp server running. Also I have enabled the ipv4 forwarding using "echo 1 > /proc/sys/net/ipv4/ip_forward" . And routing related macros in Kernel are enabled and rechecked. I wonder is there anything else which contribute to ip forwarding and that exactly I am missing

Last edited by Sphinix; 10-23-2019 at 12:57 AM.
 
Old 10-24-2019, 05:48 AM   #5
business_kid
LQ Guru
 
Registered: Jan 2006
Location: Ireland
Distribution: Slackware & Android
Posts: 10,657

Rep: Reputation: 1182Reputation: 1182Reputation: 1182Reputation: 1182Reputation: 1182Reputation: 1182Reputation: 1182Reputation: 1182Reputation: 1182
A few things can hold you up.

Off the top of my head
  • Your kernel routing table. uap0 needs to funnel stuff to ppp0. ppp0 needs to see the outside world. Programs are inclined to hack this every time, so be careful.
  • Your dhcp server needs to have and forward dns server numbers to everything that signs on unless you're also running a dns server.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Kernel Testing using LTP on Beagle board (ARM based Embedded Dev Board) Rajender.G Linux - Newbie 0 07-27-2011 06:19 AM
Need help to migrate from mikrotik hotspot to Linux Hotspot for I-net cafe.. thewhitelion Linux - Enterprise 5 10-03-2007 06:14 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

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

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration