# Use this to enble / disable dynamic dns updates globally.
#ddns-update-style none;
# If this DHCP server is the official DHCP server for the local
# network, the authoritative directive should be uncommented.
#authoritative;
# Use this to send dhcp log messages to a different log file (you also
# have to hack syslog.conf to complete the redirection).
log-facility local7;
# No service will be given on this subnet, but declaring it helps the
# DHCP server to understand the network topology.
# This is a very basic subnet declaration. #一个基本的工作子网声明
subnet 192.168.30.0 netmask 255.255.255.0 {
range 192.168.30.30 192.168.30.50;
}
[iyunv@node2 ~]# service dhcpd start
Starting dhcpd: [FAILED]
[iyunv@node2 ~]# service dhcpd configtest #配置文件语法测试
Internet Systems Consortium DHCP Server 4.1.1-P1
Copyright 2004-2010 Internet Systems Consortium.
All rights reserved.
For info, please visit https://www.isc.org/software/dhcp/
/etc/dhcp/dhcpd.conf line 11: semicolon expected. #提示第11行行首(也就是上一行行末)需要一个分号
default-lease-time
^
Configuration file errors encountered -- exiting
This version of ISC DHCP is based on the release available
on ftp.isc.org. Features have been added and other changes
have been made to the base software release in order to make
it work better with this distribution.
xinetd based services: #基于xinetd的瞬时服务没有运行级别的概念
chargen-dgram: off
chargen-stream: off
daytime-dgram: off
daytime-stream: off
discard-dgram: off
discard-stream: off
echo-dgram: off
echo-stream: off
rsync: off
tcpmux-server: off
tftp: off
time-dgram: off
time-stream: off
[iyunv@node2 ~]# chkconfig tftp on #启用tftp
[iyunv@node2 ~]# chkconfig --list
...
xinetd 0:off 1:off 2:off 3:on 4:on 5:on 6:off
ypbind 0:off 1:off 2:off 3:off 4:off 5:off 6:off
xinetd based services:
chargen-dgram: off
chargen-stream: off
daytime-dgram: off
daytime-stream: off
discard-dgram: off
discard-stream: off
echo-dgram: off
echo-stream: off
rsync: off
tcpmux-server: off
tftp: on #显示tftp已启用
time-dgram: off
time-stream: off
[iyunv@node2 ~]# chkconfig tftp off #关闭tftp
[iyunv@node2 ~]# vim /etc/xinetd.d/tftp #试试第二种方式
# default: off
# description: The tftp server serves files using the trivial file transfer \
# protocol. The tftp protocol is often used to boot diskless \
# workstations, download configuration files to network-aware printers, \
# and to start the installation process for some operating systems.
service tftp
{
disable = no #启用tftp
socket_type = dgram
protocol = udp
wait = yes
user = root
server = /usr/sbin/in.tftpd
server_args = -s /var/lib/tftpboot
per_source = 11
cps = 100 2
flags = IPv4
}
[iyunv@node2 ~]# chkconfig --list
...
xinetd 0:off 1:off 2:off 3:on 4:on 5:on 6:off
ypbind 0:off 1:off 2:off 3:off 4:off 5:off 6:off
xinetd based services:
chargen-dgram: off
chargen-stream: off
daytime-dgram: off
daytime-stream: off
discard-dgram: off
discard-stream: off
echo-dgram: off
echo-stream: off
rsync: off
tcpmux-server: off
tftp: on #显示tftp已启用
time-dgram: off
time-stream: off
[iyunv@node2 ~]# service xinetd start #启动xinetd服务
Starting xinetd: [ OK ]
[iyunv@node2 ~]# netstat -unlp #显示已监听UDP69号端口
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
udp 0 0 0.0.0.0:111 0.0.0.0:* 1283/rpcbind
udp 0 0 0.0.0.0:631 0.0.0.0:* 1437/cupsd
udp 0 0 0.0.0.0:697 0.0.0.0:* 1369/rpc.statd
udp 0 0 0.0.0.0:69 0.0.0.0:* 6688/xinetd
udp 0 0 0.0.0.0:35157 0.0.0.0:* 1369/rpc.statd
[iyunv@node2 ~]# iptables -I INPUT -p udp --dport 69 -j ACCEPT #开放69号端口
[iyunv@node2 ~]# vim /var/lib/tftpboot/a.txt
hello
[iyunv@node1 ~]# yum -y install tftp #在node1上安装tftp客户端
...
[iyunv@node1 ~]# tftp 192.168.30.20 #连接tftp服务器
tftp> help #查看帮助
tftp-hpa 0.49
Commands may be abbreviated. Commands are:
connect connect to remote tftp
mode set file transfer mode
put send file #上传
get receive file #下载
quit exit tftp #退出
verbose toggle verbose mode
trace toggle packet tracing
literal toggle literal mode, ignore ':' in file name
status show current status
binary set mode to octet
ascii set mode to netascii
rexmt set per-packet transmission timeout
timeout set total retransmission timeout
? print help information
help print help information
tftp> get a.txt
tftp> quit
[iyunv@node1 ~]# cat a.txt
hello