Showing posts with label CentOS. Show all posts
Showing posts with label CentOS. Show all posts

Thursday, April 25, 2013

How to create a virtual interface on CentOS or Debian

I was working on my DNS server and I wanted to create a virtual interface to distinguish internal requests from external requests. The command to create a virtual interface is:

ifconfig eth0:0 199.133.189.122 netmask 255.255.255.192 up

Tuesday, April 16, 2013

How to configure NTP Server and Client on CentOS

Introduction

NTP is widely used to synchronize a computer to Internet time servers or other sources, such as a radio or satellite receiver or telephone modem service. It can also be used as a server for dependent clients. It provides accuracies typically less than a millisecond on LANs and up to a few milliseconds on WANs. Typical NTP configurations utilize multiple redundant servers and diverse network paths in order to achieve high accuracy and reliability.

Configure NTP Server

  1. yum install ntp (and type 'y' when show up two questions);
  2. vi /etc/ntp.conf
  3. Add the next statement for accept requests from another servers (DNS server, LDAP server, etc.) on your LAN:
    restrict 10.50.0.0 mask 255.255.255.0 nomodify nopeer noquery
  4. Add the next statement for public servers NTP synchronize with server's internal clock on your LAN:
    server 0.europe.pool.ntp.org
    server 1.europe.pool.ntp.org
    server 2.europe.pool.ntp.org
    server 3.europe.pool.ntp.org
  5. This command allow to set current time from indicated NTP server:
    ntpdate pool.ntp.org
  6. The same server can be defined on configuration file:
    vi /etc/ntp/step-tickers
    pool.ntp.org
  7. service ntpd start
  8. Make sure the ntpd is active from beginning Linux boot;
    chkconfig ntpd on
  9. Checking synchronization status of service NTP.
    nptq -pn
    tail -f /var/log/messages

Configure NTP Client

  1. This file allows to set server NTP to use for initial adjust clock during starting of ntpd:
    vi /etc/ntp/step-tickers
    10.50.0.254
  2. On the file /etc/ntp.conf, all you need is add server NTP's IP address to use:
    vi /etc/ntp.conf
    server 10.50.0.254
  3. Checking synchronization status of service NTP.
    nptq -pn
    tail -f /var/log/messages
    It can take long to see message of success. When I was configuring, it took about 1 hour.

Conclusion

This protocol allows to keep operating system's clock synchronized with high accurate, running at information of synchronism got from another NTP servers.

Although the configuration is relatively simple, NTP performances a very important role. The possibility to make sure that clocks from many servers are kept with right time is relevant and it is a important factor to correct of many applications. The correction of local time in operating system allows also ensure that logs recorded in operating system have correct time and that is important when I use logs to diagnostic problems of some services.

Monday, March 11, 2013

Commands Vi/Vim editor

As system administrator, I have needed to edit configuration files of some services such as DNS (Domain Name System), LDAP (Lightweight Directory Access Protcol) and etc.

The editor I was using frequently was nano and rarely I used pico. All those editors were used on Ubuntu. When I decided to fit in CentOS, I noticed that I had to install package nano. But I did not want to! I wanted to vary and then I searched and found editor Vi (also it is equal to Vim, although Vim has more features than Vi). I confess, at first time, it was very confused. I did not know what commands to edit file and much less how to save the changes and exit. So I googled and found some commands useful to edit files.

Hereafter, you will see a list of commands to Vi/Vim editor:

CommandDescription
:wqSave the file and exit
:wSave the file
:qQuit and Vi/Vim refuses to exit if any changes was made
:!qQuit without changes to save
:aAppend after cursor
:iInsert after cursor
ESCExit insert/overwrite mode and go back to command mode

Tuesday, February 5, 2013

Configuring TCP/IP with CentOS

The configuration of network TCP/IP allows prepare a server Linux to communicate on network IP, trough setting network interfaces, addresses IP and remaining parameters of configuration. On this article, I will analyse how the way can commands to be used on Linux server.

I had a chance to analyse the main files of network configuration used on Linux CentOS and I saw that a lot of those files appears on most Linux distro. Also it is important to have a knowledge of some commands like ifconfig and route. Why is it important? Because those commands will allow you to analyse and solve problems of network configuration in future.