The previous chapter mainly studied the Linux command base, and network collocation, continue to learn below.
First, build NTP time server
NTP server is used for LAN server time synchronization, can ensure that the LAN all the server and time server time consistency, some applications to the real-time requirements of the high need to unify time.
(That is, if our company has hundreds of servers, hundreds of servers are connected internally, how to ensure that the time to keep these servers consistent?) Then we can build a time server in the LAN, the hundreds of servers as long as the link to this time server, it can be consistent with this time server time, however, this time server with the authority of the external network time to maintain the same can be.
Internet time servers also have many, for example: Ntpdate ntp.fudan.edu.cn Fudan University's NTP free internet time synchronization.
NTP server listening port is UDP 123, it needs to be on the local firewall to run Client Access 123 port
Vi/etc/sysconfig/iptables Add the following rules:
-A input-m state--state new-m udp-p UDP--dport 123-j ACCEPT
1. NTP Time Server configuration:
Yum Install NTP ntpdate-y!
Modify the ntp.conf configuration file (actually don't change anything)
Cp/etp/ntp.conf/etc/ntp.conf.bak
Restart:/etc/init.d/ntpd restart
Then: ntpq-p
NTPQ is used to monitor NTPD operations, NTPQ-P queries the NTP server in the network, while showing the relationship between the client and each server
[[email protected]/]# ntpq-p remote refid St T when poll reach delay offset jitter========== ====================================================================+61-216-153-104. 211.22.103.157 3 u 1 112.799 102.310 95.085 gus.buptnet.edu. INIT. 0 0.000 0.000 0.000*time6.aliyun.co 10.137.38.86 2 u 1 25.873 127.684 0.640 202.120.2.101.d. STEP. U - 0 0.000 0.000 0.000[[email protected]/]#
Note: After NTPD is started, the client needs to wait a few minutes before synchronizing with its time, otherwise it will prompt "No server suitable for synchronization found" error.
2. Configure time synchronization Client
CRONTAB-E//Scheduled Tasks
Add a row to synchronize with the time synchronization server 6:10 daily
* * * * */usr/sbin/ntpdate ntp-server Ip>>/usr/local/logs/crontab/ntpdate.log
Note: If the client does not have ntpdate, you can yum-y install NTP!
The following is the NTP server configuration file content (LAN NTP, if you need to synchronize with the external network, add the external network server can be)
Driftfile/var/lib/ntp/drift
Restrict default Kod nomodify notrap nopeer noquery
restrict-6 default Kod nomodify notrap nopeer noquery
Restrict 127.0.0.1
Restrict-6:: 1
Server 127.127.1.0 #local Clock
Fudge 127.127.1.0 Stratum 10
Includefile/etc/ntp/crypto/pw
Keys/etc/ntp/keys
The following is an explanation of the parameters:
Recorded in the file following the Driftfile parameter;
Broadcastdelay 0.008 #广播延迟时间
Since this NTP service has been built, then add the following statement to all client crontab:
0 0 * * */usr/sbin/ntpdate 10.0.0.155 >>/data/logs/ntp.log 2>&1
II. Building a DHCP server
DHCP (Dynamic Host configuration Protocol) is a LAN protocol that works with the UDP protocol and is used primarily to automatically assign an IP address to an internal network or network service provider, with DHCP having 3 ports, where UDP67 and UDP68 are normal DHCP service ports, respectively, as port services for DHCP Server and DHCP Client.
DHCP can be deployed on the server, switch or service side, can control a range of IP address, the client Login server can automatically obtain the DHCP server assigned IP address and subnet mask, where the DHCP server needs to install the TPC/IP protocol, you need to set the static IP address, child netmask, default gateway.
1, the official installation of DHCP services
Yum Install DHCP dhcp-devel-y,
Then modify the contents of the dhcp/etc/dhcpd.conf configuration file as follows:
Ddns-update-style Interim;
Ignore client-updates;
Next-server 192.168.0.79;
FileName "pxelinux.0";
Allow booting;
Allow BOOTP;
Subnet 192.168.217.0 netmask 255.255.255.0{
#---Default gateway
Option routers 192.168.217.2;
Option Subnet-mask 255.255.252.0;
# option Nis-domain "domain.org";
# option Domain-name "192.168.0.10";
# option Domain-name-servers 192.168.0.10;
Option time-offset-18000; # Eastern Starndard Time
# option Ntp-servers 192.168.1.1;
# option Netbios-name-servers 192.168.1.1;
#---Selects point-to-point node (default is hybrid). Don ' t change this unless
#--You understand Netbios very well
# option Netbios-node-type 2;
Range DYNAMIC-BOOTP 192.168.217.100 192.168.217.200;
Host NS {
Hardware Ethernet 00:1a:a0:2b:38:81;
Fixed-address 192.168.217.101; }
Host NS1 {
Hardware Ethernet 00:0c:29:2b:90:67;
Fixed-address 192.168.217.102;}
}
The modification remains complete, restart:/ETC/INIT.D/DHCPD restart
Parameter description:
To get the IP from this DHCP server, the client needs to do a simple setup, if Linux needs to
/etc/sysconfig/network-scritps/ifcfg-eth0 Bootproto to DHCP, Windows machine needs to modify the local link, set it to automatically obtain the IP.
Bootproto = DHCP
The above operation does not do the practice, only for me to learn to understand.
Linux Learning (ii)