How to configure DHCP to run over multiple networks

Several tutorials

How to configure DHCP to run over multiple networks

Mensagempor BrazilFW » Seg Dez 24, 2007 7:48 pm

Versión en Español

Author:
scrapper



Why to do that?
- Using DHCP will save a great deal of time for the network administrator. No more running around to assign all of the addresses manually on each workstation. Handle it dynamically.


What do you need?
- A WORKING BrazilFW machine with 3 NICs
- An SSH client. (PuTTY is a very good small footprint option)


Note:
If you do not know how to use PuTTY, good instruction for connecting to the BrazilFW with PuTTY can be found in the "How To Make a SSH Tunnel Using BrazilFW" article. Another place to read up on it is the authors web site at ttp://www.chiark.greenend.org.uk/~sgtatham/putty/

In this example we will be dealing with a BrazilFW machine that has three (3) network cards.

ETH0 - Set up as 192.168.0.1
ETH1 - Connected to the internet
ETH2 - Set up as 192.168.1.1 (DMZ)

and DHCP already running on the 192.168.0.1 network.

First off, connect to the BrazilFW using PuTTY. Once the menu is displayed, use the "q) Exit Menu" option to go to the command prompt.

A file must now be created to give BrazilFW the new network to run the DHCP protocol on. To do this type "edit /etc/dnsmasq.conf.template" (without the "") at the command prompt and press <Enter>.

This will create a blank file in the /etc/ directory called dnsmasq.conf.template. The syntax for entries in this file is

Código: Selecionar todos
dhcp-range=<START ADDRESS>,<END ADDRESS>,<LEASE TIME>


So the entry in out dnsmasq.conf.template file would look like this

Código: Selecionar todos
dhcp-range=192.168.1.2,192.168.1.254,12h


Note:
The DHCP range entered does not include the IP Address of the NIC that is serving the network. In this case 192.168.1.1.

Exit and save the file using <Ctrl>-'Q' then 'Y'.

The DNS now has to be restarted to bring the DHCP range into effect. Type "/etc/rc.d/rc.dnsmasq restart" (without the "") and press <Enter>.


Note:
When the DNS is restarted you should receive the following information

Código: Selecionar todos
      Stopping DNS and DHCP server
      Generating hosts Configuration file...
      Generating resolv.conf Configuration file...
      Generating DHCP Configuration file...
      Starting DNS and DHCP server


This information tells you that the DNS and DHCP has been stopped and started without any problems. If you receive the following information

Código: Selecionar todos
      Stopping DNS and DHCP server
      Generating hosts Configuration file...
      Generating resolv.conf Configuration file...
      Generating DHCP Configuration file...
      cat: Write Error: No space left on device
      Starting DNS and DHCP server


The /etc/rc.d/rc.dnsmasq script needs to be edited. Line 193 needs to be changed from

Código: Selecionar todos
[ -e "/etc/dnsmasq.conf.template" ] && cat /etc/dnsmasq.conf.template >> /etc/dnsmasq.conf.template


to

Código: Selecionar todos
[ -e "/etc/dnsmasq.conf.template" ] && cat /etc/dnsmasq.conf.template >> /etc/dnsmasq.conf


Now that the DNS has been restarted, check the /etc/dnsmasq.conf. The files should contain the following information

Código: Selecionar todos
user=root
group=root
domain-needed
expand-hosts
filterwin2k
local=/***your domain here***/
domain=***your domain here***
resolv-file=/etc/resolv.dns
dhcp-leasefile=/var/state/dhcp/dhcpd.leases
dhcp-range=192.168.0.234,192.168.0.254,7200
dhcp-range=192.168.1.234,192.168.1.254,12h


The set up is now complete and DHCP is running on the seond NIC. Go back to the menu and backup the configuration using the "w) Write configuration to disk" option to backup the changes.


Where can I get more information?
http://www.chiark.greenend.org.uk/~sgtatham/putty/
http://thekelleys.org.uk/dnsmasq/doc.html
viewtopic.php?t=54539


Credits, Licenses, Sources and Documentation
BrazilFW - Claudio
DHCP Setup and script fix - Claudio
PuTTY - Simon Tatham - http://www.chiark.greenend.org.uk/~sgtatham/putty/
BrazilFW
 

Voltar para Several tutorials

Quem está online

Usuários navegando neste fórum: Nenhum usuário registrado e 0 visitantes

cron