I don't know how many people who have a Linux Gateway have a need for something like this but I wondered if I would able to find something like this.
Let me first explain what I am blabbering on about.
I have multiple home PCs and each want internet access. Unfortunately my internet device is a USB one so I can't buy a router and use that, so I needed a PC that was dedicated to be on the internet when I want it. I didn't want the internet to be online 24/7 for security reasons and also connection stability reasons (sometimes the connection quality drops and so a quick disconnect & reconnect sometimes solves this problem).
OpenSuSE had a SMPPPd solution where you have KInternet clients (where KInternet is so far only a SuSE app) that connects to a SuSE Gateway which is running SMPPPd that handles the internet connection. Once a client has connected to that Gateway, s/he can control the internet connection and see what the traffic looks like in KB/s. The problem with this solution is... It's only for SuSE! So I needed something similar for Ubuntu.
The solution I found was by accident as one can see in this forum thread: Visual Real-time traffic monitor
I was looking for a realtime traffic monitor and hoped to just write my own app that can deal with the connections but thanks be to God (I have prayed for something like this, where I asked God to help me get this Gateway back up), I stumbled on an client app called QLineControl which is a Qt based app for Windows and Linux that acts as a client for Line Control. You can download the Windows version and you can get an "unstable" version from apt-get by adding the repository listed on that website.
From there I was led to LineControl (the server is called LineSrv) which is the Linux service which actually controls the internet connection. LineSrv (so far) is listed as an official Ubuntu package which you can get from apt-get.
It took a while to figure out what to do but thankfully I managed to get it to work.
The config file generated by the apt-get for LineSrv is faulty so you have to override with the default config file and go from there.
Here is what I did:
I copied the /usr/share/doc/linesrv/linesrv.conf to /etc/linesrv/.
Then I created 2 scripts for dialing up and disconnecting:
Dialup script
#!/bin/sh
ifup ib0 2> /dev/null > /dev/null
Hangup script
#!/bin/sh
ifdown ib0 2> /dev/null > /dev/null
I placed them in the /etc/ppp path.
The ib0 is my iBurst (internet device) interface, I have to do it like this otherwise it won't work, I am using the Debain dialer. Also LineSrv has to be root for this to work. Fortunately the init script that is setup via apt-get does that automatically.
I know the script looks funny but this is the script format that was followed in the sample scripts found in the LineSrv source files.
Then I modified the /etc/linesrv/linesrv.conf file:
- I set user_accounting to no since I don't want ppl to authenticate when dialing up
- I set currency to ZAR (Since I am from South Africa ;-) )
- I uncommented the 'line T-Online' line, you can call it anything you want after the 'line' part
- I uncommented the script_up, script_dn and interface and pointed them to the appropriate dialup, hangup scripts and the interface points to ppp0
- I uncommented 'con_type' and set it to 'netdev'
- I uncommented 'send_throughput' and set it to 'yes' since QLineControl client want this to know at what speed the internet traffic is heading
And now I am writing this post from this very configuration within Linux. I am quite surprised that such a solution even exists as I really thought that I would have to write my own app.
Well, there you go!
Cheers and God Bless!
No comments:
Post a Comment