Page 1 of 1

Sharing 3G internet connection over ethernet

Posted: Fri Jan 31, 2014 12:36 pm
by M1chl
Hi, I am new to Pi and to the Linux. I want to create a simple bridge from ppp0 (which is CDMA modem connected by USB) to eth0. I tried a lot of tutorials out there and nothing seems to work.

I have a cdma connection up and running and I can browse internet on Raspbian. However I haven't figured out how to share this connection through ethernet. I set eth0 to static ip address by editing /etc/network/interfaces and after that I ping a router ,where I want to share internet to, without a problem.

After that I set iptables like this: iptables -t nat -A POSTROUTING -o ppp0 -j MASQUERADE

And start forwarding like this: sysctl net.ipv4.ip_forward=1

After this step my Raspberry runs at 100% communicating with router like crazy, but on router I have no internet. Can someone help me? I am trying to figure this out for like 2 days without any success and I really need to get this running : (

Thanks for any suggestions!

Re: Sharing 3G internet connection over ethernet

Posted: Fri Jan 31, 2014 1:08 pm
by drgeoff
Are you connecting the RPi to a LAN port on the router or to its WAN port?

Re: Sharing 3G internet connection over ethernet

Posted: Fri Jan 31, 2014 1:10 pm
by FLYFISH TECHNOLOGIES
Hi,
M1chl wrote:After this step my Raspberry runs at 100% communicating with router like crazy, but on router I have no internet.
If I understand correctly, you have in the local network RasPi + a router box (+few computers, printer, NAS, ...) ?
If so, then you can have two options:
a) the first is that your computers, printer, NAS, etc. are connected to the router LAN ports and router's WAN port is connected to RasPi's eth0 port.
b) that you "disable" router (it remains switch only) and connect all boxes into same LAN (RasPi's eth0 is also connected to router LAN port).

The main diference between these two options is that in first case the router remains router - it should route local packets to RasPi (eth0) and RasPi then routes these packets to 3G (ppp0). This is a kind of double-stage routing (and here you need to have two IP ranges, one for RasPi eth0 and Router WAN port, and the second for remaining boxes/interfaces)...
With the second option you have more common case, but you have to take care that routing set on all computers, printer, NAS, etc. is not router's LAN (internal) IP, but RasPi's eth0 IP.

I'd go with the second option. In this case you need to check that default gateway on all your computers, printer, NAS, etc. is set to RasPi's eth0 interface instead of the router's internal IP. If you use DHCP, this is the place where to check/update the setting.


Best wishes, Ivan Zilic.

Re: Sharing 3G internet connection over ethernet

Posted: Fri Jan 31, 2014 7:57 pm
by M1chl
So I figured out where I had a mistake. I configured static ip wrong as I set a gateway address to ip of router and this caused the 100% load and non functional solution for sharing the internet. It wasn't even Linux mistake, I should have known better after graduated from Windows Server in high school. I am just so scared of Linux, that I made these stupid mistakes. Thanks for the help and sorry for late reply. Looking back, it was actually pretty straight forward and easy to set up something like this...