linux配置服务器心得体会,linux 学习 linux上搭建dhcp服务器
①配置前的環(huán)境準(zhǔn)備
##確保dhcp服務(wù)器有固定ip
[root@localhost ~]# vim /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
BOOTPROTO=satic //ip獲取模式為static 靜態(tài)
ONBOOT=yes
HWADDR=00:0c:29:f5:82:fe
IPADDR=192.168.1.1
NETMASK=255.255.255.0
[root@localhost ~]# /etc/init.d/network restart //重啟network服務(wù)
正在關(guān)閉接口 eth0: [確定]
關(guān)閉環(huán)回接口: [確定]
彈出環(huán)回接口: [確定]
彈出界面 eth0: [確定]
[root@localhost ~]# chkconfig network on //保證network服務(wù)默認(rèn)啟動
[root@localhost ~]#
##安裝dhcp服務(wù)的rpm包
[root@localhost ~]# rpm -q dhcp
package dhcp is not installed
[root@localhost ~]# mount /dev/hdc /media/
mount: block device /dev/hdc is write-protected, mounting read-only
[root@localhost ~]#
[root@localhost ~]# rpm -ivh /media/Server/dhcp-3.0.5-31.el5_8.1.x86_64.rpm
warning: /media/Server/dhcp-3.0.5-31.el5_8.1.x86_64.rpm: Header V3 DSA signature: NOKEY, key ID 37017186
Preparing... ########################################### [100%]
1:dhcp ########################################### [100%]
[root@localhost ~]#
##編輯dhcpd主配置文件
[root@localhost ~]# vim /etc/dhcpd.conf
##打開后是空文件,可以將下面的模板導(dǎo)入
/usr/share/doc/dhcp*/dhcpd.conf.sample
以下是主要的配置內(nèi)容
ddns-update-style interim; //DHCP和DNS更新模式,必須包括的設(shè)置項
ignore client-updates;
subnet 192.168.1.0 netmask 255.255.255.0 { //全局的子網(wǎng)和掩碼
option routers 192.168.1.254; //網(wǎng)關(guān)
option subnet-mask 255.255.255.0; //掩碼
option domain-name "domain.org";
option domain-name-servers 192.168.1.253; //主機所在域
range dynamic-bootp 192.168.1.128 192.168.1.250;//地址池
default-lease-time 21600;//默認(rèn)租期 ,可以放到全局下
max-lease-time 43200; //最大租期,可以放到全局下
host ns {
next-server marvin.redhat.com;
hardware ethernet 12:34:56:78:AB:CD;
fixed-address 207.175.42.254;//聲明的保留地址
}
}
[root@localhost ~]# /etc/init.d/dhcpd
Usage: /etc/init.d/dhcpd {start|stop|restart|force-reload|condrestart|try-restart|configtest|status}
[root@localhost ~]# /etc/init.d/dhcpd configtest //對dhcpd配置文件檢測
Syntax: OK
[root@localhost ~]# /etc/init.d/dhcpd restart //開啟dhcpd服務(wù)
關(guān)閉 dhcpd: [確定]
啟動 dhcpd: [確定]
[root@localhost ~]# chkconfig dhcpd on //確保dhcpd服務(wù)默認(rèn)開機啟動
③測試 :
windows 下運行cmd
ipconfig /all
ipconfig /release //釋放已獲得ip地址
ipconfig /renew //重新獲取
linux 輸入命令
dhclient -d 網(wǎng)卡名 //從dhcp服務(wù)器獲得ip
ifconfif 網(wǎng)卡名 //查看ip
總結(jié)
以上是生活随笔為你收集整理的linux配置服务器心得体会,linux 学习 linux上搭建dhcp服务器的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: linux环境没有bzip2,Linux
- 下一篇: linux 其他常用命令