DHCP (english)

Z Freenetis Wiki
Verze z 6. 8. 2013, 13:03, kterou vytvořil Sivosha (diskuse | příspěvky)
(rozdíl) ← Starší verze | zobrazit aktuální verzi (rozdíl) | Novější verze → (rozdíl)
Přejít na: navigace, hledání


From version 1.1 FreenetIS is able to manage DHCP servers on devices which are running on Linux and RouterOS. Management is based on the same principle as přesměrování (redirect) or zajištění kvality služeb (QoS) (Quality of Service (QoS)) and a device with a DHCP server downloads your FreenetIS data configuration and applies them to themself. For installation, you must perform the following steps in FreenetISu and DHCP servers.

Settings on FreenerIS page

We suppose that your FreenetIS contains a description of your network (subnet, IP address).

  1. In tab System set in the Settings section an address of your DNS server.
  2. In subnets, which are managed by DHCP server, set the DHCP to "yes".
  3. Every such subnet must have one gateway (represented by IP address) and and the IP address must be connected to device that represents the DHCP server (so that one of its interfaces must contain the IP address). …..
  4. Now set all the physical devices according to the instructions below
  5. In the menu you can find the item 'DHCP servers", where you can see the last time your DHCP server downloaded its configuration from FreenetIS. Last update time is used to distinguish whether the DHCP server is active. Boundaries of activities can be set as the duration in seconds. This setting is available in the Settings tab in the System. The number of inactive DHCP server is displayed as an indicator in the menu.

Warning:

  • It is necessary for every IP address in the subnets which were maneged by DHCP server to ba assigned to the interface with a valid MAC address.
  • Any errors in the configuration and during communication a DHCP server with FreenetIS are shown in the section 'errors and logs'.

Setting up a DHCP server

On the DHCP server, you must use a script that downloads the configuration of FrinetIS and set it to DHCP. You can set how often you want to perform the action (the default is 5 minutes), and the configuration is loaded only when it was changed (optimise).

Linux (debian)

1)Install the package 'freenetis-dhcp' (from FreenetIS repository). During installation you will be asked to enter your 'URL to your FreenetISu', 'ID device (ID device from FreenetIS, which represents the DHCP server that you set) and 'timeout in seconds to load the configuration from FreenetIS.

apt-get install freenetis-dhcp

2)Start the daemon (when you will start the it next time, operating system will start automatically) /etc/init.d/freenetis-dhcp start

If you can see: Starting FreenetIS DHCP daemon: OK

Everything installed fine and your FreenetIS should be in the list of DHCP servers update 'access time' in the device.

If any other string was printed it means an error has occurred. The details can be found here:

less /var/log/freenetis-dhcp.log

3) If you want to add to the DHCP configuration to the setting that is independent of FreeneetIS, put it in the file / etc / dhcp / dhcpd.conf.custom.

Router OS (mikrotik)

On your Mikrotik router create a new script 'freenetis-dhcp-sync.rsc' and copy the contents into it content of the same file from application / vendors / dhcp.It is then necessary to modify the following variables by script:

'PATHFN' - URL of your installation FreenetIS

'DeviceID' - Device ID Mikrotik router in your FreenetIS


For regular startup script you should add an entry to the schedule (instead of 5 minutes, you can use your interval):

/system scheduler add disabled=no interval=5m name=freenetis-dhcp-sync on-event=freenetis-dhcp-sync.rsc


FreenetIS configuration - practice

to be continued

To complete commissioning should be done:

1) Install package 'freenetis-DHCP' on the appropriate machine, wgich has to be DHCP Server. 2)check whether the on the machine / etc / freenetis / freenetis-dhcp.conf in line DEVICE_ID = "4808" was set with correct number, which is DHCP devoce in FreenetIS. 3)start DHCP daemon

root@freenetis1:#  /etc/init.d/freenetis-dhcp start
Starting FreenetIS DHCP deamon: OK

4)Then we can check the status and view log

root@freenetis1:#  /etc/init.d/freenetis-dhcp status
Freenetis DHCP is running with PID 15768
root@freenetis1:# tail -f /var/log/freenetis-dhcp.log
[INFO] Fri, 25 Jan 2013 19:29:56 +0100   Downloading ISC DHCP SERVER config from (http://fis.pvfree.net/freenetis)
[INFO] Fri, 25 Jan 2013 19:29:57 +0100   No change -> keeping old configuration

The last line is the message means that the script have not find changes compared to the previous configuration and therefore did not download or restart the daemon.

To complete functionality

1)The machine that is running the DHCP daemon can have multiple interfaces and multiple IP addresses. It has to have specified minimum (an address) in FreenetIs, which will be connected to FreenetIS server.

2) Each address rang, which has to have functional DHCP, should be defined as "Subnet"

3)After it was defined by the following subnet, it will have enabled flag 'DHCP-YES'.

4) You have to defined the interface (eth0, wlan1, ath2, vlan0135 ...) on the machine that runs DHCP server. And 5) assigned 'IP address' to the interface. And 6) the addresses are indicated as 'Gate'!

Errors

If an error occurs in FreenetIS Device has not been Exported: Bad MAC address format, one of the reasons might be that it is using a duplicated MAC in the same subnet. root@freenetis1:~# tail -n 30 /var/log/freenetis-dhcp.log

[INFO] Fri, 25 Jan 2013 07:29:56 +0100   Downloading ISC DHCP SERVER config from (http://10.10.10.10/freenetis)
[ERROR] Fri, 25 Jan 2013 07:29:56 +0100   Download failed (code: 403)
[INFO] Fri, 25 Jan 2013 07:34:56 +0100   Downloading ISC DHCP SERVER config from (http://10.10.10.10/freenetis)
[ERROR] Fri, 25 Jan 2013 07:34:56 +0100   Download failed (code: 403)

then enter the address, which Linux server uses to connect to the server FreenetIS, to the list of 'IP addresses' on the DHCP server