User Tools

Site Tools


Sidebar

* [[start]] * [[som|System on module]] * [[usomiq-beaglebone|Mentorel Beaglebone uSomIQ]] * [[usomiq|uSomIQ AM335x]] * [[somiq|SomIQ family]] * [[blueshark|BlueShark family]] * [[devkit|DevKits]] * [[usomiq-bone-cape|uSomIQ Bone Cape]] * [[somiqboard|Somiqboard]] * [[atoll|Atoll]] * [[expansion|Expansion boards]] * [[somiq-wlan|SomIQ-WLAN]] * [[os|OS support]] * [[ubuntu|Ubuntu Linux]] * [[sw-hints|SW hints]] * [[tslib|Tslib]] * [[qt-embedded|Qt embedded]] Follow us * [[http://twitter.com/mentorel|Twitter]] * [[http://www.linkedin.com/company/mentorel|LinkedIn]] * [[https://www.facebook.com/mentorel.company|Facebook]] * [[https://plus.google.com/105868322858146792212/posts|Google+]] * [[http://www.mentorel.com|MENTOREL home page]]

ubuntu-share-3g

How to share 3G Connection over LAN on Ubuntu

I have a 3G connection on Ubuntu which I want to share to the rest network. What I need to to do is to make Ubuntu act as a NAT router to be able to share this connection.

Internet ↔ 3G Stick ↔ Ubuntu ↔ eth0—Lan

From terminal:

sudo iptables -A FORWARD -o ppp0 -i eth0 -s 192.168.1.0/24 -m conntrack –ctstate NEW -j ACCEPT

#where ppp0 is 3G connection and eth0 the lan interface and 192.168.1.0 my LAN subnet.

sudo iptables -A FORWARD -m conntrack –ctstate ESTABLISHED,RELATED -j ACCEPT
sudo iptables -t nat -F POSTROUTING
sudo iptables -t nat -A POSTROUTING -o ppp0 -j MASQUERADE

#Edit /etc/rc.local and add the following lines before the “exit 0″ line:

sudo iptables-save | sudo tee /etc/iptables.sav
sudo sh -c “echo 1 > /proc/sys/net/ipv4/ip_forward”

The ip address of eth0 is 192.168.1.1 so on client side I give this address as default gateway.Note that on this scenario I use static ip addresses on all clients as I have not setup dhcp server on ubuntu.

ubuntu-share-3g.txt · Last modified: 2013/05/31 00:26 (external edit)