- 最后登录
- 2023-8-16
- 在线时间
- 1686 小时
- 威望
- 2135
- 金钱
- 50532
- 注册时间
- 2011-10-12
- 阅读权限
- 200
- 帖子
- 5207
- 精华
- 39
- 积分
- 2135
- UID
- 2
|
2#
发表于 2013-11-7 14:37:02
1、 你完全可以不用配置DNS
2、 如果你坚持要配置DNS 请参照
DNS and Linux
I initially looked at DNS when still at the University which seems like a long time ago nowadays. Back then Linux was the uni’s preferred non-Windows platform so I knew which package to install. The following example uses bind 9.3.4-6P1.el5 which is the unpatched DNS server distributed with RHEL 5 update 2.
A word of caution: this article shouldn’t be used to set up a production DNS server, it’s merely intended to get you a DNS server for a lab environment!
With all that said, let’s proceed to getting our SCAN addresses registered. First of all, use rpm to install the package.
Once that’s installed, we need to configure our DNS server. bind9 comes with a number of sample configuration files which make our life a little easier. Traditionally, bind is configured in 2 places:
/etc/named.conf for the zone definition and
/var/named for the zone configuration.
/etc/named.conf
Let’s look at /etc/named.conf first. Please check the documentation and/or man page for the file if you need more explanation.
This file contains the zones as recommended by RFC 1912 section 4.1 (part of the sample configuration) and my zone “the-playground.de”. I want to resolve all hostnames ending in the-playground.de from the DNS server. Consider this file:
options
{
/* make named use port 53 for the source of all queries, to allow
* firewalls to block all ports except 53:
query-source port 53;
query-source-v6 port 53;
*/
// Put files that named is allowed to write in the data/ directory:
directory "/var/named"; // the default
dump-file "data/cache_dump.db";
statistics-file "data/named_stats.txt";
memstatistics-file "data/named_mem_stats.txt";
allow-transfer {"none";};
zone-statistics yes;
};
logging
{
channel default_debug {
file "data/named.run";
severity dynamic;
};
};
zone "the-playground.de" IN {
type master;
file "the-playground.zone";
//allow-transfer {192.168.30.2;};
notify no;
};
zone "30.168.192.in-addr.arpa" IN {
type master;
file "the-playground.reverse";
//allow-update { none; };
//allow-transfer {192.168.30.2;};
notify no;
};
// the following is recommended and not my stuff
// named.rfc1912.zones:
zone "localdomain" IN {
type master;
file "localdomain.zone";
allow-update { none; };
};
zone "localhost" IN {
type master;
file "localhost.zone";
allow-update { none; };
};
zone "0.0.127.in-addr.arpa" IN {
type master;
file "named.local";
allow-update { none; };
};
zone "0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.ip6.arpa" IN {
type master;
file "named.ip6.local";
allow-update { none; };
};
zone "255.in-addr.arpa" IN {
type master;
file "named.broadcast";
allow-update { none; };
};
zone "0.in-addr.arpa" IN {
type master;
file "named.zero";
allow-update { none; };
};
The file is a copy & paste effort with emphasis of getting it to work rather than a beautiful engineering effort. Copy the files referenced by the file directive from /usr/share/doc/bind-9.3.4/sample/var/named to /var/named. The files “the-playground.reverse” and “the-playground.zone” need to be created, see below. Please also rename the zones to whatever you fancy. If you wonder why there are 2 directives for the same domain – that has to do with forward and reverse address resolution. DNS needs to be able to do 2 things:
Resolve name to IP address
Reverse the process, converting IP addresses to names.
So when you type in “ping node1.the-playground.de” DNS will translate this to “ping 192.168.30.10″. Also, you can ask DNS which hostname is behind a specific IP using the nslookup tool. dig and host are some more tools you could use for troubleshooting.
the-playground.zone
The file has the following contents:
$TTL 86400
@ IN SOA the-playground.de hostmaster.the-playground.de (
42 ; serial (d. adams)
3H ; refresh
15M ; retry
1W ; expiry
1D ) ; minimum
IN NS node1
node1 IN A 192.168.30.10
node1v IN A 192.168.30.11
node2 IN A 192.168.30.20
node2v IN A 192.168.30.21
node3 IN A 192.168.30.30
node3v IN A 192.168.30.31
scan-cluster IN A 192.168.30.100
scan-cluster IN A 192.168.30.101
scan-cluster IN A 192.168.30.102
Here we are assigning names to IP addresses. The reverse is done in the reverse zone file. Just change names and IP addresses to fit your needs.
NOTE
I had an undetected problem with the file, in a way that the PTR wasn’t the FQDN of the host which caused reverse lookups to return incorrect results. This has now been fixed.
the-playground.reverse
Consider this file:
$TTL 86400
@ IN SOA the-playground.de root.rhel5.the-playground.de (
42 ; serial (d. adams)
3H ; refresh
15M ; retry
1W ; expiry
1D ) ; minimum
IN NS node1.the-playground.de.
10 IN PTR node1.the-playground.de.
11 IN PTR node1v.the-playground.de.
20 IN PTR node2.the-playground.de.
21 IN PTR node2v.the-playground.de.
30 IN PTR node3.the-playground.de.
31 IN PTR node3v.the-playground.de.
100 IN PTR scan-cluster.the-playground.de.
101 IN PTR scan-cluster.the-playground.de.
102 IN PTR scan-cluster.the-playground.de.
Starting and using named
With the files in place, start named using service named start. Check /var/log/messages for potential problems (usually typos) and correct them. Configuration changes are made available through service named reload.
Edit /etc/resolv.conf on your RAC nodes, they need the following entries:
options attempts: 2
options timeout: 1
search the-playground.de
nameserver 192.168.30.10
Change IP addresses for your environment. Also, edit /etc/nsswitch conf’s hosts directive to favour dns over files, i.e. make sure the line beginning “hosts” reads hosts: dns files
That’s it! We’re well underway to set up our first 11.2 cluster! |
|