Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Centos 7 DHCP installation and configuration

2025-04-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

# Centos 7 DHCP installation and configuration

I.

Three elements of service: installation-configuration-startup

1. So the first step is to install the program.

Rpm-ivh / mnt/Packages/dhcp-4.2.5-58.el7.centos.x86_64.rpm-install DHCP package

two。 Modify the configuration file of DHCP

Rpm-ql dhcp | grep dhcpd.conf.example-find the configuration template file of the dhcp service

Cp- rf / usr/share/doc/dhcp-4.2.5/dhcpd.conf.example / etc/dhcp/dhcpd.conf-copy the configuration template and go to / etc/dhcp/dhcpd.conf

Vi / etc/dhcp/dhcpd.conf-modify the dhcp configuration file, global configuration, and modify the following in the configuration file

Subnet 192.168.80.0 netmask 255.255.255.0 {- the network segment declares the subnet + segment netmask+ subnet mask

Range 192.168.80.100 192.168.80.200;-sets the ip address pool for allocation

Option routers 192.168.80.1;-set the default gateway of the client

Option domain-name-servers 2.2.2.2, 3.3.3.3;-configure DNS server

Default-lease-time 600;-default lease time

Max-lease-time 7200;-specify the maximum lease length

}

# host boss {- host declaration

# hardware ethernet MAC address-specify a different pc (printer) mac address

# fixed-address 192.168.80.188;-fixed address

#}

: wq-- Save exit

3.

Service dhcpd start-start

Netstat-anpu | grep dhcp-check whether port 67 is working

Systemctl stop firewalld-turn off the firewall

Setenforce 0-- turn off selinux Firewall

IV.

Windows 7-one

Test steps:

The above are dynamically assigned IP addresses

5.

What if you want to assign an IP address to a host?

1. Modify the configuration file

Vi / etc/dhcp/dhcpd.conf

Find the following

Host boss {- host declaration

Hardware ethernet MAC address-specify the mac address, which is simply the address of the network card

Fixed-address 192.168.80.188;-the specified address must be within the range assigned by the address pool and within a network segment

}

: wq-- Save exit

Cat / var/log/messages-check the log and find the MAC address, as shown in the following figure

Copy the MAC address and perform the appropriate action when modifying the configuration file

Service dhcpd restart-restart the DHCP service

Check the detailed message after going back to win7

1. Disable the network card and start it up, otherwise you won't see the effect.

When the IP address is the address you specified, your fixed address is assigned successfully

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report