foreword
For configuration and installation, please refer to the following two articles for details
https://cnxiaobai.com/articles/2021/04/21/1619011285612.html
https://cnxiaobai.com/articles/2021/10/21/1634800698273.html#b3_solo_h3_1There
are different aspects of network configuration. I have modified this operating system resource below. It took me
a long time to figure it out and share the pits I stepped on.
Network configuration: Original article https://cnxiaobai.com/articles/2021/04/21/1619011285612.html But it is not applicable to centos 8
- The following are applicable to
CentOS8
Modify the configuration file
- Probably not.
ens33
My environment is Dragon Lizard.ens160
If you do the same, please modify the ens160 configuration file
vi /etc/sysconfig/network-scripts/ifcfg-ens33```
To see the content, just modify the remarks part
TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
BOOTPROTO=static
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=stable-privacy
NAME=ens33
UUID=44d35e8e-6f13-4ef5-bd52-069e158666be
DEVICE=ens33 -- 这个可能不同 但是不要改它
ONBOOT=yes
IPADDR=192.168.10.15
NETMASK=255.255.255.0
GATEWAY=192.168.10.2
DNS1=223.6.6.6
DNS2=223.5.5.5
BOOTPROTO=dhcp 修改为 BOOTPROTO=static
ONBOOT=no 修改为 ONBOOT=yes
新增以下内容,其余配置项不变
IPADDR=192.168.10.15
NETMASK=255.255.255.0
GATEWAY=192.168.10.2
DNS1=223.6.6.6
DNS2=223.5.5.5
Restart the network
# systemctl restart network
1. How to restart the network on CentOS6:service network restart
2. How to restart the network on CentOS7:systemctl restart network
3. How to restart the network on CentOS8:
nmcli c reload
or
nmcli c reload [网卡名]
closureselinux
- Change SELINUX=enforcing to SELINUX=disabled
# vim /etc/sysconfig/selinux
speed up SSH
the connection
- found
#UseDNS yes
and changed it toUseDNS no
# vim /etc/ssh/sshd_config
UseDNS no - 我这个没有 我自己加上去了
- Restart the ssh service
# systemctl restart sshd
- if not
1. First install the SSH service
yum install openssh-server
2. Start the SSH service
systemctl start sshd
3. View SSH service status
systemctl status sshd
4. Check the port
netstat -antp | grep sshd
5. Join the startup
systemctl enable sshd
6. Other common commands of SSH
#启动sshd服务
systemctl start sshd
#停止sshd服务
systemctl stop sshd
#重启sshd服务
systemctl restart sshd
#查看sshd服务的状态
systemctl status sshd
#sshd服务开机启动
systemctl enable sshd
#sshd服务禁止开机启动
systemctl disable sshd
#锁定sshd服务
systemctl mask sshd
#解锁sshd服务
systemctl unmask sshd
#重新加载sshd服务的配置文件
In the VMware Workstation Pro virtual machine environment, if the virtual machine needs to be connected to the Internet, the following operations need to be performed
Edit virtual machine network
- Click Edit on the menu bar, select
虚拟网络编辑器
Click to change configuration
chooseVMnet8
- Click to select
VMnet8
to modify the subnet IP and subnet mask
- click
NAT 设置
- Modify gateway IP
- click
DHCP 设置
- Set
起始 IP 地址
,结束 IP 地址
, it should be noted that the IP segment must be consistent with the subnet IP segment set in the previous step
click OK
- The setting is complete, click OK
select virtual machine
- Click Edit Virtual Machine Settings, the virtual machine needs to be powered off
- Modify the network adapter to a custom one
VMnet8