郭留英

郭留英的博客

他的个人主页  他的博客

The DHCP service

郭留英  2009年10月30日 星期五 16:18 | 1332次浏览 | 2条评论

The simple set up of dhcp-server in ubuntu system!

     Talking about dhcp it is really a useful service for LAN and the seting up of dhcp is also simply!

    OK,let's look at how to do this through some briefness steps!

    First you need download the dhcp-server by using"sudo apt-get install dhcp3-server" command or through the Synaptic Package Manager even others which could do the same thing

    After that you could do as follows:

    Editing  /etc/default/dhcp3-server file  by "sudo vi /etc/default/dhcp3-server"   find the line INTERFACES="xxx" replace the xxx with the  network card which you want to use to provide this service ! The default is "eth0" stand for the first network card. Don't forget save the file !

   Then  You need to change the following sections in /etc/dhcp3/dhcpd.conf file using the same command as above .

   Add or change the content as follows:

 

default-lease-time 600;
max-lease-time 7200;

option subnet-mask 255.255.255.0;
option broadcast-address 192.168.1.255;
option routers 192.168.1.254;
option domain-name-servers 192.168.1.1, 192.168.1.2;
option domain-name “yourdomainname.com”;

subnet 192.168.1.0 netmask 255.255.255.0 {
range 192.168.1.10 192.168.1.200;
    }


save and exit the file!

Is it easy? Yes .  This file told the client some thing about the subnet especially the gateway is 192.168.1.254 and the DNS is 192.168.1.1 and 192.168.1.2 Others maybe easy for you !

If you want to distribute a special IP to the client you could do these:

default-lease-time 600;
max-lease-time 7200;

option subnet-mask 255.255.255.0;
option broadcast-address 192.168.1.255;
option routers 192.168.1.254;
option domain-name-servers 192.168.1.1, 192.168.1.2;
option domain-name “yourdomainname.com”;

subnet 192.168.1.0 netmask 255.255.255.0 {
range 192.168.1.10 192.168.1.200;
   }

host server1 {
hardware ethernet 00:1b:63:ef:db:54;
fixed-address 192.168.1.20;
   }

host server2 {
hardware ethernet 00:0a:95:b4:d4:b0;
fixed-address 192.168.1.21;
   }

host printer1 {
hardware ethernet 00:16:cb:aa:2a:cd;
fixed-address 192.168.1.22;
   }

host printer2 {
hardware ethernet 00:0a:95:f5:8f:b3;
fixed-address 192.168.1.23;
    }

It is OK now , at there you should use the

sudo /etc/init.d/dhcp3-server restart      to restart the dhcp3-server
and there it has finished .
The client is more easy thing to do just do
sudo dhclient command !


The simple set up is finished!Is it easy?

 

评论

我的评论:

发表评论

请 登录 后发表评论。还没有在Zeuux哲思注册吗?现在 注册 !
皮诺曹

回复 皮诺曹  2009年11月01日 星期日 22:47

很久都没有在linux服务器配DHCP服务 有点意思

1条回复

  • 郭留英

    回复 郭留英  2009年11月02日 星期一 13:42

    dhcp还是挺有用的,不过不知道安全问题该怎么样?

    0条回复

暂时没有评论

Zeuux © 2024

京ICP备05028076号