Get the App
SLTechnology News&Howtos  ›  Servers  › 

Redhat7.3-dhcp and dhcp relay server configuration

Shulou Source: shulou.com Published: 2022-06-02 22:19:57 09月22日 Update

1. Set host, firewald, selinux

Hostnamectl set-hostname fengxiaoli41.com

Systemctl stop firewalld.service

Systemctl disable firewalld.service

Setenforce 0

two。 Configure basic dhcp services

Yum install-y dhcp

Vim / etc/dhcp/dhcpd.conf

# Global parameters

Option domain-name "fengxiaoli41.com"

Option domain-name-servers dns.fengxiaoli41.com

Default-lease-time 600

Max-lease-time 7200

Authoritative

Log-facility local7

# configure 192.168.1.0 network segment dynamic acquisition

Subnet 192.168.1.0 netmask 255.255.255.0 {

Range dynamic-bootp 192.168.1.20 192.168.1.254

Option broadcast-address 192.168.1.255

Option routers 192.168.1.1

}

# configure the 192.168.1.0 network to assign a fixed ip to the mac

Host feng {

# hardware ethernet MAC

Fixed-address 192.168.1.5

}

Systemctl restart dhcpd

Systemctl status dhcpd

-at this point, clients can obtain dynamic and fixed ip

3. Relay server

Vim / etc/dhcp/dhcpd.conf

# configure 192.168.2.0 as the dhcp relay network segment (if not in the middle)

Subnet 192.168.2.0 netmask 255.255.255.0 {

Range dynamic-bootp 192.168.2.20 192.168.2.254

Option broadcast-address 192.168.2.255

Option routers 192.168.2.254

}

Cp / lib/systemd/system/dhcrelay.service / etc/systemd/system/

Cd / etc/systemd/system/

Vim dhcrelay.service

[Service]

ExecStart=/usr/sbin/dhcrelay-d-no-pid 192.168.1.10

4. Restart the service

Systemctl-system daemon-reload

Systemctl restart dhcrelay.service

Note: before configuration, ensure the network interconnection between the dhcp server and the relay server, the dhcp server is 192.168.1.0 network segment, and the relay server 192.168.2.0 network segment. In addition, two network cards can be added to the dhcp server to configure the relay server and the dhcp server on the same server.

Tags: Service server configuration relay network segment dynamic network global parameters available in customer client network card so far first guarantee assign Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno MySQL Huawei Xiaomi Microsoft Shulou Information