hLan: Hrk's LAN Connection daemon & client
What is hLan?
From a
technical point of view, it's a daemon/client architecture which provides an abstraction layer upon a dialup device (RTG, ISDN, xDSL which acts on a pay-per-minute basis) used to share a connection to the Internet, avoiding concurrency issues and minimizing wasted time.
From
another point of view, hLan was born to avoid me and my sister killing each other.
Scenario
Internet is a cool thing and we want to use it. We like to surf the web, send/receive emails, do some filetransfers with FTP, chat with our friends over IRC and so on.
Since "we" is more than "I", we use more than one computer and we have a LAN: a "central" computer has a device which connects it to the internet, we installed Linux and on it and now we can use our own computer (not directly connected to the Internet) to do everything we want (if supported by IPTABLES) like if we were directly connected to the Internet. Whoho, this is fun. :-)
Nothing new.
Since our ISP charges up for every minute/second we are connected, we want this connection to last as long as we need it, but not a second more. This means that the () provided by some already existing Linux tools is not good for us: it connects when we need it (and some times when we don't want it!) and disconnects after a timeout we choose. 5 minutes of not using the connection? 10 minutes of not using the connection? 30 seconds of not using the connection? Choosing the timeout is not an easy task and, as far as I can think, it's a plain useless and stupid thing: whatever timeout will be wrong.
If we don't use dod, we need to manually login to the "server" (this will be the name of the computer with the device) and tell it to connect or disconnect. This works fine in terms of use (the connection will be online only when I choose it to be online) but has a bad concurrency problem: what happens if I issue a "connect" command to the server, then after two minutes my sister begins surfing the web on her computer, then after five minutes I issue the "disconnect" command because I didn't notice she was online?
hLan solves this problem: a daemon sleeps on the server. When I send it a "connect" request, it connects and adds me to a list of users using the connection. When my sister sends a "connect" requests, it simply adds her to the list. When I send a "disconnect" request, the daemon removes me from the list of users, sees that my sister is still in the list and thus leaves the connection online. Only when my sister will ask for a "disconnect" action, the daemon will remove her from the list, see that nobody is using the connection and immediately close it.
Do I need this tool?
To know if you need hLan, simply ask yourself those questions and look at the answers.
Do you have a LAN?
If you don't have a LAN, you don't need hLan. :-)
Do you share (or would like to share) the connection with every computer in the LAN (used by your family members or your work collegues or dormitory friends)?
If your answer is yes, then you could find hLan useful, read on!
Does your ISP charge you differently if you're online for 5 minutes or 8 hours?
If the answer is NO, and you can be online for 5 minutes or 8 hours, one day or everyday, and you are still charged the same money, then you don't need hLan. :-)
If you, however, are on a pay-per-minute or pay-per-use basis, you can find hLan very useful. :-)
Does the computer with the device run (any flavour of) Linux?
If the answer is NO, then you should consider installing it. I am serious, that's what I did and I'm totally satisfied by its performance and efficiency. The IPTABLES module, which is part of the 2.4.x kernel, is the best module I found in my search. (I repeat it: ).
If the answer is YES, then head to the
download section, get it and then drop me a line. :-)
How do I use hLan?
After you have the binaries ready, all you need to do is run the daemon on the server:
ulisse:~# hlan ippp0
You simply have to specify the device which will grant the connection to the Internet (in my case, it's an ISDN device).
Once the daemon is running, you can use the commandline client from a Linux's console:
luca@aiace:~#>hlan ulisse connect luca my_password
luca@aiace:~#>hlan ulisse status luca my_password
luca@aiace:~#>hlan ulisse disconnect luca my_password
From Windows' command prompt (it works on Windows 2000 but seems not to on Windows 98, I have to make some more tests):
C:\>hlan ulisse status luca my_password
Or you can use the Java command line client too:
luca@aiace:~#>java hLan ulisse connect luca my_password
Note that currently the passwords aren't used, but the data is nevertheless sent in clear (not encrypted) so if you think somebody could be "sniffing" your packets, simply put there a fake password. I am working on adding password checking and on a SSL version of the daemon, but it is not my top priority (in my LAN I have trusted people).
If you don't want to use a command line client, or some computers don't have Linux, you can use your browser, since the requests are done over a HTTP packet over a TCP connection on port 34472 (maybe it'll become a registered port!). Check these screenshots:
When you are done with the connection and you want to shut down the server, you simply have to send a SIGTERM to the daemon and it will close gracefully. You can kill it in any other way and no harm will come of it, but gentleness is good. :-)
Features of hLan
In this very moment, hLan
has the following features:
- Support for ISDN devices (ipppX)
- Authentication based on username (there must be a user matching the name provided in the request)
- Informative output after a request (e.g.: )
This means hLan is, at this very moment, suited to environments where you can trust the users of the LAN: nobody in my family would call
hlan ulisse disconnect luca fake_password to remove me from the list and then disconnect the device! :-)
This is what I
want to add to hLan:
- Support for RTG (shouldn't be hard compared to ISDN and would be useful to many people)
- Encrypted communications between daemon and clients, so that hLan can be used in untrusted networks too
- Authentication based on password (I need to study PAM and the like)
This is what I will add
ONLY if somebody asks for it. :-)
- Support for xDSL
- Better/Different support for ISDN: The current support is limited to people using a single line and have a single interface (which means "limited" to 99.9% of ISDN users)
Notes
This project doesn't need a big homepage or a community, but if you want to make a better homepage (I'm too tired to make one...) or help me making a better project or help me with feature requests or bug notices, packages for distributions... I'll be happy. :-)
If you use hLan, drop me a line at
my sourceforge's account, I'd like to know if somebody finds this program useful.
Download
You can download both the source code and binary releases at the
project's homepage, section
downloads.
If you download it, please send me an email, I'd like to know if you're using this software and if you find it useful. :-)
Current version is:
1.0 (March, 22nd 2003)
The code is released under the terms of the
GNU Public License.
This project is hosted on SourceForge.
Latest update:
March, 22nd 2003 (not that this project requires some heavy update!)