Install DHCPSever in Ubuntu of VirtualBox

Source: Internet
Author: User
Tags network function
Because there are two virtual machines, XP and Ubuntu, I want to swap files conveniently, so I want to use the built-in network function Internal in Virtualbox, and use the Internal Nic In the virtual machine, it will be in an independent virtual LAN, but there is no network server in the network, such as DHCP, DNS, and so on, so we start to install a DHCP server, by the way, we will take this opportunity to build a network lab. First, let's talk about the environment. the Ubuntu virtual machine has two NICs, one being NAT (eth0 ),

Because there are two virtual machines, XP and Ubuntu, I want to swap files conveniently, so I want to use the built-in network function Internal in Virtualbox, and use the Internal Nic In the virtual machine, it will be in an independent virtual LAN, but there is no network server in the network, such as DHCP, DNS, and so on, so we start to install a DHCP server, by the way, we will take this opportunity to build a network lab.

First, let's talk about the environment. the Ubuntu virtual machine has two NICs: NAT (eth0) and Internal (eth1). We will use eth1 as the dhcp server.

First install the dhcp server, open the terminal, and enter:

Sudo apt-get install dhcp3-server

After installation, You need to modify two configuration files, one is to modify the NIC and the other is the server configuration.

The first file to be modified is/etc/default/dhcp3-server

Enter eth1 in the quotation marks of INTERFACE =:

# Defaults for dhcp initscript

# Sourced by/etc/init. d/dhcp

# Installed at/etc/default/dhcp3-server bythe maintainer scripts

# This is a POSIX shell fragment

# On what interfaces shocould the DHCP server (dhcpd) serve DHCP requests?

# Separate multiple interfaces with spaces, e.g. "eth0 eth1 ".

INTERFACES = "eth1"

The second change is/etc/dhcp3/dhcpd. conf.

There are many examples written in this file, but they are commented out. If you are interested, please read them.

Find

# A slightly different configuration for an internal subnet.

The following is a detailed example of this line. We can just modify it based on this:

Subnet 192.168.2.0 netmask1_255.255.0 {

Range 192.168.2.0 192.168.2.255;

Option domain-name-servers 192.168.2.1, 192.168.2.2;

Option domain-name "ubtw.net ";

Option routers 192.168.2.3;

Option broadcast-address 192.168.2.255;

Default-lease-time600;

Max-lease-time7200;

}

Save the modification.

However, the server cannot be started yet. Now we need to go to the Ubuntu network settings and modify ipv4 setting of eth1, where Method is set to Manual. Add 192.168.2.0, Newmask: 255.255.255.0, Apply, and connect eth1 to Address.

Now you can start the DHCP server and enter

Sudo/etc/init. d/dhcp3-server stop

Sudo/etc/init. d/dhcp3-server start

If you see

* Starting DHCP server dhcpd3 [OK]

It indicates that the server is successfully started, and then the XP Virtual Machine is started for testing. If the IP address can be obtained successfully, it indicates that the server is successfully started.

If you see

* Starting DHCP server dhcpd3

* Check syslog for diagnostics. [fail]

You can try restarting Ubuntu or check whether the above steps are correct or missing.

Related Article

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.