Caurse some of my friends have bought this modem fro 3.dk - they still wanted to be able to have more than one Computer on the internet - and have been told from 3 - that it was possible to buy a router that could handle that - for 4000danish kt. Way to much - At the same time they bougth a house in the country where 3 had no good coverage - so we needed to make this work untill they could get rid of the 3G modem - so here's what I did:
I started out with moving my mailserver from my Lexcom lexligth and installed Ubuntu Gutsy 7.10 on it.
Started out after the install by editing /etc/apt/sources.list and enabled all repos in that file ( Not enabled as standard). Afterwards I installed the following packages for being able to make it all work:
|
$ apt-get update |
The DHCP-server is quite easy - but needed to fill in the info about the DNS server in the conf-file - so I'd made at subnet internal for them in the range: 172.16.7.0/24 - that'll means they got 254 IP adresses on their sybnet. I ended up with a configurationfile for the DHCP-server looking like this:
|
# # option definitions common to all supported networks... option subnet-mask 255.255.255.0; subnet 172.16.7.0 netmask 255.255.255.0 { #host confusia { |
As you can see here - the range for DHCP adresses are from 172.16.7.2 - 250 !
REMEMBER TO ADD THE DEFAULT INTERFACE TO /etc/default/dhcp
After that worked - I continued further on to getting the modem to work - luckly for me - there was already a guide for that - but still had to make some small changes for it to work. So started out with making the directory where I place all my scripts:
|
$ mkdir /scripts |
Started out with getting the modemdriver to the huwai modem and placed in the /scripts directory. You can download the driver here
And afterwards made the script for loading the rigth modules,drivers etc! It'll end up looking like this:
|
#!/bin/bash echo "removing USB-Storage.." echo "Loading modem" echo "Loading driver" echo "Connecting" |
As you can see in that script - we're ending up with calling the wvdial default configuration - therefor you need to add/edit the /etc/wvdial.conf default section to also holds these informations:
|
[Dialer default] |
This will get the Modem connection to connect to the 3.dk server with a POINT TO POINT connection. But it'll take around 15-20seconds before the connection is working. and the ligth in it will change from green to blue/violet!
But before that we need to check some things are working correct - we need to make sure the rigth modules etc are there - if there's not 3 units in /dev/ttyU* - remove the modem - wait 10seconds - plug it in again - run the script: here's what it should look like:
|
$ ls -lah /dev/ttyU* |
If there's not 3 lines - don't try connecting - it'll not work!
Now we need to make sure (since it should be a router/firewall) to make sure that the modem also connects after powerfailure etc! So I added these lines into /etc/rc.local:
|
echo "Starting Scripts for ppp0" |
Reason for sleep 30 - is when we're adding the firewall - We'll have to make sure that the modem connection works - othervise the firewall script will fail - caurse of unknown parameters.
Now reboot your machine - and check the console output to make sure the internet is comming up. If this is working - where ready to add the firewall to the machine.
The script I'd made is this:
|
#!/bin/bash # Setting up the interfaces # The IP-addresses for the interfaces #Networks # The machines on the net #------------------------------------------------------------------- echo echo # --------------------------------------------------------------- echo " Done" # Forwarding # Default Policies echo " Done" ## DNS ## ## ICMP ## echo " Done. INPUT chain is up and running" # -------------------------------------------------------------- # Accepting outgoing trafik # Rejecting Ident echo " Done. OUTPUT chain is up and running" ################################################################ echo " Done. LO is up and running" # -------------------------------------------------------------- echo " Done. LAN is up and running" # -------------------------------------------------------------- echo " Done. WAN is up and running" ################################################################ echo " Done. LANTOWAN chain is up and running" ################################################################ # Accepting only returntraffic to lan echo " Done. WANTOLAN chain is up and running" ################################################################ echo " Done. MASQUERADING is up and running" ################################################################## echo "Done. The chains are now activated" echo
|
And afterwards add also these lines ion /etc/rc.local in the bottom after sleep 30.
|
echo "Running firewall." exit 0 |
Well - now you're ready to reboot once more - and hopefully everything is working well.
FAQ:
Everything went well - but no internet:
Check out your route table with the command: route -vn
I discovered several times that no default gw was set - instead there was an empty line . So I did this:
|
$ route del default |
Which make the default gateway to be the gateway at 3.dk!
But my project was working without an default gateway - and without setting it in the route table.
Now everything should work - and hopefully you be able to get a router working along with a 3G modem.
I have put all the default configurationsfiles and scripts into a tar.gz archive - which can be downloaded here.
Hopefully have fun with it!