Linux Reality episode 60
Configure dnsmasq
This is all done in the openSUSE operating system
I installed dnsmasq using Yast.
DNS and DHCP are configured using the following files
/etc/hosts
/etc/dnsmasq.conf
/etc/resolv.conf
/etc/hostname
Edit /etc/hosts. This can be done either in Yast via hostnames or directly with a text editor. Add a line for each networked component or computer.
192.168.1.1 router
192.168.1.2 computer1
192.168.1.3 printer
Edit /etc/dnsmasq.conf. Uncomment and edit the following lines
expand-hosts
domain=yourdomain.lan
dhcp-range=192.168.1.100,192.168.1.150,168h
dhcp-option=3,192.168.1.1
expand-hosts will automatically add .yourdomain.lan to hostnames in /etc/hosts
yourdomain can be called whatever you want. The value has to match what is shown in Yast under hostname and domain.
dhcp-range specifies the range of ip addresses available for dhcp. The last entry (168h) specifies the duration of the lease. It can be entered as minutes (m), hours (h) or infinite (infinite).
dhcp-option=3 specifies the router (gateway) ip address. If you don't change this the default is to use the server ip as the router. If you have a Linksys or other router and have not configured the server as a router you will not be able to get external ip addresses or websites.
/etc/resolve.conf on the dns/dhcp server should only contain the external name servers. On my machine these are:
nameserver 66.75.160.63
nameserver 66.75.160.64
/etc/hostname should contain the hostname and domain. On my machine this is:
server.yourdomain.lan
to verify the hostname is what you think it is, type
$hostname
this will return the hostname without the domain. On my machine this is:
server
In Yast open the runtime services GUI and enable dnsmasq to startup at boot.
On the command line restart dnsmasq
#/etc/init.d/dnsmasq restart
Now you can open a browser and type
printer.yourdomain.lan
and the web configuration screen for your printer will appear. Or,
router.yourdomain.lan
and the configuration screen for your router will appear.
In the mail client enter
server.yourdomain.lan
to point to the IMAP server
Don't forget to update your network components to use the server ip address for dns or dhcp and to disable dhcp on your router.
Monday, January 7, 2008
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment