Tag Archives: dhcp server

How to Configure Vyatta as DHCP Server for LAN

vyatta

Scenario:

Vyatta dhcp server with 2 network cards (eth0 & eth1), eth0 is connected to Internet, while eth1 is connected to the LAN and serve as dhcp server for 10.10.10.0/24 subnet.

Configuring the LAN–facing Ethernet interface:

Connect to the Vyatta Firewall, then enter the configuration mode and list the configuration of eth1 interface(which will serve the ip address(es) to the LAN hosts):

configure
show interfaces ethernet eth1

1

Read more of this post

Advertisements

How to Setup a DHCP Server on CentOS 6.2

In this scenario, we have a CentOS server with two network cards, but it will only listen the dhcp request on one card (eth1).

Here is the configuration of eth1 interface:

cat /etc/sysconfig/network-scripts/ifcfg-eth1

CentOS as DHCP Server:

To install dhcp server, enter the following command at a terminal prompt:

sudo yum -y install dhcp

To make the dhcp server start at boot time, use this commands:

sudo chkconfig dhcpd on

As we are using more than one network card(s) in our CentOS server, so we need to specify on which interface our server will be listen for dhcp request. (By default, it listens on eth0).

You can change this by editing  /etc/sysconfig/dhcpd file:

sudo nano /etc/sysconfig/dhcpd

Add the name of the interface on which you want that your server will listen for dhcp request (In my case, it is eth1):

DHCPDARGS=eth1

Copy the default configuration file from  /usr/share/doc/dhcp-versidhcp/dhcpd.conf.sample to the /etc/dhcp/dhcpd.conf :

sudo cp /usr/share/doc/dhcp-*/dhcpd.conf.sample /etc/dhcp/dhcpd.conf

Now we will change the default configuration by editing /etc/dhcp/dhcpd.conf, I normally delete everything inside the file and manually add the configuration that suits my needs :-)

sudo nano /etc/dhcp/dhcpd.conf

Here is my dhcpd.conf file, you need to change it according to your needs:

ddns-update-style none;
authoritative;
log-facility local7;
default-lease-time 600;
max-lease-time 7200;
option subnet-mask 255.255.255.0;
option broadcast-address 172.16.10.255;
option routers 172.16.10.1;
option domain-name-servers 172.16.10.1;
option domain-name "centos.local";
subnet 172.16.10.0 netmask 255.255.255.0 {
 range 172.16.10.10 172.16.10.100;
}

Restart dhcp service using the following command:

sudo service dhcpd restart

Configure Windows as DHCP Client:

Just follow these steps, in order to configure your Windows machine as DHCP client (In my case, it’s Windows XP):

To check the IP Address on Windows XP:

To Check the DHCP Leases on CentOS Server:
cat /var/lib/dhcpd/dhcpd.leases

Hope this will help you!

Please Remember me in your prayers!

How to Install the DHCP Server on Ubuntu 12.04LTS

Ubuntu as DHCP Server:

To install dhcp server, enter the following command at a terminal prompt:

sudo apt-get install isc-dhcp-server

If there is more than one network card(s) in your Ubuntu server, then you have to select the network card on which your server will be listen for dhcp request. (By default, it listens on eth0).

You can change this by editing  /etc/default/isc-dhcp-server file:

sudo nano /etc/default/isc-dhcp-server

Change “eth0” to the interface on which you want that your server will listen for dhcp request (In my case, it is eth1):

It’s always a good practice to make a backup copy of /etc/dhcp/dhcpd.conf file:

sudo cp /etc/dhcp/dhcpd.conf /etc/dhcp/dhcpd.conf.bak 

Now we will change the default configuration by editing /etc/dhcp/dhcpd.conf, I normally delete everything inside the file and manually add the configuration that suits my needs 🙂

sudo nano /etc/dhcp/dhcpd.conf

Here is my dhcpd.conf file, you need to change it according to your needs:

ddns-update-style none;
default-lease-time 600;
max-lease-time 7200;
authoritative;
log-facility local7;
option subnet-mask 255.255.255.0;
option broadcast-address 10.10.1.255;
option routers 10.10.1.1;
option domain-name-servers 10.10.1.1;
option domain-name "ubuntu.internal";
subnet 10.10.1.0 netmask 255.255.255.0 {
range 10.10.1.50 10.10.1.200;
}

Restart dhcp service using the following command:

sudo service isc-dhcp-server restart 

Configure Windows as DHCP Client:

Just follow these steps, in order to configure your Windows machine as DHCP client (In my case, it’s Windows 7):

To check the IP Address on Windows 7:

To Check the DHCP Leases on Ubuntu Server:
sudo tail /var/lib/dhcp/dhcpd.leases

Hope this will help you!

Please Remember me in your prayers!

%d bloggers like this: