How to build DHCP&NTP server on Linux(Ubuntu)
2013-07-23 18:41
597 查看
1.
DHCP Sever
1) Install Command: $apt-get install dhcp3-server
maybe need apt-get autoremove dhcp3-server firstly.
2)
configure /etc/dhcp/dhcpd.conf as below:
#sample /etc/dhcpd.conf
# (add your comments here)
default-lease-time 600;
max-lease-time 7200;
option subnet-mask 255.255.255.0;
option broadcast-address 192.168.133.255;
option routers 192.168.133.254;
option domain-name-servers 192.168.133.1, 192.168.133.2;
option domain-name "mydomain.example";
option ntp-servers 192.168.133.130;
subnet 192.168.133.0 netmask 255.255.255.0 {
range 192.168.133.10 192.168.133.100;
range 192.168.133.150 192.168.133.200;
}
Comment: The option “ntp-servers” is used to assign ntp-server ip address to client. When the client get ip address from DHCP server, the DHCP server will also give the ntp-server ip address to the client.
3)
start/stop/restart dhcp server as below:
$/etc/init.d/isc-dhcp-server restart/start/stop
2.
NTP Server
1) Install Command: apt-get install ntp2)
The client do not update time after receive date&time from ntp server.
a)
Change the file /etc/ntp.conf as the “stratum” may be verified as illegal. So the firmware will not update the date&time. Maybe Change as below:
fudge 127.127.1.0
stratum 1
Comment: If the stratum is 0, maybe the client will take the date&time it get as incredible so that it will not update date&time.
b)
The time gap between the server and client is too big, maybe the firmware will not update date&time to avoid some risks.
3)
If the system ip address changed, we should restart DHCP/NTP server. Or else it will not work properly.
3.
Configure static ip address for linux.
1) The system use dhcp as default. Just check the configuration file /etc/network/interfaces:
# The primary network interface
auto eth0
iface eth0 inet dhcp
2)
To edit the file as below to change the system from DHCP to static ip.
# The primary network interface
auto eth0
iface eth0 inet static
address 192.168.0.10
netmask 255.255.255.0
gateway 192.168.0.1
3)
We need to down/up to enable the configuration.
$ ifdown eth0
$ifup eth0
4.
Set Time
1) Use command “date” to change the firmware date&time.
e.g.: $date –s “2012-12-12 12:12:12”
2)
User should use the command below to check whether the time is UCT or not:
“date ” / “date -u”
5.
Change Timezone
1) e..g.: $ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
2)
Test: use command “date” to check the timezone.
相关文章推荐
- How to build DHCP&NTP server on Linux(Ubuntu)
- 本周技术关注:ISP-Server Setup - Ubuntu 5.10 'Breezy Badger' | HowtoForge - Linux Howtos and Tutorials
- How to Install Python 2.7.13 on Ubuntu & LinuxMint
- How to Install Python 3.5.2 on Ubuntu & Linuxmint
- How to Record your Voice from the Microphone on Ubuntu/Linux Mint
- How to Install Adobe Air 2 on Ubuntu 10.04 Linux Distro
- How To Install Linux, Apache, MySQL, PHP (LAMP) stack on Ubuntu 16.04
- How to install Firefox 17 on Linux Mint, Ubuntu, Debian, CentOS, Fedora ... or any other Linux dist
- How To Manage Dell Servers using OMSA – OpenManage Server Administrator On Linux
- How to install perl modules through CPAN on ubuntu hardy server
- How to send Email through external SMTP server on Ubuntu 14.04
- How To Configure BIND as a Private Network DNS Server on Ubuntu 14.04
- How to Install JAVA 8 (JDK 8u40) on Ubuntu & LinuxMint Via PPA
- How to set up an SFTP server on Linux
- How to install GIT on Linux (Ubuntu & CentOS)
- How to build and run ARM Linux on QEMU from scratch
- How to Install Ubuntu Linux on your Dell PC
- How to install GSL on linux(ubuntu,centos,redhat)
- How to configure an NTP client and server on CentOS/RedHat
- How to install local yum server on linux