Difference between revisions of "Use mobile internet 3g USB dongle as WAN"
(Created page with 'Use mobile internet 3g USB dongle as WAN<br>Author: psykopatpastorn<br><br>Disclaimer: no guarantees given. If you brick your unit, tough luck. Anyhow, it works neatly for me. I ...') |
|||
Line 1: | Line 1: | ||
Use mobile internet 3g USB dongle as WAN<br>Author: psykopatpastorn<br><br>Disclaimer: no guarantees given. If you brick your unit, tough luck. Anyhow, it works neatly for me. I hope I remember all the steps here.<br>Being a cheapskate, I have cancelled my ADSL internet and use the mobile internet 3g dongle at home. I get 3-4Mbit/s which is sufficient for my needs. <br>This is how I share the 3g internet connection over my home LAN (and Wifi if you like). The dongle is a Huawei E169 HSDPA USB stick, but it probably works with other dongles too.<br>If you care about security, start and finish by testing your external firewall (perhaps with some online test like http://www.auditmypc.com ). | Use mobile internet 3g USB dongle as WAN<br>Author: psykopatpastorn<br><br>Disclaimer: no guarantees given. If you brick your unit, tough luck. Anyhow, it works neatly for me. I hope I remember all the steps here.<br>Being a cheapskate, I have cancelled my ADSL internet and use the mobile internet 3g dongle at home. I get 3-4Mbit/s which is sufficient for my needs. <br>This is how I share the 3g internet connection over my home LAN (and Wifi if you like). The dongle is a Huawei E169 HSDPA USB stick, but it probably works with other dongles too.<br>If you care about security, start and finish by testing your external firewall (perhaps with some online test like http://www.auditmypc.com ). | ||
<br>#### Preparation phase:<br>1. stick the dongle into bubba2, let it settle for some seconds<br>2. apt-get install wvdial<br>3. copy the file contents at the bottom of this message into /etc/wvdial.conf, replacing any existing content<br>4. Unless you are using Tre Sweden, edit /etc/wvdial.conf (the INIT3-line and perhaps the PHONE-line is probably enough)<br>5. add this to /etc/network/interfaces : | <br>#### Preparation phase:<br>1. stick the dongle into bubba2, let it settle for some seconds<br>2. apt-get install wvdial<br>3. copy the file contents at the bottom of this message into /etc/wvdial.conf, replacing any existing content<br>4. Unless you are using Tre Sweden, edit /etc/wvdial.conf (the INIT3-line and perhaps the PHONE-line is probably enough)<br>5. add this to /etc/network/interfaces : | ||
<pre>auto ppp0 | <pre>auto ppp0 | ||
iface ppp0 inet wvdial</pre> | iface ppp0 inet wvdial</pre> | ||
<br> 6. unplug your WAN network cable if you have one (as you will temporarily disable the firewall)<br>7. edit the network parameters<br> | |||
6. unplug your WAN network cable if you have one (as you will temporarily disable the firewall)<br>7. edit the network parameters<br> | |||
<pre>/etc/init.d/bubba-firewall stop | <pre>/etc/init.d/bubba-firewall stop | ||
cd /etc/network | cd /etc/network | ||
cp firewall.conf firewall.conf.orig | cp firewall.conf firewall.conf.orig | ||
sed -i 's/eth0/ppp0/g' firewall.conf</pre> | sed -i 's/eth0/ppp0/g' firewall.conf</pre> | ||
8. keep the WAN network cable unplugged, you're switching to 3g wan anyway, and it's not safe as long as you use the modified firewall.conf. | 8. keep the WAN network cable unplugged, you're switching to 3g wan anyway, and it's not safe as long as you use the modified firewall.conf. | ||
<br>#### Test phase:<br>1. type wvdial. It should give you some output and initiate a working internet connection. If not, use the output to debug.<br>2. If it works, send it to background (C-z, then bg) and start the firewall: /etc/init.d/bubba-firewall start<br>3. you should now be up and running, and your LAN computers should have internet access<br>4. restart your bubba2 if you like to get rid of the terminal emulator used in this test, just to be sure the wvdial won't go down with it.<br><br>#### Production phase:<br>It should all just work now. The ppp0 network interface is set to auto start in /etc/networking/interfaces and the firewall will start as usual, only now using your modified firewall rules. NB: if you switch back to cable WAN, be sure to restore your firewall.conf from the copy you made and restart the firewall. Well, there it is. | <br>#### Test phase:<br>1. type wvdial. It should give you some output and initiate a working internet connection. If not, use the output to debug.<br>2. If it works, send it to background (C-z, then bg) and start the firewall: /etc/init.d/bubba-firewall start<br>3. you should now be up and running, and your LAN computers should have internet access<br>4. restart your bubba2 if you like to get rid of the terminal emulator used in this test, just to be sure the wvdial won't go down with it.<br><br>#### Production phase:<br>It should all just work now. The ppp0 network interface is set to auto start in /etc/networking/interfaces and the firewall will start as usual, only now using your modified firewall rules. NB: if you switch back to cable WAN, be sure to restore your firewall.conf from the copy you made and restart the firewall. Well, there it is. | ||
<pre>------ /etc/wvdial.conf -------------- | <pre>------ /etc/wvdial.conf -------------- | ||
Line 36: | Line 34: | ||
Modem Type = Analog Modem | Modem Type = Analog Modem | ||
New PPPD = yes | New PPPD = yes | ||
Password = ; | Password = ; | ||
Phone = *99# | Phone = *99# | ||
Stupid Mode = 1 | Stupid Mode = 1 | ||
Username = ; | Username = ; | ||
------ end of /etc/wvdial.conf ------ | ------ end of /etc/wvdial.conf ------ | ||
</pre> | </pre> | ||
Add this line to wvdial.conf:<br> | |||
<pre>Auto Reconnect = On | |||
</pre> | |||
There are some places which have "eth0" statically defined; Depending on your needs, you might want to update following files: | There are some places which have "eth0" statically defined; Depending on your needs, you might want to update following files: | ||
<pre>* /etc/dhcp3/dhclient-exit-hooks.d/bubba-easyfind | <pre>* /etc/dhcp3/dhclient-exit-hooks.d/bubba-easyfind | ||
Line 49: | Line 50: | ||
* /usr/lib/web-admin/easyfind.pl | * /usr/lib/web-admin/easyfind.pl | ||
* /usr/lib/web-admin/firewall.pl</pre> | * /usr/lib/web-admin/firewall.pl</pre> | ||
<br> | <br> |
Latest revision as of 11:07, 28 December 2010
Use mobile internet 3g USB dongle as WAN
Author: psykopatpastorn
Disclaimer: no guarantees given. If you brick your unit, tough luck. Anyhow, it works neatly for me. I hope I remember all the steps here.
Being a cheapskate, I have cancelled my ADSL internet and use the mobile internet 3g dongle at home. I get 3-4Mbit/s which is sufficient for my needs.
This is how I share the 3g internet connection over my home LAN (and Wifi if you like). The dongle is a Huawei E169 HSDPA USB stick, but it probably works with other dongles too.
If you care about security, start and finish by testing your external firewall (perhaps with some online test like http://www.auditmypc.com ).
#### Preparation phase:
1. stick the dongle into bubba2, let it settle for some seconds
2. apt-get install wvdial
3. copy the file contents at the bottom of this message into /etc/wvdial.conf, replacing any existing content
4. Unless you are using Tre Sweden, edit /etc/wvdial.conf (the INIT3-line and perhaps the PHONE-line is probably enough)
5. add this to /etc/network/interfaces :
auto ppp0 iface ppp0 inet wvdial
6. unplug your WAN network cable if you have one (as you will temporarily disable the firewall)
7. edit the network parameters
/etc/init.d/bubba-firewall stop cd /etc/network cp firewall.conf firewall.conf.orig sed -i 's/eth0/ppp0/g' firewall.conf
8. keep the WAN network cable unplugged, you're switching to 3g wan anyway, and it's not safe as long as you use the modified firewall.conf.
#### Test phase:
1. type wvdial. It should give you some output and initiate a working internet connection. If not, use the output to debug.
2. If it works, send it to background (C-z, then bg) and start the firewall: /etc/init.d/bubba-firewall start
3. you should now be up and running, and your LAN computers should have internet access
4. restart your bubba2 if you like to get rid of the terminal emulator used in this test, just to be sure the wvdial won't go down with it.
#### Production phase:
It should all just work now. The ppp0 network interface is set to auto start in /etc/networking/interfaces and the firewall will start as usual, only now using your modified firewall rules. NB: if you switch back to cable WAN, be sure to restore your firewall.conf from the copy you made and restart the firewall. Well, there it is.
------ /etc/wvdial.conf -------------- Code: Select all [Dialer Defaults] Area Code = Ask Password = 0 Auto DNS = 1 Baud = 460800 Carrier Check = 0 Compuserve = 0 Dial Command = ATD DialMessage1 = DialMessage2 = Force Address = ISDN = 0 Idle Seconds = 3000 Init1 = ATZ Init2 = ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0 Init3 = AT+CGDCONT=1,"IP","bredband.tre.se" Modem = /dev/ttyUSB0 Modem Type = Analog Modem New PPPD = yes Password = ; Phone = *99# Stupid Mode = 1 Username = ; ------ end of /etc/wvdial.conf ------
Add this line to wvdial.conf:
Auto Reconnect = On
There are some places which have "eth0" statically defined; Depending on your needs, you might want to update following files:
* /etc/dhcp3/dhclient-exit-hooks.d/bubba-easyfind * /etc/dhcp3/dhclient-exit-hooks.d/firewall_rewrite * /usr/lib/web-admin/easyfind.pl * /usr/lib/web-admin/firewall.pl