2

I have a Raspberry Pi model B, a USB 3G dongle (ZTE MF667) and a Netgear WG602v3 access point. I'm wondering if it's possible to set up Raspberry Pi as a router that connects to the internet through the 3G dongle, and then use a network cable to connect it to Netgear WG602 and use the Netgear as a wireless access point for other devices?

The schematic would look more or less like this:

Internet <----> Rasp Pi w/ 3G dongle <-(wired network)-> Netgear WG602v3 <-----> Wireless Network

I currently have a Raspbmc installed on the Pi, but I can install Raspbian if needed.

I've found a ton of guides that describe using Raspberry Pi as a wireless access point, but I didn't find anything about using a separate device as an acess point, and just using the Pi as a router. Is it doable in any way?

Thanks

  • iptables will do what you need. Its hard core console or config only but it works a treat. Also you need your DHCP server to set the Pi as DNS, so yu also need DNS server on the Pi. Ideally you want another Ethernet connected directly to access point and the other one to your LAN, and DHCP on the Pi too. – Piotr Kula Aug 6 '14 at 16:34
1

Is it doable? Sure. It isn't any problem. You will need:

  1. working 3G connection interface
  2. ethernet link to wireless access point
  3. iptables configuration
  4. ip_forwarding
  5. dnsmasq daemon

ad 1. setup 3G connection so that default routing will be via it's interface – for instance wwan0

ad 2. connect RPi to netgear's uplink (internet port) with ethernet cable and setup network between them. It have to be not the same network as on your wireless network. You can control all your network with dnsmasq DHCP server and switch off DHCP in netgear – if it is possible. Maybe it will require a DHCP pass thought set in netgear's firewall. The best position is when all DHCP allocations are handled by RPi's dnsmasq. If it isn't possible use DHCP server in netgear (network 192.168.1.0 netmask 255.255.255.0) and DHCP server in dnsmasq (network 192.168.0.0 netmask 255.255.255.0) which will only supply address for netgear's uplink port – based on its mac address.

So, RPi's ethernet port will have static IP address 192.168.0.254 netmask 255.255.255.0, and netgear's uplink will get 192.168.0.1 netmask 255.255.255.0 from dnsmasq. Your wireless network in netgear will be 192.168.1.0 netmask 255.255.255.0.

ad 3. You need to masquerade traffic from netgear, so put this:

iptables -A INPUT -i $IFACE -m udp -p udp --dport 67:68 --sport 67:68 -j ACCEPT
iptables -A INPUT -i $IFACE -m udp -p udp --dport 53 -j ACCEPT
iptables -A INPUT -i $IFACE -m tcp -p tcp --dport 53 -j ACCEPT
iptables -A INPUT -i $IFACE -j DROP
iptables -t nat -A POSTROUTING -o OpokaVPN -j MASQUERADE

near the end of /etc/network/if-up.d/secure-rmc

ad 4. IP forwarding is also needed to be enabled. So uncomment

net.ipv4.ip_forward=1

in /etc/sysctl.conf.

ad 5. as written in 1. you can use dnsmasq for DHCP allocations on all your internal networks on just for supplying netgear's uplink port with network configuration. Dnsmasq is also a good, simple, caching DNS server for your clients. If you can use it on wireless network it would be the best. Dnsmasq can use dns servers from 3G connection or even better – google's 8.8.8.8 and 8.8.4.4 servers.

0

Using a USB ethernet adapter (you might need an external powered USB hub because of this) and iptables would be a solution for you.

You have a small guide here.

  • Hey neif! Welcome to the RPi.SE community, and thank you for your answer. It is always appreciated :-) However, we try to maintain a certain level of quality, and a brief summary of the guide is prefered vs just a link because the website can be down at anytime. It would be great if you could describe in a few steps the solution! ;-) – Morgan Courbet Sep 3 '14 at 13:26
0

It's definitely do-able. To have your RPi act as a router - assign IP addresses with DHCP to a LAN and use a WiFi signal as an uplink to an internet connection - you can try following this guide, slightly modifying it to suit your own needs with the 3G dongle rather than another WiFi network.

http://rbnrpi.wordpress.com/project-list/wifi-to-ethernet-adapter-for-an-ethernet-ready-tv/

You can forgive the "ethernet-ready-tv" part. Rather than directly connecting your ethernet cable to a tv, you can just as well connect it to a hub and will work just the same with multiple nodes.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.