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

How to configure DHCP in CentOS7 environment

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

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

This article mainly explains "how to configure DHCP in the CentOS7 environment". The content in the article is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn how to configure DHCP in the CentOS7 environment.

Step 1 of the configuration command in the CentOS7 environment, set the DHCP configuration file yum-y install dhcp # first install dhcp. By default, the system does not install cd / etc/dhcp # enter the dhcp directory lsless dhcpd.conf # take a look at the dhcp configuration file Mostly no content cd / usr/share/doc/dhcp-4.2.5 # dhcp configuration file reference template less dhcpd.conf.example # View configuration file reference template cp/ usr/share/doc/dhcpd.conf.example / etc/dhcp/dhcpd.conf # copy template file to configuration file vim / etc/dhcp/dhcpd.conf # go to edit dhcp configuration file 2. Set up the global configuration default-lease-time 21600 # the default lease is 6 hours in seconds max-lease-time 43200; # the maximum lease is 12 hours in seconds option domain-name "…" ; # specify the default domain name option domain-name-servers... ; # specify DNS server address ddns-update-style none # disable DNS dynamic update 3. Network segment declaration applies to the entire subnet segment. Some configuration parameters take precedence over the global configuration parameter subnet 192.168.80.0 netmask 255.255.255.0 {# first declare the dhcp server network segment and subnet mask range 192.168.80.10 192.168.80.20 # set ip address pool option routers 192.168.80.254; # specify default gateway} subnet 192.168.1.0 netmask 255.255.255.0 {# then declare other network segments and subnet range 192.168.1.100 192.168.1.200; # set ip address pool option routers 192.168.1.254 # specify default gateway default-lease-time 45600 option domain-name-servers 8.8.8.8;} 4. Host host declaration assigns a fixed IP address to the stand-alone machine host hostname {# specifies the client name hardware ethernet xx:xx:xx:xx:xx:xx that needs to be assigned a fixed IP address # specify the MAC address of the host fixed-address 192.168.80.100 # specify the IP address reserved for the host} 5, Finally, enable service systemctl start dhcpd # enable dhcp service systemctl stop firewalld # close firewall sentenforce 0 # turn off firewall netstat-naup | grep 67 # check whether the service starts tail-f / var/log/messages # if startup fails You can troubleshoot the error FTP service by viewing the log file

FTP service, the protocol used to transfer files, the FTP server uses ports 20 and 21 of the TCP protocol to communicate with the client by default.

Port 20 is used to establish data connections and transfer file data.

Port 21 is used to establish a control connection and transmit FTP control commands.

FTP data connections are divided into active mode and passive mode:

The server initiates a data connection. First of all, the client establishes a FTP control connection to port 21 of the server. When it needs to transfer data, the client tells the server with PORT command, "I have opened a certain port, you come and connect me", so the server sends a request from port 20 to the port of the client and establishes a data connection.

Passive mode: the server passively waits for a data connection. If the network firewall where the client is located prohibits active mode connections, passive mode is usually used. First of all, the client establishes a FTP control connection to port 21 of the server. When it needs to transfer data, the server tells the client with a PASV command, "I have opened a certain port, you come and connect me", so the client sends a request to the port (non-20) of the server and establishes a data connection.

Step 1 of the FTP experiment, install the software package ym install-y vsftpd or rpm-ivh vsftpd-3.0.2-25.el7.x86_64.rpmcd / etc/vsftpd/cp vsftpd.conf vsftpd.conf.bak or cp vsftpd.conf {, .bak} 2, set the FTP service accessed by anonymous users (maximum permission) vim / etc/vsftpd/vsftpd.confanonymous_enable=YES to enable anonymous user access. The write permission of the write_enable=YES open server is enabled by default (it must be enabled if you want to upload). Anon_umask=022 is enabled by default to set the permission mask (anti-mask) for data uploaded by anonymous users. Anon_upload_enable=YES allows anonymous users to upload files. It is commented by default. Uncomment anon_mkdir_write_enable=YES allows anonymous users to create (upload) directories. It is annotated by default. You need to uncomment anon_other_write_enable = YES to allow deletion, renaming, overwriting and other operations. Need to set the maximum permissions for anonymous access to the pub subdirectory under the root directory of ftp, so that anonymous users upload data chmod 777 / var/ftp/pub/ ftp root directory # enable services, turn off firewall and enhanced security features systemctl start vsftpd enable FTP services systemctl stop firewalld turn off firewall setenforce 0 turn off enhanced security functions III. Anonymous access testing

On the windows system, open the start menu and enter the cmd command to open the command prompt # to establish a ftp connection

Establish ftp connection ftp 192.168.80.10 anonymous access, user name ftp,passwd is empty Enter directly to log in to ftp > pwd to access ftp anonymously. The root directory of ftp is / var/ftp/ directory of Linux system ftp > ls view current directory ftp > cd pub switch to pub directory ftp > get file name download file to current windows local directory ftp > put file name upload file to ftp directory ftp > quit exit 4, set local user authentication to access ftp And prohibit switching to a directory other than ftp (default login root directory is local user's home directory) vim / etc/vsftpd/vsftpd.conf modify configuration file local_enable=Yes enable local user anonymous_enable=NO turn off write permission for anonymous users to access write_enable=YES open server (if you want to upload Must be enabled) local_umask=077 can be set to only host users have permissions for uploaded files (anti-mask) chroot_local_user=YES will access restricted users' home directories in the user's host directory allow_writeable_chroot=YES allows restricted users' home directories to have write access systemctl restart vsftpd restart services or enter ftp 192.168.80.10 in the windows network, modify anonymous users, Default root directory anon_root=/var/ www/ html anon root logged in by local users for anonymous users local_root=/var / www/ html local root for system users 6. Use user_list user list file vim / etc/vsftpd/user_list/ to add zhangsan user zhangsanvim / etc/vsftpd/vsftpd.confuserlist_enable=YES enable user_list user list file userlist_deny=NO set whitelist Only users of the user_list user list file are allowed to access. The default is YES, which is blacklisted. Thank you for reading. The above is the content of "how to configure DHCP in CentOS7 environment". After the study of this article, I believe you have a deeper understanding of how to configure DHCP in CentOS7 environment, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

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

Development

Wechat

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

12
Report