8.1 imon-Server imond
:::[ What is imond? ][ Commands ][ Least Cost Routing ]:::

8.1.1 What is imond?

imond is a server program with networking capabilities which answers specific questions or which can be used for control of the router itself.

Additionally imond controls least-cost-routing. To be able to do so, it uses the configuration file /etc/imond.conf, which is created automatically - by using a shell script - during boot from the ISDN_CIRC_x_XXX variables of file config.txt .

imond is running permanentely as a daemon and listens to TCP/IP port 5000 and device /dev/isdninfo.

[ top ]

8.1.2 Commands

The following commands are available via TCP/IP port 5000:

Admin-Befehle:
addlink ci-index               Add channel to circuit (channel bundling)
adjust-time seconds            Changes routerīs time by given number of seconds
delete filename pw             Deletes file on router
hup-timeout #ci-index [value]  Display/set HUP timeout for ISDN circuits
removelink ci-index            Remove additional channel
reset-telmond-log-file         Delete telmond protocol file
reset-imond-log-file           Delete imond protocol file
receive filename #bytes pw     Transmit a file to the router. 
                               Imond will with an ACK (0x06). After this
                               the file will be transferred in 1024 byte 
                               blocks which will be answered with another
                               ACK. The last transmission of imond will
                               be an OK.
send filename pw               If the password is ok and the file exists,
                               imond will give an OK #bytes.
                               After this imond will transfer the file in 1024 bytes 
                               blocks, which have to be answered by an ACK
                               (0x06). The last transmission of imond will be
                               an OK.
support pw                     Will fetch status/configuration information
                               from the router
sync                           Synchronises cache of mounted drives
Admin or User commands:
dial                          Dials to provider (Default-Route-Circuit)
dialmode [auto|manual|off]    Sets dial mode
disable                       Hangs up and sets dial mode to "off"
enable                        Sets dial mode to "auto"
halt                          Shuts down router correctly
hangup                        Hangs up
reboot                        Reboot of i4l router!
route [ci-index]              Sets default route to circuit X
                              (0=automatic)
User commands:
channels                      Output: number of available ISDN channels
charge #channel-id            Output: online costs for one channel
chargetime #channel-id        Online time by using charge time
circuit [ci-index]            Output: circuit name
circuits                      Output: number of default route circuits
cpu                           Shows load of CPU in percent
date                          Shows date/time
device ci-index               Shows device or circuits
driverid #channel-id          Output: driver ID for channel X
help                          Output: help
inout #channel-id             Output of direction (incoming/outgoing)
imond-log-file                Output fo/to imond protocol file
ip #channel-id                Output of IP address
is-allowed command            Output: command configured/valid
                              Possible commands: dial|dialmode|route|reboot|
                              imond-log|telmond-log|mgetty-log
is-enabled                    Output: dialmode set to: off (0) or auto (1)
links ci-index                Output: number of actual channel: 0, 1 or 2
                              0 means: channel bundling NOT possible
log-dir imond|telmond|mgetty  Shows log directory
mgetty-log-file               Output: mgetty protocol file
online-time #channel-id       Output: online time of actual connection:hh:mm:ss
pass [password]               Ask for password or not
                              1 User password set
                              2 Admin password set
                              4 imond is in Admin mode
phone #channel-id             Output: telephone number/name of partner
pppoe                         Shows number of pppoe devices (i.e. 0 or 1)
quantity #channel-id          Shows cumulated transferred data (in bytes)
quit                          End connection to imond
rate #channel-id              Output: transfer rates (incoming/outgoing in B/sec)
status #channel-id            Output: status of channel X
telmond-log-file              Output: telmond protocol file
time #channel-id              Output: accumulated online time, format: hh:mm:ss
timetable [ci-index]          Output: time table for LC routing
uptime                        Output: uptime of router in seconds
usage #channel-id             Output: type of connection, possible
                              answers: Fax, Voice, Net, Modem, Raw
version                       Output of protocol and program version

TCP/IP-Port 5000 is only reachable from masqueraded LAN. A remote access will be blocked by firewall configuration by default.

Imond supports two user levels: user and Admin mode. For both levels you may set a password by using IMOND_PASS or IMOND_ADMIN_PASS. This will enforce the imon clients to use a password request and to transfer the password to imond afterwards. As long as this password was not transferred, imond will only accept the commands "pass" and "quit". All other commands will be rejected with an error.

If you want to include further limitations - ex.: access only from one PC - you will have to change firewall configuration. In the moment you can not use the default configuration file config.txt. In this case a change of roots image is necessary. This is done in rootfs/etc/rc.d/masq. A description for this: see src/README.

Commands

enable/disable/dialmode   dial/hangup   route   reboot/halt

can be switched on or off globally via configuration variables IMOND_XXX (chapter "imond configuration").

You may easily test this with a Unix/Linux computer:

After having entered

telnet fli4l 5000      # or name of FLI4L router

you may directly enter the above given commands and also view the output.

Example: After having entered "help" you will get the output of the help file, entering quit will diconnect from imond.

[ top ]

8.1.3 Least Cost Routing (how it works)

imond will generate a time-depending table (time table) from configuration file /etc/imond.conf during boot-up (which will be generated itself during boot-up from configuration variables ISDN_CIRC_x_TIMES (see package ISDN)). This time table includes a complete week in 1 hour steps (168 hours = 168 bytes). The table consists of circuits which have a defined default route.

You may view this table by using imond command "timetable".

An example:

Lets say: there are three defined circuits:

CIRCUIT_1_NAME='Addcom'
CIRCUIT_2_NAME='Compuserve'
CIRCUIT_3_NAME='Company'

