NEC IX ルータにおけるDNS設定についてまとめます。全ての端末がインターネット上のDNSサーバに問い合わせを行うのはネットワーク負荷が大きいので、DNS proxyやDNS cacheを設ける事で負荷を軽減します。 各端末がDNS proxyへの名前解決問い合わせを行います。DNS proxyとなっているIXルータはインターネット上のDNSサーバへの代理問い合わせを行います。代理問い合わせの結果はcacheされるので、cache hitした分だけネットワーク負荷が下がる仕組みになります。
コマンド一覧
このシナリオで重要なコマンド一覧は以下の通りです。
Router(config)# ip name-server <addr> Router(config)# ipv6 name-server <addr> Router(config)# proxy-dns ip enable Router(config)# proxy-dns ipv6 enable Router(config)# proxy-dns server <addr> priority <priority> Router(config)# dns cache enable Router(config)# dns cache lifetime <sec> Router(config)# dns ncache lifetime <sec> Router(config)# dns cache max-records <num>
仕様説明
DNS Client
以下のコマンドで名前を問い合わせるサーバを指定する事ができます。
priority指定はできませんが、複数のDNSサーバを指定する事で冗長設定も可能です。
Router(config)# ip name-server <addr> Router(config)# ipv6 name-server <addr>
DNS proxy
“proxy-dns ip enable”コマンドでDNS proxyを有効にする事ができます。後述のDNS cacheと組み合わせるとDNS queryの数を減らす事ができ、ネットワークの負担を減らす事ができます。
Router(config)# proxy-dns ip enable Router(config)# proxy-dns ipv6 enable
“proxy-dns server”コマンドで、DNS proxyとして動作する時の問い合わせ先のDNSサーバを指定します。なお、”ip name-server”で指定したDNSサーバはproxyとして動作する時は使用されません。
Router(config)# proxy-dns server <addr> priority <priority>
DNS cache
“dns cache enable”コマンドでDNS cacheを有効にする事ができます。
Router(config)# dns cache enable
必須設定ではありませんが、DNS cacheに関するチューニングも可能です。以下のコマンドでcache生存時間、negative cache生存時間、保持する最大レコード数を変更する事ができます。
Router(config)# dns cache lifetime <sec> Router(config)# dns ncache lifetime <sec> Router(config)# dns cache max-records <num>
動作確認環境
以下の構成で動作確認を行います。
[R1:Cisco] router ospf 1 network 10.1.1.1 0.0.0.0 area 0 network 192.168.0.1 0.0.0.0 area 0 [R2:Cisco] router ospf 1 network 10.2.2.2 0.0.0.0 area 0 network 192.168.0.2 0.0.0.0 area 0 [R254:IX2215] interface GigaEthernet0.0 ip address dhcp receive-default ! ip router ospf 1 redistribute static metric-type 1 network 192.168.0.0/24 area 0
初期設定の全文は以下を参照下さい。
DNS Client
DNS Client 設定投入
IXルータが名前解決を行うDNSサーバを指定します。なお、実環境を使用するため、DNSサーバは伏字としております。
[R254:IX2215] ip name-server XX.XX.XX.YYY ip name-server XX.XX.XX.ZZZ
DNS Client 動作確認
名前解決の動作確認を行うため、”www.google.com”に対するpingを行います。”www.google.com”の名前を解決できている事が分かります。
[R254:IX2215] R254(config)# ping www.google.com Looking up ipv4 address for "www.google.com" ...Success PING 192.168.21.23 > 173.194.38.114 56 data bytes 64 bytes from 173.194.38.114: icmp_seq=0 ttl=54 time=4.451 ms 64 bytes from 173.194.38.114: icmp_seq=1 ttl=54 time=4.097 ms --- 173.194.38.114 ping statistics --- 2 packets transmitted, 2 packets received, 0% packet loss round-trip (ms) min/avg/max = 4.097/4.274/4.451 R254(config)#
DNS proxy
DNS proxy 設定投入
IXルータに”proxy-dns ip enable”コマンドを入力し、DNS proxyを有効にします。
[R254:IX2215] proxy-dns ip enable
proxy-dnsが使用するDNSサーバを指定します。
[R254:IX2215] proxy-dns server XX.XX.XX.YYY priority 110 proxy-dns server XX.XX.XX.ZZZ
DNS proxy 動作確認
CiscoルータR1, R2がIXルータR254に名前解決を問い合わせるように設定します。
[R1, R2 : Cisco3640] ip name-server 192.168.0.254
R1から”www.google.co”へのpingを送信します。以下の出力例は疎通不能になっていますが、名前解決は成功している事が読み取れます。
[R1:Cisco3640] R1#ping www.google.com repeat 1 Type escape sequence to abort. Sending 1, 100-byte ICMP Echos to 173.194.38.113, timeout is 2 seconds: . Success rate is 0 percent (0/1) R1#
DNS cache
DNS cache 設定投入
以下のコマンドでDNS cacheを有効にします。
[R254:IX2215] dns cache enable
DNS proxy 動作確認
R1から名前解決を用いたpingを送信します。
[R1:Cisco3640] R1#ping www.google.com repeat 1 Translating "www.google.com"...domain server (192.168.0.254) [OK] Type escape sequence to abort. Sending 1, 100-byte ICMP Echos to 173.194.38.113, timeout is 2 seconds: . Success rate is 0 percent (0/1) R1# R1# R1#ping amazon.com repeat 1 Translating "amazon.com"...domain server (192.168.0.254) [OK] Type escape sequence to abort. Sending 1, 100-byte ICMP Echos to 72.21.194.212, timeout is 2 seconds: . Success rate is 0 percent (0/1) R1# R1# R1#ping changineer.info repeat 1 Translating "changineer.info"...domain server (192.168.0.254) [OK] Type escape sequence to abort. Sending 1, 100-byte ICMP Echos to 133.242.169.96, timeout is 2 seconds: . Success rate is 0 percent (0/1) R1#
cacheされたエントリは”show dns cache”で参照する事ができます。先ほどpingによる名前解決が、IXルータ内にcacheされている事を確認します。
[R254:IX2215] R254(config)# show dns cache DNS Resource Records: 10/128 www.google.com. 0 hits 0:03:13 IN A 173.194.38.113 www.google.com. 0 hits 0:03:13 IN A 173.194.38.112 www.google.com. 0 hits 0:03:12 IN A 173.194.38.115 www.google.com. 0 hits 0:03:12 IN A 173.194.38.116 www.google.com. 0 hits 0:03:12 IN A 173.194.38.114 amazon.com. 0 hits 0:00:44 IN A 72.21.215.232 amazon.com. 0 hits 0:00:44 IN A 176.32.98.166 amazon.com. 0 hits 0:00:44 IN A 72.21.194.212 amazon.com. 0 hits 0:00:44 IN A 205.251.242.54 changineer.info. 0 hits 0:58:53 IN A 133.242.169.96 R254(config)#