Build a DHCP server (SHARE)

Source: Internet
Author: User
Tags nameserver
One principle of self-building a server is to first let it work.


Let the DHCP server go to Ubuntu,

I wrote this article mainly because there is a small one, but it is not mentioned on the Internet as a key step. Looking at the instructions on the Internet, of course I chose a dhcp3-sever package.

# Aptitude install dhcp3-server

After installation, You need to modify the dhcp3-server file first, of course, just a little small change

# Vim/etc/default/dhcp3-server

Change interfaces = "" to interfaces = "eth0". eth0 is the name of the NIC, which can be found through the ifconfig command.

Next I want to talk about some problems that I haven't mentioned on the internet,

First, you need to determine the hostname of your machine, and check that the host name on my server is ubox-laptop (which will be used later ).

This is because I only talk about the connection between two machines and there is only one hub between them. Pass

# Ifconfig eth0 192.168.1.2

I modified the IP address of the server. Next, we will modify the DHCPD. conf file normally.

# Vim/etc/dhcp3/DHCPD. conf copy the sample.

Default-lease-time 600;

Max-lease-time 7200;

Option subnet-mask limit 255.0;

Option broadcast-address 192.168.1.255;

Option routers 192.168.1.2;

Option domain-name-servers 192.168.1.2;

Option domain-name "ubox-laptop ";

Subnet 192.168.1.0 netmask 255.255.255.0 {

Range 192.168.1.11 192.168.1.200;

}

The above sample will be explained in any help,

Here I want to say that I set Option routers to 192.168.1.2 (the IP address of my machine ),

This is not the same as the address I saw on the Internet, because I only have this server,

Therefore, it also acts as a logstore.

There is also the option domain-name option value. I set my hostname: "ubox-laptop ";

Well, don't restart the service after modifying the DHCP client of another computer,

Of course, I need to explain how to modify the DHCP client first.

# Vim/etc/Network/interfaces

The content is modified

Auto lo eth0

Iface eth0 Inet DHCP

Iface lo Inet loopback

This indicates that your eth0 Nic uses DHCP to obtain the IP address.

The last file to be modified is the resolv. conf file,

This file took me an hour to think. The content is the DNS server address.

Domain ubox-laptop

Search ubox-laptop

Nameserver 192.168.1.2

Because of my college network environment, the original content of this file is

Domain CC-kyoiku

Search CC-kyoiku

Nameserver 150.86.2.1

It describes the addresses of all the University's internal DNS servers, and I want to change them to my server information.

Now, restart the server.

#/Etc/init. d/dhcp3-server restart

The last command below is (to make a client)

#/Etc/init. d/networking restart

If your IP address is successfully set to 192.168.1.11 ~ A value between 192.168.1.200. Congratulations ~~

(I set ip_forward to 1, but it seems unnecessary.

# Echo 1>/proc/sys/NET/IPv4/ip_forward so it is omitted)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.