Only the first two circuits have defined default routes (ISDN_CIRC_x_ROUTE='0.0.0.0').

If the corresponding variables ISDN_CIRC_x_TIMES (see package ISDN) look as follows:

ISDN_CIRC_1_TIMES='Mo-Fr:08-18:0.0388:N Mo-Fr:18-08:0.0248:Y Sa-Su:00-24:0.0248:Y'
ISDN_CIRC_2_TIMES='Mo-Fr:08-18:0.018:Y Mo-Fr:18-08:0.048:N Sa-Su:08-18:0.018:N Sa-Su:18-08:0.048:N'
ISDN_CIRC_3_TIMES='Mo-Fr:08-18:0.08:N Mo-Fr:18-08:0.03:N Sa-Su:00-24:0.03:N'

the file /etc/imond.conf will show the following:

#day  hour  device  defroute  phone         name        charge  ChInt
Mo-Fr 08-18 ippp0    no       010280182306  Addcom      0.0388     60
Mo-Fr 18-08 ippp0   yes       010280182306  Addcom      0.0248     60
Sa-Su 00-24 ippp0   yes       010280182306  Addcom      0.0248     60
Mo-Fr 08-18 ippp1   yes       018160        Compuserve  0.018     180
Mo-Fr 18-08 ippp1    no       018160        Compuserve  0.048     180
Sa-Su 08-18 ippp1    no       018160        Compuserve  0.018     180
Sa-Su 18-08 ippp1    no       018160        Compuserve  0.048     180
Mo-Fr 08-18 isdn2    no       0221xxxxxxx   Company     0.08       80
Mo-Fr 18-08 isdn2    no       0221xxxxxxx   Company     0.03       80
Sa-Su 00-24 isdn2    no       0221xxxxxxx   Company     0.03       80

Imond will generate the follwing time table in memory (below you can see the output via imond command "timetable"):

    0  1  2  3  4  5  6  7  8  8 10 11 12 13 14 15 16 17 18 18 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   Compuserve  yes       ippp1   0.0180    180
 5   Compuserve   no       ippp1   0.0480    180
 6   Compuserve   no       ippp1   0.0180    180
 7   Compuserve   no       ippp1   0.0480    180
 8   Company      no       isdn2   0.0800     80
 8   Company      no       isdn2   0.0300     80
10   Company      no       isdn2   0.0300     80

For circuit 1 (Addcom) three time intervals were entered (1-3), for circuit 2 (Compuserve) there are four time intervals (4-7) and for the last one (Company) there are three time intervals (8-10).

In time table there will be only the indices which are valid for the spec. hour. Here you can only see indices 2-4 because all other routes are no LC defaukt routes.

If there are any "zeroes" in this table, there are empty places (no time intervals given) in the ISDN_CIRC_X_TIMES values. There will be no default route existing for these times and any internet connection is then impossible!

When starting the program, imond will first of all recognize day of week and actual hour. After this it will select - via the time table - the index and the corresponding circuit. Default route will then be set to this circuit.

Changes in state of ISDN channels - ex.: changing from online to off-line -, at least after one minute, everything will start again: what time/day of week is it, look into the time table, set default route to....

If the actual circuit changes - ex.: Moday, 6:00 pm - the default route will be deleted and an actually existing connection will be diconnected AND after this the default route will be set to the "new" circuit. This can be recognized up to 60 seconds later by imond. That means: Switching time can be (max.): 6:00:58 pm.

There will be no changes for circuits which do not use a default route. The contents of ISDN_CIRC_x_TIMES will only be used for calculation of telephone costs. This may be relevant if you switched off LC routing by using the imonc client and selected a circuit manually.

You may also view the tables for other time range indices (in the example from 1 to 10) - also the ones for "Non-LC-Default-Route-Circuits".

Command:

timetable index

Example:

telnet fli4l 5000
timetable 5
quit

Output will look as follows:

    0  1  2  3  4  5  6  7  8  8 10 11 12 13 14 15 16 17 18 18 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  Compuserve  no        ippp1   0.0480  180

Everything clear so far ?

With imond command "route" you may switch on/off LC routing. Entering a positive circuit index (1...N) default route will be set to the spcified circuit. If index is 0, LC routing will again be activated and the circuit will be selected automatically.

Calculation of online costs:

The model for calculation of online costs will only function properly if time interval for one circuit (Variable ISDN_CIRC_x_CHARGEINT (see package ISDN)) will be constant for the whole week. This is normally the case for most providers. If you are dialing via telephone company to your company network, this will be a usual telephone call. And that means (Telekom): time interval will change from 80 seconds to four minutes (June 2000). That means, the definition of

ISDN_CIRC_3_CHARGEINT='80'
ISDN_CIRC_3_TIMES='Mo-Fr:08-18:0.08:N Mo-Fr:18-08:0.03:N Sa-Su:00-24:0.03:N'

is not 100 % correct. In the evening it is DM 0.03 per minute, but time interval is wrong. Therefore it might happen that there are slight differences between costs display and real values.

It is possible that this will be corrected later on. In the moment this is no real error.

In the meantime I gat a hint from somebody how different charge intervals can be defined in a correct way (also important for: ISDN_CIRC_x_CHARGEINT): You must define two circuits; one for day-time with ISDN_CIRC_1_CHARGEINT='80' and another with ISDN_CIRC_2_CHARGEINT='240'. Therefore you will have to select ISDN_CIRC_x_TIMES accordingly to use circuit 1 during day-time and circuit 2 in the evening. A nice trick.....

As already said: If you use connections to/with internet providers you will not have this kind of problems, because they use a time/charge interval which is always constant; only costs per minute will change...

[ top ]