3G Wireless Router Based on Raspberry Pi2

This is a 3G wireless router based on Raspberry Pi 2. The raspberry pi which is capable of running various linux distros can be used to do various stuffs and interesting utilities. I had made this 3g router with the help of raspberry pi 2 along with TP-LINK TL-WN722N and MTS cdma data card but any data card with good linux drivers can be used. As well as any wifi usb adapters with AP mode can be used.

Teacher Notes

Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.

Step 1: Requirements

  • USB Power Adapter with 5V and 1A or 2A output
  • Raspberry Pi 2
  • 3G usb data card
  • USB wifi adapter with AP mode support (TP-LINK TL-WN722N)
  • 4gb or 8gb memory card with Raspbian OS preinstalled. ( For installation guide just google it.)
  • Ethernet cable (optional)
  • Monitor, keyboard, mouse (optional if configuration is done through SSH).

Step 2: Setup

Basically we are going to connect the raspberry pi 2 to the internet through 3g data card. And going to share the network through Ethernet and WLAN. For detailed configurations you can view this link ( https://wiki.archlinux.org/index.php/Sharing_PPP_C... ).

  • As you boot into raspbian os for the first time, enable sshd through raspi-config page or manually through terminal. Don't boot into graphical interface and dont enable booting into graphical mode. Because that is not necessary.
  • Connect the raspberry pi to the power and ethernet cable from PC or router you already have which should be connected to internet ( necessary to complete the setup).
  • After raspberry pi is connected to the internet. Update and upgrade the raspbian os by typing " sudo apt-get update " and " sudo apt-get upgrade "
  • Now install following packages " sudo apt-get install iptables dnsmasq wvdial usb-modeswitch hostapd iw" .
  • This completes the installation of required packages for the 3G wireless router to work properly. Now we move on to the configurations and necessary steps to complete the build.

Step 3: WVDIAL Setup

  • Type this in terminal: " sudo nano /etc/wvdial.conf ". then edit the configuration to suit your 3g data card. I used a cdma data card.

[Dialer Defaults]

Init1 = ATZ

Init2 = ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0

Modem Type = Analog Modem

Baud = 460800

New PPPD = yes

Modem = /dev/ttyUSB0

ISDN = 0

Phone = ####

Password = password

Username = username

stupid mode = 1

  • Copy and paste this in the wvdial.conf file but put your username and password and change the phone dial number to the appropriate number of your ISP provider.
  • Press CTRL + X and type yes to save the configuration file.
  • This completes the necessary setup to connect to the internet. now by typing " sudo wvdial " in the terminal you can connect to the web.

Step 4: Router Configuration Setup...

  • Now edit dnsmasq file by typing " sudo nano /etc/dnsmasq.conf ". (we are going to bridge ethernet and wlan connection).
  • Append the following line into the file and save the file.


interface=eth0 # change to your chosen interface




  • Disconnect the ethernet cable. ( Internet is no more needed ).
  • Now connect WiFi USB adapter and type " iw list ".
  • The output of this command should have a line bearing " AP MODE ". This assures that your wifi adapter will work as hotspot.
  • Now edit network interfaces file by typing " sudo nano /etc/network/interfaces " and copy the following content and replace the contents that is already present.

auto lo
iface lo inet loopback

auto ppp0

iface ppp0 inet wvdial

auto eth0

iface eth0 inet static



auto wlan0

iface wlan0 inet static



hostapd /etc/hostapd/hostapd.conf

  • Now edit the sysctl file by typing " sudo nano /etc/sysctl.conf " and uncomment the following line to enable packet forwarding for IPV4. " net.ipv4.ip_forward=1 "

  • Next we move on to wifi setup.

Step 5: WLAN Setup

  • Most of the work has been done. So now we edit hostapd config file for wifi configuration. by typing " sudo nano /etc/hostapd/hostapd.conf "

driver=nl80211 #driver=rtl871xdrv








wpa_passphrase= WIFI PASSWORD




  • You have to edit SSID name and wifi password as you like.

Step 6: Last Step..

  • type the following lines in terminal

iptables -t nat -A POSTROUTING -o ppp0 -j MASQUERADE

sudo sh -c "iptables-save > /etc/iptables.ipv4.nat"

  • This makes the firewall to allow packets in and out of the network.
  • Now open /etc/network/interface file and add the following line at the end of it.

pre-up iptables-restore < /etc/iptables.ipv4.nat

  • This completes the router setup. Now reboot the raspberry pi2 and make sure that 3g data card, wifi adapter and ethernet(optional) is connected.
  • Now you can find the WIFI running with the name given by you and by connecting ethernet also you can use the internet. If some problem detected, SSH into the raspberry pi and its ipaddress is and troubleshoot it. Or just reboot itself solves most of the problem you face while running this router.
  • Thank you and enjoy!!!!
Raspberry Pi Contest

Participated in the
Raspberry Pi Contest

Be the First to Share


    • CNC Contest

      CNC Contest
    • Make it Move

      Make it Move
    • Teacher Contest

      Teacher Contest

    13 Discussions


    3 years ago

    I wish to make a common comment to all people who are trying to do this project. If you are trying this with raspbian debian 7, No problem, You can use this setup.

    But if you are using latest raspbian image, This procedure wont work. In 1st week of may I will edit this procedure to suit for all OS images of Raspberry pi.


    2 years ago

    That's a great instructable!

    I was just thinking, would it be possible to access WVDIAL through python and use it to limit the data usage or user access?


    3 years ago

    I made some changes to suit raspbian latest OS . Hope this setup will help to build wifi-router at an affordable cost.

    DeviprasathDi Immortales

    Reply 3 years ago

    No additional costs... Just like how you use it with laptop or PC


    3 years ago

    please tell me is this config setting of cdma data card is universal can i use it with TU500 or zte 8700 evdon modem TU500 modem vid 0x15eb:Pid0x7152 and AC8700 Vid19d2:pid0xfffe please clear it . i was tried to add it but not able to connect.

    1 reply

    Reply 3 years ago

    Yeah, this config is universal. But check whether your data card is switching properly to modem or is it staying in memory mode. you can check it with lsusb command. ( Teracom cards had this issue)


    4 years ago on Introduction

    so, is this an access point for a pre-existing isp, or can I drop comcast and use only this? (Ignoring the loss of data speeds)

    1 reply

    Reply 4 years ago on Introduction

    you can use this for any ISP. this is not restricted to certain ISP. if you are using data cards and trouble connecting other devices to web, this will help.. this is just like 3g routers available on market.. like for example tp-link mr3020.


    We are connecting to the web using a 3g data card which is connected to raspberry pi2 and then we are sharing it through ethernet and Wifi. This is very useful if you have devices like Ipad(wifi only) which cant use sim card.