DDNS

 

假设server11192.168.0.111】为dhcp服务器:


 

动态获取IP

[root@server11 ~]# yum install dhcp -y

[root@server11 ~]# vim /etc/dhcpd/dhcpd.conf

option domain-name “yyn.org”;

option domain-name-servers 192.168.0.111;


 

default-lease-time 600;

max-lease-time 7200;


 

subnet 192.168.0.0 netmask 255.255.255.0 {

range 192.168.0.135 192.168.0.145;。。。。。。地址池

option routers 192.168.0.111;

}


 

客户端【host11】:拔掉网线,以server11作为dhcp服务器

ifcfg-eth0文件改为dhcp获取方式

[root@host11 ~]# /etc/init.d/network restart

[root@host11 ~]# ifconfig

得到上面地址池中的IP


 


 

动态绑定IP

[root@server11 ~]# vim /etc/dhcpd/dhcpd.conf

host client1 {

hardware ethernet 52:54:00:21:3d:95; 。。。。host11的MAC地址

fixed-address 192.168.0.90; 。。。。。。。。host11上动态绑定的IP

}

[root@server11 ~]# /etc/init.ddhcpd restart


 

[root@host11 ~]# /etc/init.d/network restart

[root@host11 ~]# ifconfig

得到上面IP: 192.168.0.90


 


 

DDNS解析:

[root@server11 ~] # yum install -y bind bind-chroot

[root@server11 ~] # vim /etc/named.conf

key "dns" {

algorithm hmac-md5;

secret "+Gt3V1GrSFSQKiE+dnA6RQ==";

};


 

zone "yyn.org" IN {

type master;

file "yyn.org.zone";

allow-update { key dns; };

};

[root@server11 ~]# /etc/init.d/named restart

[root@server11 ~]# vim /etc/dhcp/dhcpd.conf

key "dns" {

algorithm hmac-md5;

secret "+Gt3V1GrSFSQKiE+dnA6RQ==";

};

zone yyn.org. {

primary 127.0.0.1;

key dns;

};


 


 

[root@server11 ~]# /etc/init.d/dhcpd restart


 


 

如果是linux客户机,需要在客户机上做如下配置:

[root@server11 ~]# vim /etc/dhcp/dhclient.conf

ddns-update-style interim;

[root@host11 ~]# vim /etc/dhcp/dhclient.conf

send fqdn.fqdn "slave.Dillon.org.";

send fqdn.encoded on;

send fqdn.server-update off;

[root@host11 ~]# rm -f /etc/dhcp/dhclient-eth0.conf


 

如果客户机是windows主机,则应该

[root@server12 ~]# vim /etc/dhcp/dhclient.conf

ddns-update-style ad-hoc;

你可能感兴趣的:(职场,休闲,ddns,DHCP服务器,IP获取)