DNSMASQ
Q. Configure Dnsmasq as a Pxe Boot Server " hiren boot " ?
Q. How to configure a dnsmasq server in linux centos 6 ?
Q. step by step dnsmasq server configuration in linux centos 6 ?
IP - 10.20.2.33
Hostname - khandwa.lokesh.com
OS - CentOS 6
Hostname - khandwa.lokesh.com
OS - CentOS 6
Dnsmasq provides network infrastructure for small networks:. dnsmasq is a lightweight DNS, TFTP, PXE, router advertisement and DHCP server. It is intended to provide coupled DNS and DHCP service to a LAN. It is designed to be lightweight and have a small footprint, suitable for resource constrained routers and firewalls. It has also been widely used for tethering on Smartphone’s and portable hotspots, and to support virtual networking in virtualization frameworks.
- domain-neededThis tells dnsmasq to never pass short names to the upstream DNS servers. If the name is not in the local /etc/hosts file then “not found” will be returned.
- bogus-priv All reverse IP (10.20.x.x) lookups that are not found in /etc/hosts will be returned as “no such domain” and not forwarded to the upstream servers.
- no-resolv Do not read resolv.conf to find the servers where to lookup dns.
- no-poll Do not poll resolv.conf for changes
- server=8.8.8.8 Set one or more DNS servers to use when addresses are not local. These are open DNS servers.
- local=/example.com/ Our local domain, queries in these domains are answered from /etc/hosts or the static-hosts files.
- address=/doubleclick.net/127.0.0.1 Use this force an address for the specified domains. e.g to block adverts force doubleclck.net to localhost
- no-hosts This options stops dnsmasq using the local /etc/hosts file as a source for lookups .
- addn-hosts=/etc/dnsmasq.d/static/hosts.conf Force dnsmasq to use this file for lookups. It is in the same format as /etc/hosts.
- expand_hosts So we can see our local hosts via our home domain without having to repeatedly specify the domain in our /etc/hosts file.
- domain This is your local domain name. It will tell the DHCP server which host to give out IP addresses for.
- dhcp-range This is the range of IPs that DHCP will serve: 10.20.2.50 to 10.20.2.150, with a lease time of 12 hours. The lease time is how long that IP will be linked to a host.
- dhcp-host=client,10.20.2.10,36h Any machine saying they are hostname = ‘client’ gets this IP address
- dhcp-option=option:router,10.20.2.1 When a host is requesting an IP address via DHCP also tell it the gateway to use.
- dhcp-option=option:ntp-server,10.20.2.5 When a host is requesting an IP address via DHCP also tell it the NTP to use.
Install Dnsmasq server and
# yum install syslinux*
Configuration Dnsmasq server as a PXE Boot
Enable configuration directory " conf-dir=/etc/dnsmasq.d "
create new pxe.conf file in configuration directory " dnsmasq.d "
To Enable TFTP Server by adding this section
tftp-root=/khandwa/lokesh.com/pxeboot # here "/khandwa/lokesh.com/pxeboot" is path of tftp server
enable-tftp
Dhcp Boot Option
dhcp-boot=pxelinux.0
dhcp-option=vendor:PXEClient,6,2b
dhcp-no-override
dhcp-range=10.20.2.20,proxy
Here i used "proxy" because i have already dhcp server in network if you don't have a dhcp server you can define range of ip
dhcp-range=10.20.2.50,10.20.2.150,12h
set pxe Boot Option
pxe-prompt="Press F8 for boot menu", 3
pxe-service=X86PC, "Boot from local hard disk", 0
Copy syslinux file in tftp server root directory
# mkdir /khandwa/lokesh.com/pxeboot
# cp /usr/share/syslinux/menu.c32 /khandwa/lokesh.com/pxeboot
# cp /usr/share/syslinux/pxelinux.0 /khandwa/lokesh.com/pxeboot
# cp /usr/share/syslinux/chain.c32 /khandwa/lokesh.com/pxeboot
# cp /usr/share/syslinux/memdisk /khandwa/lokesh.com/pxeboot
# cp /usr/share/syslinux/mboot.c32 /khandwa/lokesh.com/pxeboot
Create pxelinux.cfg directory
# mkdir /khandwa/lokesh.com/pxeboot/pxelinux.cfg
Create "default" file for boot menu
# vi /khandwa/lokesh.com/pxeboot/pxelinux.cfg/default
default menu.c32
prompt 0
timeout 300
ONTIMEOUT local
# Menu for Hiren Live Boot
LABEL Hiren # label name of iso
MENU LABEL Hirens BootCD # menu label name
KERNEL memdisk # kernel for ISO image called memdisk
APPEND iso initrd=hiren10.iso raw # path of iso image, here iso image path /khandwa/lokesh.com/pxeboot/hiren10.iso
prompt 0
timeout 300
ONTIMEOUT local
# Menu for Hiren Live Boot
LABEL Hiren # label name of iso
MENU LABEL Hirens BootCD # menu label name
KERNEL memdisk # kernel for ISO image called memdisk
APPEND iso initrd=hiren10.iso raw # path of iso image, here iso image path /khandwa/lokesh.com/pxeboot/hiren10.iso
If you get error after Restart the Service
dnsmasq: failed to create listening socket: Address already in use

check port of dns ( 53 ) & kill it
# netstat -anlp | grep -w LISTEN
Kill this process
# kill -9 1792
Now Again restart service
# service dnsmasq restart
Note : enable network boot setting in BIOS
# kill -9 1792
Now Again restart service
# service dnsmasq restart
Now go to the client maching and boot form network
Note : enable network boot setting in BIOS