How to fix error Failed binding to authentication address * port 1812: Address already in use freeradius

I once ran FreeRADIUS in debug mode:

sudo radiusd -X

And I noticed the following error:

Failed binding to authentication address * port 1812: Address already in use freeradius
/usr/local/freeradius/etc/raddb/radiusd.conf[84]: Error binding to port for port 1812

The error indicates that the address is already in use, so you need to stop the running FreeRADIUS process, look for it and see what’s running on the ports:

sudo ps ax | grep radius
sudo netstat -tulpn | grep :1812
sudo netstat -tulpn | grep :1813
sudo netstat -tulpn | grep :67

In my case, /usr/sbin/radiusd was already started, it can be terminated by PID:

sudo kill -9 PID

Or so:

sudo /etc/init.d/radiusd status
sudo /etc/init.d/radiusd stop
sudo /etc/init.d/freeradius stop

Installing and using dhcping

dhcping – a utility for checking DHCP-servers using unicast packages.

In Ubuntu, you can install dhcping with the command:

sudo apt-get install dhcping

First let’s see what IP-addresses are received and from which gateway:

netstat -rn | grep default

Also you can see the information received from DHCP in the directory /var/lib/dhcp/.

In my case, IP is received from the DHCP server
Here’s an example of running dhcping:

dhcping -s

If the DHCP server responds, the following information will be displayed:

Got answer from:

If there is no answer:

no answer

I’ll describe the dhcping startup keys:
-v (detailed mode)
-V (very detailed mode)
-i (use DHCPINFORM packets)
-r (use DHCPREQUEST packets (standard))
-q (quiet mode)
-t maxwait (response timeout, standard 3 seconds)
-c IP (request the specified IP)
-s IP (send request to specified IP)
-h MAC (use the specified MAC address in the request)
-g IP (use the specified IP gateway in the packet)

Installing and Configuring HAProxy on Linux

HAProxy – proxy server for load balancing of TCP and HTTP applications, a method of distribution to multiple servers.

The Haproxy installation command in Ubuntu / Debian:

sudo apt-get install haproxy

For CentOS:

yum install haproxy

To view the installed version, you can use the command:

haproxy -v

We will check whether it will automatically start when the system is turned on, there should be ENABLED = 1 (in the nano editor CTRL+X to exit, y/n to save or cancel changes):

sudo nano /etc/default/haproxy

In CentOS, simply execute the command:

chkconfig haproxy on

Make a copy of the configuration file just in case:

sudo cp /etc/haproxy/haproxy.cfg{,.original}

Open the main configuration file in the editor:

sudo nano /etc/haproxy/haproxy.cfg

I will give an example of a configuration:

    log /dev/log    local0
    log /dev/log    local1 notice
    chroot /var/lib/haproxy
    user haproxy
    group haproxy

    log     global
    mode    http
    option  httplog
    option  dontlognull
    contimeout     5000
    clitimeout     50000
    srvtimeout     50000
    errorfile 400 /etc/haproxy/errors/400.http
    errorfile 403 /etc/haproxy/errors/403.http
    errorfile 408 /etc/haproxy/errors/408.http
    errorfile 500 /etc/haproxy/errors/500.http
    errorfile 502 /etc/haproxy/errors/502.http
    errorfile 503 /etc/haproxy/errors/503.http
    errorfile 504 /etc/haproxy/errors/504.http
    retries 3
listen webfarm
    mode http
    stats enable
    stats uri /haproxy?stats
    stats auth user:password
    maxconn 5000
    balance roundrobin
    option httpclose
    option forwardfor
    server webserver01 check
    server webserver02 check

Parameter maxconn 5000 defines the maximum number of simultaneous connections, 0 is used to remove the limit, if not specified, it will be standard 2000.

For example, to use Apache2 on the same local machine, change its /etc/apache2/ports.conf and /etc/apache2/sites-enabled/ configuration files from 80 to 81 for example, and /etc/haproxy/haproxy. cfg we indicate:

server webserver01 check

Each time after a configuration change, you must restart:

sudo service apache2 restart
sudo service haproxy restart

This completes the installation and the basic configuration of HAProxy.

Updating Ubuntu 14.04 to 16.04

Before updating I recommend to make a backup copy of the important information.

Update the system to the current state:

sudo apt-get update
sudo apt-get upgrade


sudo reboot

Let’s see the current version:

lsb_release -a

We are ready to upgrade to version 16.04:

sudo update-manager -d

Or so:

sudo do-release-upgrade

After the update is complete, you will need to reboot.
I will note that many packages will also be updated, for example PHP5 will be updated to PHP7, etc., so you need to be ready for this.
How to downgrade the PHP version I described in this article – How to install PHP 5.6 in Ubuntu 16
Or how to upgrade here – Upgrading PHP Version on Ubuntu 14.04

Connect to SSH using the keys

To connect to SSH without entering a password, you can generate public and private keys on the local north, then copy it to a remote machine, then the password will not be asked when connecting to it.

On the local machine, generate the keys:

sudo ssh-keygen -t rsa

Copy the public key to the remote server:

sudo ssh-copy-id -i ~/.ssh/ -p PORT USER@HOST

If an error occurs while copying the key, you can manually copy the line from to the remote server in the authorized_keys file.

The specified commands must be executed from the user from whom the connection will be made.
For example, if from root, then you need to execute the following command before the two commands:

sudo -i

You can remove the host by:

ssh-keygen -f "/home/user/.ssh/known_hosts" -R [HOST]:22

See also:
Installing and Configuring SSH

How do I enable the Universe repository in Ubuntu?

I once wanted to install some utilities on the running LiveCD with Ubuntu Desktop, the same MC, etc., which did not want to be installed.

To solve this problem, you need to include the “Universe” repository.

And so, add it:

sudo add-apt-repository universe

In older versions of Ubuntu, you might have to add another command:

sudo add-apt-repository "deb $(lsb_release -sc) universe"

If desired, you can include all the repositories:

sudo add-apt-repository "deb $(lsb_release -sc) main universe multiverse restricted"

And update the list of packages:

sudo apt-get update

After that, everything was install successfully.

Above $(lsb_release -sc) specifies the version of Ubuntu and inserts it into the link.

You can also manually check the version by running the command:

lsb_release -sc

Installing Open-AudIT on Linux

Open-Audit — a system for collecting information about existing equipment and creating reports.

On an example I will describe the installation process in Linux Ubuntu:

1) Download the latest version from the official site

2) Switch to the root user, make the downloaded file with Open-AudIT executable and run it:

sudo -i
chmod u+x ./
sh ./

In the installation process, follow the instructions, agreeing with the questions pressing “y” or “Enter“.
Additional components such as apache2, mysql-server, etc. will be automatically installed.

3) Open in the browser web-interface Open-AudIT by reference http://HOST/omk/oae/
Standard login and password – admin/password


Setting the default mail address in cPanel

Suppose you want all mail that arrives at nonexistent mailboxes in your domain to be delivered to a specific mailbox.

For this:

1) On the cPanel main page, in the “Email” section, select “Default Address

2) In the window that opens, select the domain (if there are several), select “Forward to Email Address” and specify which address to forward.

Instead of sending it, you can also choose to delete emails, forward to a system mail account, or send to a script.


SMS sending script via Goip4 gateway

Here is an example of a script written in PHP, for sending SMS messages through the Goip4 gateway.
The script receives data from the SQL database with a query and alternately sends SMS to each number, and also writes an entry about sending it to a special sms table.
Continue reading “SMS sending script via Goip4 gateway”