Friday, December 12, 2014

Set up dhcp linux


Set up dhcp under linux:


What is a dhcp server 
I will used my paraphrase in my own word. There are many information that you can get from internet.

Basely a dhcp server is a dynamic ip(internet protocol)  address that will assign to the host. Everyone today used internet, we need to connect lan cable to a hub, switch or etc. These hub switch might have a dhcp server in the backbone or in front of them, else it will not be able to assign ip to the host.

A ip address will have a unique ip address, in other word no one is going to have a same ip address.
So the fundamental concept of a dhcp is like this:
1. we set up a dhcp server( linux or window]
2. we prepare a switch , or a hub, and connected to dhcp server.
3 Right now if any host is being connected to the hub or switch, will have a dynamic ip.

I will teach you how to mange an effective ip address for user to used. There are two difference ways of mange dhcp. One is to set a static ip address by an interface mac address, and two is by rang an ip address.


Set up particular pc ip address into static ip. 
If you have many host or more than 10 HOST PC or Server, it is hard to control or manage a dhcp. So we will needed to add a particular interface mac and set a static ip, this will be more easier to know which pc is which.

host ASER_HOSTA {
  hardware ethernet AB:AA:BB:CC:DD:EE;
  fixed-address 192.168.2.100;
}

host ASUS_HOSTB {
  hardware ethernet CD:AA:BB:CC:DD:EE;
  fixed-address 192.168.2.101;
}


Set up a dhcp range
If you need to set up a dhcp server, you can add or not add a rang. I will prefer you add a rang between 101~200, this mean ip will be between 101 and 200. Again this will be easier to manage you dhcp server.

subnet 192.168.1.0 netmask 255.255.255.0 {
range 192.168.1.101 192.168.1.200;
 option subnet-mask 255.255.255.0;
}


Set up a dhcpv6 range

default-lease-time 600;
max-lease-time 7200;
log-facility local7;
subnet6 2001:db8:0:1::/64
{
#Range for clients
range6 2001:db8:0:1::129 2001:db8:0:1::254;
}

No comments:

Post a Comment