Linux - dnsmasq - dns cache
2015-06-07 23:59
686 查看
Install Dnsmasq
Platform: Kali Linuxroot:~ /# apt-get install dnsmasq
Dnsmasq configuration
After dnsmasq installation, we need to use it. First, we need to set dnsmasq work directory.root:~ /# mkdir /etc/dnsmasq root:~ /# cp /usr/share/doc/dnsmasq-base/examples/dnsmasq.conf.example /etc/dnsmasq/dnsmasq.conf
Second, we can modify /etc/resolv.conf, and add “nameserver 127.0.0.1” to the first line.
root:~ /# cat /etc/resolv.conf nameserver 127.0.0.1 nameserver 8.8.8.8
Edit dnsmasq.conf as follow at the same time.
root:~ /# cat /etc/dnsmasq/dnsmasq.conf port=53 resolv-file=/etc/dnsmasq/resolv.dnsmasq.conf strict-order address=/google.com/192.168.1.1 interface=eth0 listen-address=127.0.0.1 addn-hosts=/etc/dnsmasq/hosts.dnsmasq.conf log-queries log-facility=/var/log/dnsmasq.log
Make dnsmasq as a service
create file “/etc/init.d/dnsmasq”#!/bin/sh # # Startup script for the DNS caching server # # description: This script starts your DNS caching server # processname: dnsmasq # pidfile: /var/run/dnsmasq.pid dnsmasq=/usr/sbin/dnsmasq OPTIONS="-C /etc/dnsmasq/dnsmasq.conf" [ -f $dnsmasq ] || exit 0 RETVAL=0 # See how we were called. case "$1" in start) echo -n "Starting dnsmasq: " $dnsmasq $OPTIONS RETVAL=$? echo [ $RETVAL -eq 0 ] && touch /var/lock/dnsmasq ;; stop) if test "x`pidof dnsmasq`" != x; then echo -n "Shutting down dnsmasq: " killall dnsmasq fi RETVAL=$? echo [ $RETVAL -eq 0 ] && rm -f /var/lock/dnsmasq /var/run/dnsmasq.pid ;; reload) echo -n "Reloading dnsmasq: " killall dnsmasq -HUP RETVAL=$? echo ;; restart) $0 stop $0 start RETVAL=$? ;; *) echo "Usage: $0 {start|stop|restart|reload}" exit 1 esac exit $RETVAL
相关文章推荐
- Linux: 使用screen管理你的远程会话
- linux基础—分区与目录
- Linux系统中常用操作命令
- linux ubuntu 下面安装google浏览器
- Linux-权限管理(二)
- U盘安装centos 6.4教程
- 编译android的linux kernel goldfish
- Linux-权限管理(一)
- Linux CC攻击脚本
- 将一张JPEG图片通过嵌入式linux的帧缓冲机制绘制到7寸触摸屏上
- CentOS 7 巨大变动之 systemd 取代 SysV的Init
- Linux常用命令-文件搜索命令-文件搜索命令find
- arm-linux学习笔记3-linux内存管理与文件操作
- linux 安装软件大全
- kali linux字体渲染和infinality安装配置
- How to retrieve and change partition's UUID Universally Unique Identifier on linux
- Telnet服务配置Linux+Windows
- Find Linux WWID’s and Fiber Channel Storage
- Linux常用命令-权限管理命令-其他权限管理命令
- Linux下安装zookeeper