Posts

Configure DHCP Failover on CentOS 7

Configuring DHCP (Dynamic Host Configuration Protocol) failover on CentOS 7 typically involves using the ISC DHCP server, which is a widely used DHCP server on Linux systems. DHCP failover ensures high availability and redundancy for DHCP services. Here’s a basic guide on how to set up DHCP failover on CentOS 7 using ISC DHCP:

Prerequisites:

  1. Install ISC DHCP Server: If you haven’t already installed the DHCP server, you can do so with the following command: sudo yum install dhcp

Configuration:

  1. Edit the DHCP Configuration File: Open the DHCP configuration file in a text editor. The default configuration file is usually located at /etc/dhcp/dhcpd.conf.
  2. sudo vi /etc/dhcp/dhcpd.conf
  3. Configure DHCP Server: Add or modify the following lines in the dhcpd.conf file for the primary DHCP server. Replace the placeholders with your network-specific values.plaintextCopy codeauthoritative; subnet <your_subnet> netmask <your_netmask> { range <start_ip_address> <end_ip_address>; option routers <gateway_ip_address>; option domain-name-servers <dns_server_ip>; }
  4. Configure Failover: Add the following lines to enable DHCP failover. Replace the placeholders with appropriate values.plaintextCopy codefailover peer "dhcp-failover" { primary; address <primary_ip>; port 647; peer address <secondary_ip>; peer port 647; max-response-delay 60; max-unacked-updates 10; load balance max seconds 3; }
    • primary_ip: IP address of the primary DHCP server.
    • secondary_ip: IP address of the secondary DHCP server.
  5. Restart DHCP Server: After making the changes, restart the DHCP server for the configuration to take effect.bashCopy codesudo systemctl restart dhcpd

Secondary DHCP Server Configuration:

  1. Follow the same steps as above for configuring the DHCP server on the secondary server.
  2. Make sure to change the primary keyword to secondary in the failover configuration.

Verification:

  1. Check the DHCP server logs for any errors or warnings.bashCopy codesudo journalctl -u dhcpd
  2. Verify that the failover status is as expected.bashCopy codesudo dhcpd -t This command tests the configuration and reports any syntax errors.

Notes:

  • Ensure that both primary and secondary DHCP servers have synchronized configuration files.
  • Adjust the failover settings and subnet parameters according to your network requirements.
  • Regularly monitor DHCP server logs to catch any potential issues early on.

This guide provides a basic configuration for DHCP failover. Depending on your network architecture and requirements, you may need to adjust the configuration accordingly. Always test the failover setup in a controlled environment before deploying it in a production network.

Linux Kernel 4.3.1 Released

Linux was originally developed as a free operating system for personal computers based on the Intel x86 architecture, but has since been ported to more hardware platforms than any other operating system. Thanks to its dominance in smartphones, Android, which is built on top of the Linux kernel, has the largest installed base of all general purpose operating systems installed.

It has been over a month since Linus Torvalds announced the release of Linux kernel 4.3, and we have to admit we were wondering when it would get some maintenance releases. Well, today is that day, as the Linux kernel 4.3.1 was introduced and includes some pretty interesting things. First, in number, Linux kernel 4.3.1 changes files 136, with 1,224 438 insertions and deletions.

“I am announcing the release of the 4.3.1 kernel. All users of the 4.3 kernel series should upgrade,” said Greg Kroah-Hartman. “The updated 4.3.y git tree can be found at: git: linux-4.3.yy //git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git can be found in the kernel.org git normal web browser: http://git.kernel.org/?p=linux/kernel/git/stable/linux-stable.git;a=summary “.

According shortlog attached, the first maintenance release of the Linux kernel 4.3 brings improvements in dozens of ARM, x86, s390, MIPS, and ARM64 (AArch64) hardware architectures, multiple network upgrades, especially for things like Bluetooth, IPv6 , IPv4, mac80211, NFC, TIPC (transparent communication between processes) and Wi-Fi as well as a pair of USB controllers improvements sound.
Many drivers have been updated

Besides the architecture, networking and sound updates mentioned above, Linux kernel 4.3.1 updated many drivers, especially for things like Bluetooth, CLK, MFD, NFC, PINCTRL, TTY, USB, Xen, and the creation networks (especially wireless and Ethernet). Of course, Linux kernel 4.3.1 also adds some minor improvements under the hood that make Linux 4.3 kernel more reliable and stable.

all users of GNU / Linux running Linux kernel 4.3 for Linux 4.3.1 kernel upgrade as soon as possible, or more precisely as you get to the default software repositories of their operating systems are encouraged. Meanwhile, operating system vendors and experienced users can download the source code of the Linux kernel 4.3.1 right now from Softpedia or kernel.org website and begin compiling by hand.

RunLevels in Linux

0 Halt the system.
1 Single-user mode
2 Local Multiuser with Networking but without network service
3 Full Multiuser with Networking
4 For Testing Purpose
5 Full Multiuser with Networking and X Windows
6 Reboot

How to Find Out Current Run Level Command

There are 7 run levels in linux as listed above, To check the current Run Level use the command:

# who -r
run-level 3  2015-01-03 08:10   

