Hello everyone, this is my problem. I'm trying to share my VPN connection in my iPad to many other devices. What I'm trying:
I did this with a Mac with this little script:
Now I was trying to do the same but using my iPad instead of my Mac. What is the problem? In iOS ipfw or ipf don't work because there isn't kernel support. I can't use iptables either. But pf and pfctl actually work. IP forwarding works the same way.
nternet sharing from iPad to Mac at this point works. My VPN works with this interface: ppp0. To set up the NAT I use
I think this isn't the problem because my Mac can read my modem's IP and MAC adress (192.168.1.254 ) so it's passing through ppp0 and reaching my modem properly. As I'm using pf I start it and load my configuration file with
Here's my pf.conf file:
I think it loads fine because if you use
But I can't make it work :/. All commands in this post are from my iPad command line (not my Mac).
After I open a website in my iPad:
After I open a website on my Mac:
Some photos
netstat -rn: http://db.tt/rICiIphJ
ifconfig: http://db.tt/CPYvgBIe
- first IP Forwarding (to make my iPad act like gateway)
- then redirect ALL traffic to the VPN interface (ppp0)
- set ppp0 as a NAT
I did this with a Mac with this little script:
Code:
#!/bin/sh
natd -same_ports -use_sockets -unregistered_only -dynamic -interface ppp0 -clamp_mss
ipfw add divert natd ip from any to any via ppp0
ipfw add pass all from any to any
sysctl -w net.inet.ip.forwarding=1
Now I was trying to do the same but using my iPad instead of my Mac. What is the problem? In iOS ipfw or ipf don't work because there isn't kernel support. I can't use iptables either. But pf and pfctl actually work. IP forwarding works the same way.
# sysctl -w net.inet.ip.forwarding=1
Code:
iPad ip 192.168.1.64
gateway. 192.168.1.254
DNS. 8.8.8.8
Code:
Mac 192.168.1.69
gateway. 192.168.1.64
dns. 8.8.8.8
nternet sharing from iPad to Mac at this point works. My VPN works with this interface: ppp0. To set up the NAT I use
# natd -same_ports -use_sockets -unregistered_only -dynamic -interface ppp0 -clamp_mss
I think this isn't the problem because my Mac can read my modem's IP and MAC adress (192.168.1.254 ) so it's passing through ppp0 and reaching my modem properly. As I'm using pf I start it and load my configuration file with
# pfctl -e -f /pf.conf
Here's my pf.conf file:
Code:
ext_if = "ppp0"
pass out on $ext_if from any to any
pass in on $ext_if from any to any
I think it loads fine because if you use
# pfctl -s rules
this shows me the rules I just added:
Code:
pass out on ppp0 from any to any
pass in on ppp0 from any to any
But I can't make it work :/. All commands in this post are from my iPad command line (not my Mac).
# pfctl -s all
After I open a website in my iPad:
Code:
172.25.0.22 (iPad IP on the interface, see [FILE]ifconfig[/FILE] photo, for example) —> (IP from site im visiting) ESTABLISHED—->ESTABLISHED
After I open a website on my Mac:
Code:
192.168.1.69 ——> 8.8.8.8 (I established this as DNS, but I don't know why it's appearing here). SIMPLE———>NO_TRAFFIC (sometimes other error message)
Some photos
netstat -rn: http://db.tt/rICiIphJ
ifconfig: http://db.tt/CPYvgBIe