imond is a network-capable server program that responds to certain queries or accepts commands that can control the router.
imond also controls the Least-Cost-Routing. It uses the configuration file /etc/imond.conf, that is created automatically from the variables ISDN_CIRC_x_XXX from the file config/isdn.txt and other at boot time by a shell script.
imond runs permanentely as daemon and listens on TCP/IP port 5000 and the device /dev/isdninfo.
All possible commands that can be sent to TCP/IP port 5000:
addlink ci-index | Add channel to the circuit (channel bundling) |
adjust-time seconds | Increments the date on the router by the number of seconds specified |
delete filename pw | Deletes the file on the router |
hup-timeout #ci-index [value] | Show or set the HUP timeout for ISDN circuits |
removelink ci-index | Remove additional channel |
reset-telmond-log-file | Deletes the telmond log file |
reset-imond-log-file | Deletes the imond log file |
receive filename #bytes pw | Transfer a file to the router. Imond acknowledges the command using an ACK (0x06). After that, the file is transfered in blocks of 1024 bytes that are also acknowledged with an ACK. Finally, imond replies with an OK. |
send filename pw | If the password is correct and the file exists, imond replies with OK #bytes. Then, imond transfers the file in blocks of 1024 bytes that have to be acknowledged with an ACK (0x06). Finally, imond replies with an OK. |
support pw | Shows the status/configuration of the router |
sync | Syncs the cache of mounted drives |
dial | Dials the provider (Default-Route-Circuit) |
dialmode [auto|manual|off] | Shows or sets the dialmode |
disable | Hangs up and sets the dialmode to ``off'' |
enable | Sets the dialmode to ``auto'' |
halt | Cleanly shuts down the router |
hangup [#channel-id] | Hangs up |
poweroff | Shuts down the router and powers it off |
reboot | Reboots the router |
route [ci-index] | Set the default route to circuit X (0=automatically) |
channels | Shows the number of available ISDN channels |
charge #channel-id | Shows the online fee for a specific channel |
chargetime #channel-id | Time charged in consideration of the charge interval |
circuit [ci-index] | Shows a circuit name |
circuits | Shows number of default-route-circuits |
cpu | Shows the CPU load in percent |
date | Shows date/time |
device ci-index | Shows the device of the circuit |
driverid #channel-id | Shows driver-id of the channel X |
help | Shows help |
inout #channel-id | Shows direction (incoming/outgoing) |
imond-log-file | Shows imond log file |
ip #channel-id | Shows IP |
is-allowed command | Shows, whether a command is
configured/allowed
Possible commands: dial|dialmode|route|reboot| imond-log|telmond-log|mgetty-log |
is-enabled | Shows, whether dialmode is off (0) or auto (1) |
links ci-index | Show number of channels 0, 1 or 2, 0 means: No channel bundling possible |
log-dir imond|telmond|mgetty | Shows the log directory |
mgetty-log-file | Shows mgetty logfile |
online-time #channel-id | Shows online time of the current connection in hh:mm:ss |
pass [password] | Show, whether it is necessary to enter a
password or enter a password
1 Userpassword is set 2 Adminpassword is set 4 imond is in admin mode |
phone #channel-id | Show telephone number/name of the peer |
pppoe | Show the number of pppoe devices (i.e. 0 or 1) |
quantity #channel-id | Show the data transferred in bytes |
quit | Terminates the connection to imond |
rate #channel-id | Show transfer rates (incoming/outgoing in B/sec) |
status #channel-id | Show status of channel X |
telmond-log-file | Shows telmond log files |
time #channel-id | Show the sum of online times, format hh:mm:ss |
timetable [ci-index] | Shows the time table for the LC-Routing |
uptime | Shows the uptime of the router in seconds |
usage #channel-id | Show the type of connection, that is available responses: Fax, Voice, Net, Modem, Raw |
version | Show the protocol and program version |
The TCP/IP port 5000 is only reachable from the masqueraded LAN. Access from remote is blocked by the firewall configuration by default.
Imond supports two user levels: the user and the admin mode. For both levels you can set a password using varIMOND_PASS and/or IMOND_ADMIN_PASS. Then, clients are forced by imond to submit a password. As long as no password has been submitted, only the commands ``pass'' and``quit'' are accepted. Others are rejected.
If you want to further restrict access, e.g. only allow access from a single computer, the firewall configuration has to be changed.
At present this is not possible using the standard configuration files config/base.txt. You will have to change the file /etc/rc.d/rc322.masq.
The commands
enable/disable/dialmode dial/hangup route reboot/halt
Can be globally enabled/disabled using the configuration variables IMOND_XXX (see ``Configuration'').
From a Unix/Linux computer (or a Windows computer in a DOS box) you can easily try it out: Type
telnet fli4l 5000 \# or the appropriate name of the fli4l-Routers
and you will be able to directly enter the listed commands and look at the output.
For example after entering ``help'' the help is shown, after ``quit'' the connection to imond is terminated.
imond contructs a table (time table) from the configuration file /etc/imond.conf (which is created on bootup from the config variables ISDN_CIRC_x_TIMES and others). It contains a complete calendar week in a raster of 1 hour (168 hours = 168 Bytes). But the table only contains the circuits that have a default route defined.
Using the imond command ``timetable'' you can have a look at it.
Here an example:
Supposing 3 circuits are defined:
CIRCUIT_1_NAME='Addcom' CIRCUIT_2_NAME='AOL' CIRCUIT_3_NAME='Firma'
Only the first two circuits have a default circuit defined, i.e. the corresponding variables ISDN_CIRC_x_ROUTE have the value '0.0.0.0'.
If the variables ISDN_CIRC_x_TIMES look like this:
ISDN_CIRC_1_TIMES='Mo-Fr:09-18:0.0388:N Mo-Fr:18-09:0.0248:Y Sa-Su:00-24:0.0248:Y' ISDN_CIRC_2_TIMES='Mo-Fr:09-18:0.019:Y Mo-Fr:18-09:0.049:N Sa-Su:09-18:0.019:N Sa-Su:18-09:0.049:N' ISDN_CIRC_3_TIMES='Mo-Fr:09-18:0.08:N Mo-Fr:18-09:0.03:N Sa-Su:00-24:0.03:N'
it results in the following /etc/imond.conf being created:
#day hour device defroute phone name charge ch-int Mo-Fr 09-18 ippp0 no 010280192306 Addcom 0.0388 60 Mo-Fr 18-09 ippp0 yes 010280192306 Addcom 0.0248 60 Sa-Su 00-24 ippp0 yes 010280192306 Addcom 0.0248 60 Mo-Fr 09-18 ippp1 yes 019160 AOL 0.019 180 Mo-Fr 18-09 ippp1 no 019160 AOL 0.049 180 Sa-Su 09-18 ippp1 no 019160 AOL 0.019 180 Sa-Su 18-09 ippp1 no 019160 AOL 0.049 180 Mo-Fr 09-18 isdn2 no 0221xxxxxxx Firma 0.08 90 Mo-Fr 18-09 isdn2 no 0221xxxxxxx Firma 0.03 90 Sa-Su 00-24 isdn2 no 0221xxxxxxx Firma 0.03 90
imond creates the following time table in memory - here the output of the imond command ``timetable'':
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 -------------------------------------------------------------------------- Su 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 Mo 2 2 2 2 2 2 2 2 2 4 4 4 4 4 4 4 4 4 2 2 2 2 2 2 Tu 2 2 2 2 2 2 2 2 2 4 4 4 4 4 4 4 4 4 2 2 2 2 2 2 We 2 2 2 2 2 2 2 2 2 4 4 4 4 4 4 4 4 4 2 2 2 2 2 2 Th 2 2 2 2 2 2 2 2 2 4 4 4 4 4 4 4 4 4 2 2 2 2 2 2 Fr 2 2 2 2 2 2 2 2 2 4 4 4 4 4 4 4 4 4 2 2 2 2 2 2 Sa 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 No. Name DefRoute Device Ch/Min ChInt 1 Addcom no ippp0 0.0388 60 2 Addcom yes ippp0 0.0248 60 3 Addcom yes ippp0 0.0248 60 4 AOL yes ippp1 0.0190 180 5 AOL no ippp1 0.0490 180 6 AOL no ippp1 0.0190 180 7 AOL no ippp1 0.0490 180 8 Firma no isdn2 0.0800 90 9 Firma no isdn2 0.0300 90 10 Firma no isdn2 0.0300 90
For circuit 1 (Addcom) there are three time ranges (1-3) defined. For circuit 2 (AOL) there are four time ranges (4-7) and for the last one there are three time ranges (8-10).
In the time table, the indices are printed that are valid in the corresponding hour. Only the indices 2-4 show up here, as the others are not default routes.
If there are zeros in the table, there are gaps in the values of the ISDN_CIRC_X_TIMES variables. At this point there is no default route, no internet access is possible!
On program start, imond checks for the weekday and the hour. Then, the index from the time table is picked out and the corresponding circuit. The default route is then set to this circuit.
If the status of a channel changes (e.g. offline - online) or at least after one minute, this procedure is repeated: check time, lookup in table, pick default route circuit.
If the used circuit changes, e.g. on mondays, 18:00, the default route is deleted, existing connections are terminated (sorry...) and after that the default route is set to the new circuit. Imond may notice this up to 60 seconds too late - so at least at 18:00:59 the route is changed.
If a circuit does not have a default route, nothing will change. The value of ISDN_CIRC_x_TIMES is only used to calculate the fee. This can be important if the LC routing is disabled temporarily, e.g. using the client imonc, and a circuit is dialed manually.
But you can have a look at the tables for other time-range-indices (in our example 1 to 10), also at the ones of the ``Non-LC-Default-Route-Circuits''.
Command:
timetable index
Example:
telnet fli4l 5000 timetable 5 quit
The output will look like:
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 -------------------------------------------------------------------------- Su 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Mo 5 5 5 5 5 5 5 5 5 0 0 0 0 0 0 0 0 0 5 5 5 5 5 5 Tu 5 5 5 5 5 5 5 5 5 0 0 0 0 0 0 0 0 0 5 5 5 5 5 5 We 5 5 5 5 5 5 5 5 5 0 0 0 0 0 0 0 0 0 5 5 5 5 5 5 Th 5 5 5 5 5 5 5 5 5 0 0 0 0 0 0 0 0 0 5 5 5 5 5 5 Fr 5 5 5 5 5 5 5 5 5 0 0 0 0 0 0 0 0 0 5 5 5 5 5 5 Sa 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 No. Name DefRoute Device Ch/Min ChInt 5 AOL no ippp1 0.0490 180
Got everything?
Using the command ``route'', the LC routing can be enabled or disabled. If a positive circuit index is specified (1...N) the default route is changed to the circuit specified. If the index is 0, LC routing will be activated again and the active circuit is chosen automatically.
The whole model how the online charges are calculated will only work correctly, if the charge interval for a single circuit (variable ISDN_CIRC_x_CHARGEINT) remains constant throughout the whole week.
Normally, this is correct for most of the internet providers. But if you dial in, e.g. to your companies network, using the (German) Telecom (not the internet provider T-Online), the change interval changes at 18:00 from 90 seconds to 4 minutes (information from June 2000). Because of that, the definition
ISDN_CIRC_3_CHARGEINT='90' ISDN_CIRC_3_TIMES='Mo-Fr:09-18:0.08:N Mo-Fr:18-09:0.03:N Sa-Su:00-24:0.03:N'
is not absolutely correct. After 18:00 the price is converted to 3 cents (4 minutes cost 12 cents), but the charge interval is wrong. Because of that, the displayed charge could differ from the actual one.
Here is a tip, how different charge intervals can be handled correctly, anyhow (also important for ISDN_CIRC_x_CHARGEINT): Just define 2 cicuits - one for each charge interval. Of course you will have to adjust ISDN_CIRC_x_TIMES so that the valid circuit is always dialed, depending on the charge interval.
Once again: If you connect to an ISP you most likely will not have this problem, because the charge interval is constant all the time and only the prices per minute change (or doesn't it? I guess the German provider T-* could even introduce such a price model :-).