OR

# cat /etc/inittab
id:3:initdefault:

How to Change Run Level Command

In order to change the run level in linux use init command:

# init 1

How to Configure htop in Linux

Step-1: PreRequisites

For installation of htop following are the dependencies

# yum groupinstall "Development Tools"
# yum install ncurses-devel zlib-devel texinfo gtk+-devel gtk2-devel qt-devel tcl-devel tk-devel kernel-headers kernel-devel

Step-2: Installation and Configuration

Download and extract htop package from given URL:

cd /tmp
# wget http://woshka.com/opensource/htop-0.9.tar.gz
# tar -zxvf htop-0.9.tar.gz

Install and configure htop package as given below:

# cd htop-0.9
# ./configure
# make
# make install
# htop

How to Create SAMBA Server

“Samba is an Open Source/Free Software suite that provides seamless file and print services to SMB/CIFS clients.” Samba is freely available, unlike other SMB/CIFS implementations, and allows for interoperability between Linux/Unix servers and Windows-based clients.

By Default Port # 139

Step 1: Installation

Install the required packages in order to install samba server

# yum install samba samba-client samba-common

Step 2: Configuration

Now to configure samba edit the file /etc/samba/smb.cnf before making changes I will make the backup of original file as /etc/samba/smb.cnf.bak

# mv /etc/samba/smb.cnf /etc/samba/smb.cnf-bk

Now edit the /etc/samba/smb.cnf file.

# vi /etc/samba/smb.cnf

[global]
workgroup = WORKGROUP
server string = Samba Server %v
netbios name = centos
security = user
map to guest = bad user
dns proxy = no
#============================ Share Definitions ============================== 
[Anonymous]
path = /samba/folder
browsable =yes
writable = yes
guest ok = yes
read only = no

Step 3: Create SMB User

Use the following command to add a new Samba user:

# smbpasswd -a username

Step 4: Create SAMBA Group

To create SAMBA group:

# groupadd smbusers
# chown smbusers:smbusers /smbfolder
# usermod -G smbusers user

Create Directory /samba/folder using mkdir command:

# mkdir -p /samba/folder/

Give the permissions to /samba/folder/ directory

#chmod -R 0777 /samba/folder/

Step 5: Start SAMBA Service

Restart the smb service

# service smb restart
# service nmb restart

To Enable smb in multi-user levels.

# chkconfig smb on
# chkconfig nmb on

How To Install Apache (Web Server) in Linux

For Fedora / RHEL / Cent OS Linux

Step 1: Install apache

# yum install httpd

Step 2: Start apache

To start the Apache/httpd, run:

# /etc/init.d/httpd start
OR
# service httpd start

Also configure httpd service to start on system start.

# chkconfig httpd on

Note: The default directory in Fedora / RHEL / Cent OS Linux operating system is “/var/www/html”

Step 3: Verify apache Port

To verify the httpd port is open or not use the command:

# netstat -antp | grep :80

For Debian / Ubuntu

Step 1: Install apache

Use the apt-get command:

# apt-get install apache2

Step 2: Start apache

# /etc/init.d/apache2 start

Note: The default directory in Debian / Ubuntu Linux operating system is /var/www/

Installation from CD/DVD

We can also install httpd from CDROM with rpm command:

# rpm -ivh httpd*

Linux World

The history of Linux began in 1991 with the commencement of a personal project by Finnish student Linus Torvalds to create a new free operating system kernel. Since then, the resulting Linux kernel has been marked by constant growth throughout its history. Since the initial release of its source code in 1991, it has grown from a small number of C files under a license prohibiting commercial distribution to the 3.18 version in 2015 with more than 18 million lines of source code under the GNU General Public License

In 1991, in Helsinki, Linus Torvalds began a project that later became the Linux kernel. He wrote the program specifically for the hardware he was using and independent of an operating system because he wanted to use the functions of his new PC with an 80386 processor. Development was done on MINIX using the GNU C compiler. The GNU C Compiler is still the main choice for compiling Linux today. The code however, can be built with other compilers, such as the Intel C Compiler.

As Torvalds wrote in his book Just for Fun,[10] he eventually ended up writing an operating system kernel. On 25 August 1991 (age 21), he announced this system in a Usenet posting to the newsgroup “comp.os.minix.”:

Hello everybody out there using minix –

I’m doing a (free) operating system (just a hobby, won’t be big and professional like gnu) for 386(486) AT clones. This has been brewing since april, and is starting to get ready. I’d like any feedback on things people like/dislike in minix, as my OS resembles it somewhat (same physical layout of the file-system (due to practical reasons) among other things).

I’ve currently ported bash(1.08) and gcc(1.40), and things seem to work. This implies that I’ll get something practical within a few months, and I’d like to know what features most people would want. Any suggestions are welcome, but I won’t promise I’ll implement them 🙂

Linus (torvalds@kruuna.helsinki.fi)

PS. Yes – it’s free of any minix code, and it has a multi-threaded fs. It is NOT portable (uses 386 task switching etc), and it probably never will support anything other than AT-harddisks, as that’s all I have :-(.

—Linus Torvalds