DDNS configuration in Linux

Source: Internet
Author: User
Tags hmac

1. Experimental topological structure

Fig. 1 Experimental topological diagram

2. Project Requirements

The system is built to dynamically update DNS information for the Web server.

3, Project development ideas (mind map)

Figure 2 DDNS Experimental Mind Mapping

4. Experimental steps (1) Basic network construction

DHCP server can ping DNS server

Figure 3 Network Connectivity test

(2) on the DNS server

1) Installing the DNS service

[[Email protected] Desktop]# yum install bind-y

2) Generate key

[[Email protected] Desktop]# mkdir key

[[Email protected] Desktop]# CD key/

[Email protected] key]# dnssec-keygen-a hmac-md5-b 512-n HOST www

kwww.+157+55680

[[email protected] key]# ls

Kwww.+157+55680.key kwww.+157+55680.private

[email protected] key]# cat Kwww.+157+55680.key

Www. In KEY 3 157 7MTHFLORKZ+UJGSGK7XMKXYKDXM+NZP49CITZ+NJEMQAJYAWKK8LTTPW 8anc+pmp8hxgu2qk5hf4zlaqf4dzsw==

3) Configuring the Master profile named.conf

Copy the generated public key (space stripped) to named.conf, and add the key field

Options {

Listen-on Port: (any;};

Directory "/var/named";

Dump-file "/var/named/data/cache_dump.db";

Statistics-file "/var/named/data/named_stats.txt";

Memstatistics-file "/var/named/data/named_mem_stats.txt";

allow-query {any;};

};

Key WWW {

Algorithm HMAC-MD5;

Secret "7mthflorkz+ujgsgk7xmkxykdxm+nzp49citz+njemqajyawkk8lttpw8anc+pmp8hxgu2qk5hf4zlaqf4dzsw==";

};

Zone "Xh27.com" in {

Type master;

File "named.xh27.com";

allow-update {

Key www;

};

};

Zone "0.168.192.in-addr.arpa" in {

Type master;

File "named.192.168.0";

allow-update {

Key www;

};

};

4) Add a positive solution file

[[Email protected] Desktop]# cd/var/named/

[email protected] named]# Touch named.xh27.com

[Email protected] named]# gedit named.xh27.com

$TTL 3H

@ in SOA master.xh27.com. Admin.mail.xh27.com. (

0; Serial

1D; Refresh

1H; Retry

1W; Expire

3H); Minimum

@ in NS master.xh27.com.

Master.xh27.com. In A 192.168.0.253

5) Add anti-solution file

[email protected] named]# Touch named.192.168.0

[Email protected] named]# gedit named.192.168.0

$TTL 3H

@ in SOA master. Xh27.com. Admin.mail. Xh27.com. (

0; Serial

1D; Refresh

1H; Retry

1W; Expire

3H); Minimum

@ in NS master. Xh27.com.

253 in PTR Master. Xh27.com.

6) Firewall Open 53 port

[[email protected] named]# iptables-i input-i eth0-p UDP--dport 53-j ACCEPT

[[email protected] named]# iptables-i input-i eth0-p tcp--dport 53-j ACCEPT

7) Set SELinux

[Email protected] named]# setsebool-p Named_write_master_zones=1

Allow write to dynamically update files

8) Set folder permissions

[Email protected] named]# chmod g+w/var/named

[Email protected] named]# chown named/var/named

9) Start the DNS service

[[Email protected] named]# service named start

(3) on the DHCP server

1) Install DHCP service

[email protected] yum.repos.d]# Yum install dhcp-y

2) Configuring the DHCP master configuration file

[Email protected] yum.repos.d]# gedit/etc/dhcp/dhcpd.conf

Option Domain-name "xh27.com";

Option Domain-name-servers master.xh27.com;

Default-lease-time 600;

Max-lease-time 7200;

Ddns-update-style Interim;

Key WWW {

Algorithm HMAC-MD5; Secret "7mthflorkz+ujgsgk7xmkxykdxm+nzp49citz+njemqajyawkk8lttpw8anc+pmp8hxgu2qk5hf4zlaqf4dzsw==";

}

Zone Xh27.com {

Key www;

Primary 192.168.0.253;

}

Zone 0.168.192.in-addr.arpa {

Key www;

Primary 192.168.0.253;

}

Subnet 192.168.0.0 netmask 255.255.255.0 {

Range 192.168.0.50 192.168.0.150;

Option routers 192.168.0.254;

}

3) Setting up a DNS server

[Email protected] yum.repos.d]# gedit/etc/resolv.conf

NameServer 192.168.0.253

4) Start the DHCP service

[[Email protected] yum.repos.d]# service DHCPD start

(4) on the Web server

1) Set host name

[[Email protected] Desktop]# gedit/etc/sysconfig/network

Hostname=www

2) Restart Network Service

[Email protected] Desktop]# service network restart

[[Email protected] Desktop]# ifconfig

Figure 4 WEB server Gets the IP for the first time

5. Result Detection (1) on DHCP server

Change the IP address allocation range from 50-150 to 151-200 to restart the DHCP server

Figure 5 Modifying an assigned IP range

[Email protected] yum.repos.d]# service DHCPD restart

(2) on the Web server

1) Restart Network Service

Figure 6 WEB server Gets the IP for the second time

2) parsing www.xh27.com and 192.168.0.151

Figure 7 WEB server resolves the domain name and IP

(3) on the DNS server

1) View the obtained dynamic update file

[[Email protected] Desktop]# ll/var/named/

Figure 8 DNS View update file

2) View Log file

[[Email protected] Desktop]# gedit/var/log/messages

Figure 9 DNS View log file

"All rights reserved, please specify the original source:http://www.cnblogs.com/liaoyuanyang/p/7029234.html "

DDNS configuration in Linux

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.