Many ask and do not find the solution how to share the data connection that we have contracted with our iphone and use it with UbuntuIn this way, we would not spend on hiring another internet rate. |
The connection will be made via Bluetooth. It could also be done with cable but I think it is faster over bluetooth and the connection works very well.
For this we need an application called Blueman, which is responsible for connecting the iPhone with our PC.
We open the terminal and add the corresponding repository. Then we update the system and install blueman:
sudo add-apt-repository ppa: blueman / ppa
sudo apt-get update
sudo apt-get install blueman
Now we only have to turn on the bluetooth on our PC and on the iPhone. We search and link the device and everything is working.
Thanks Kynacom!
A silly question ... I have the iPhone 4, does this work without jailbreak?
Hello, could you explain how to share the internet that a laptop with ubuntu receives and a desktop pc with a debian squeeze?
From already thank you
Very good blog
On the computer that has internet, do the following:
sudo iptables -t nat -A POSTROUTING -o wlan0 -j MASQUERADE
sudo su
echo 1> / proc / sys / net / ipv4 / ip_forward
In addition, you have to configure the cable connection (with the other computer) like this for example:
IP: 192.168.2.3
mask: 255.255.255.0
Gateway: 0.0.0.0
dns-server: the same as for the internet connection, in my case 192.168.1.1
On the isolated computer, configure the wired network like this:
IP: 192.168.2.1
mask: 255.255.255.0
Gateway 192.168.2.3
dns-server: the one for the internet connection, in my case 192.168.1.1
Try it to see if it works
-
If everything went well, you have to fix the changes so that they are maintained. Otherwise, in the next boot we will lose the iptables configuration.
sudo leafpad /etc/sysctl.conf
look for the following lines:
# Uncomment the next line to enable packet forwarding for IPv4
# net.ipv4.ip_forward = 1
delete the pound sign from the second line, looking like this:
# Uncomment the next line to enable packet forwarding for IPv4
net.ipv4.ip_forward = 1
save and close
then create the following file:
sudo leafpad /etc/init.d/firewall
with this content:
#! / Bin / sh
# Script to enable internet connection sharing
# Cleaning the rules
iptables-F
iptables-X
iptables -Z
iptables -F -t nat
iptables -X -t nat
iptables -Z -t nat
iptables -F -t mangle
iptables -X -t mangle
iptables -Z -t mangle
iptables -F -t filter
iptables -X -t filter
iptables -Z -t filter
# Enable sharing
iptables -A INPUT -i eth0 -j ACCEPT
iptables -t nat -A POSTROUTING -o wlan0 -j MASQUERADE
iptables -A FORWARD -i eth0 -j ACCEPT
and now we give it execution permissions:
sudo chmod + x /etc/init.d/firewall
and we put it in the system startup as follows:
sudo ln -s /etc/init.d/firewall /etc/rc2.d/S99firewall
sudo ln -s /etc/init.d/firewall /etc/rc3.d/S99firewall
sudo ln -s /etc/init.d/firewall /etc/rc4.d/S99firewall
sudo ln -s /etc/init.d/firewall /etc/rc5.d/S99firewall
that's it. reboot and test
Hmm… it's a good question. The truth is I do not know. It will be a matter of testing it.
Let us know if you were successful! 🙂
Cheers! Paul.
This is what I like the most about the Linux community. We can all help each other, there are no "teachers" and "students", we just all give each other a hand. Some know more about some things, others about others, etc.
Thank you for answering and sharing your knowledge!
A big hug! Paul.
Thanks, you're very kind !!!!!
I will try it
you're welcome, sir! if you get stuck in any step, let us know
you're welcome, sir! in truth, every time I get some little "feat" I save in a "util" folder of my home a txt file with the instructions, then when I have seen the question I have only had to copy and paste the content of the file, and put next to the dns "in my case". This saving the recipes is the best thing that has occurred to me, I am no longer afraid that something will be misconfigured or having to reinstall, since following the recipe in 5 minutes you have it walking.
greetings and thanks for the blog