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.