They offer different flash templates with latest features.
Login

Forgot password
Register
Back
Written by:
Oppression
Score: 0
votes: 7
Format: Article

 How to install DHCP and WEBMIN


For this tutorial you will need to have two lan cards(NIC) the first one lan card(eth0) is to connect to the router/modem and the second one (eth1) to connect to switch and to share ips at the local network with the DHCP, before we start to install and config the DHCP I would like to start with Webmin which is a web-based interface for system administration for Linux. We need to edit and add the source list with this command

sudo nano -w /etc/apt/sources.list

I prefer to use the nano editor with the switch “-w,” otherwise the editor textwraps my lines.

At the sources list add the lines and save it with ctr+o and ctr+z to exit:

deb http://download.webmin.com/download/repository sarge contrib 
deb http://webmin.mirror.somersettechsolutions.co.uk/repository sarge contrib

You should also fetch and install GPG key with which the repository is signed, with the commands :

cd /root 
wget http://www.webmin.com/jcameron-key.asc 
apt-key add jcameron-key.asc 

You will now be able to install with the commands :

apt-get update 
apt-get install webmin

Now we will install the DHCP server with this command:

sudo apt-get install dhcp3-server

Now we are going to setup our lan cards with static IPs with this command:

sudo nano -w /etc/network/interfaces

At the eth0 I declare my IP to connect to my router, if you don’t know what your router IP is you can give “ifconfig eth0″ or “route”.

auto eth0 
iface eth0 inet static 
address 192.168.1.100 
netmask 255.255.255.0 
network 192.168.1.0 
broadcast 192.168.1.255 
gateway 192.168.1.254 
dns-nameservers 192.168.1.254 
dns-search 192.168.1.254

For the eth1 now you can give something like this:

auto eth1 
iface eth1 inet static 
address 192.168.2.1 
netmask 255.255.255.0 
network 192.168.2.0 
broadcast 192.168.2.255

We now save the file and we are going to setup our DHCP server. The first one we need to edit is this one:

sudo nano -w /etc/dhcp3/dhcpd.conf

or if you are using a newer Linux version you can find it here:

sudo nano -w /etc/dhcp/dhcpd.conf

We add comments on these lines. With this symbol # we comment the lines:

# option definitions common to all supported networks... 
#option domain-name "example.org"; 
#option domain-name-servers ns1.example.org, ns2.example.org; 
#default-lease-time 600; 
#max-lease-time 7200;

Find these lines within the text and edit them like below:

# A slightly different configuration for an internal subnet. 
subnet 192.168.2.0 netmask 255.255.255.0 { 
range 192.168.2.100 192.168.2.200 ; 
option domain-name-servers 192.168.1.100;  
#  option domain-name "internal.example.org";  
option routers 192.168.2.1; 
option broadcast-address 192.168.2.255; 
default-lease-time 600; max-lease-time 7200; 
}

In the above example we will share a range of 100 IPs. If we need to share more IPs we need to change the number for example to 192.168.2.2 192.168.2.254

Now we declare which lan card will share ips in the local network:

sudo nano -w /etc/default/dhcp3-server

or if you are using a newer Linux version you can find it here:

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

We add “eth1″ and be careful don’t remove the symbols.

INTERFACES="eth1"

Save it and edit this file now to forward the IP:

sudo nano -w /etc/sysctl.conf

Remove the comment from this line:

net.ipv4.ip_forward=1

Now save this file and reboot your server. You need to connect your clients to the switch and  use the command ifconfig to see if the clients have taken the IP from the server.

Now if you want your clients to connect to the internet you must setup your firewall, so go to your browser and write this :

https://192.168.1.100:10000

You must give your IP which you have set up, your eth0 or the name of your server.

You must use your root username and password to log in which you use on your Linux Server. Now go to  NETWORKING -> LINUX FIREWALL then go to and set up the eth0 as NAT card and also activate on boot. Save them and restart the server.


Tags: DHCP WEBMIN
Created: 6 years ago.
Last edited: 6 years ago.
Reviewed: 6 years ago.


Comments

No comments so far.

Other tutorials from Oppression