Recently, the DNS redirection problem was involved when I modified the software for the customer. So I studied the DNS of the DSL ROUTER in the broadcom solution and implemented DNS processing in opensuSE.
I. Introduction
1. The broadcom scheme dsl router implements DNS proxy through DNSmasq. DNSmasq is a lightweight and easy-to-use DNS service tool. It can be used for IP address translation during Intranet and Internet connection, or for small network DNS services.
It provides the following practical functions:
1. Provide dns Service
2. Use local custom dns first
3. Provide dhcp Service (this dsl router is not used)
2. dns proxy principle: See the following network topology:
2.1 enter a domain name for the PC. For example, enter a domain name for the PC browser to generate a DNS request.
2.2 If the IP address of the pc dns server is the IP address of the ROUTER and the ROUTER supports DNS proxy and is enabled, the DNS request generated by the PC will be sent to the processing process of the ROUTER. ROUTER.
2.3 The ROUTER processing process first queries whether the/etc/hosts file in the cache contains the IP address of the domain name. If yes, the system replies to the DNS. If this DNS request is not forwarded to the upper-level dns server Based on the/etc/resolv. conf configuration, it will be processed by the upper-level dns server.
Ii. Installation
1. Install opensue10.3 in vmware
Download: http://www.thekelleys.org.uk/dnsmasq/dnsmasq-2.52.tar.gz
Unzip: tar-xzf dnsmasq-2.52.tar.gz
Compile and install: cd dnsmasq-2.52
Make install
2. Configuration
By default, dnsmasq uses/etc/resolv. conf of the system and reads/etc/hosts,
The/etc/resolv. conf file is used to configure the upper-level DNS
The/etc/hosts file is used to store the dns proxy cache.
Dnsmasq can use the hosts file to set the Domain Name:
For example, test.sudone.com does not exist. In dnsmasq, I point to an ip address:
Echo "64.233.189.99 test.sudone.com">/etc/hosts
Or directly add an ip address through vi/etc/hosts.
Restart after modification: pkill-9 dnsmasp &/usr/local/sbin/dnsmasq-h
Configure the network, that is, ensure that opensue10.3 and windows can be pinged, and enter the IP address of opensue10.3 In the DNS server configured for windows.
3. Practice
Run cmd.exe on windows to clear the dns Cache: arp-d
Enter the domain name www.baidu.com in the browser.
The IP address returned by the dns request of www.baidu.com is 64.233.189.99.
Author: "linux network applications"