1. User switching command. The current ordinary user logs in. If you want to switch to the root user, you need to enter the command # su; if you want to switch from the root user to the ordinary user, you only need to enter the command #su username, below All configurations are performed under the root user, so the command does not add sudo to increase the authority.
2. To view the network configuration, use the command # ip addr, through this command you can see the network card information (name: enp0s3) , When we need to set a fixed IP for the system, we need to open the corresponding configuration file according to the network card name
3. Use vim to edit the corresponding network card configuration file, # vi /etc/sysconfig/network-scripts/ifcfg- enp0s3, edit the relevant information according to the specific network environment (notes are added to the fields that need to be edited, and the configured value can be without double quotation marks)
TYPE="Ethernet"PROXY_METHOD="none"BROWSER_ONLY= "no"BOOTPROTO="static" # Use static IP address, the default is dhcpIPADDR="192.168.241.100" # Set static IP address NETMASK="255.255.255.0" # Subnet mask GATEWAY="192.168.241.2" # Gateway Address DNS1="192.168.241.2" # DNS server 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="95b614cd-79b0-4755-b08d-99f1cca7271b"DEVICE="ens33"ONBOOT="yes" #Whether the boot is enabled
After the configuration is completed, enter the command # reboot to reboot, and then use Check whether you can surf the Internet normally with the ping command: # ping -c 4 www.baidu.com, we are more accustomed to using the ifconfig command to view network information, if this command is not available, please install it through the command # yum install net-tools
4. After the server configuration is complete, you need to provide ssh remote access. SSH is the abbreviation of Secure Shell, formulated by the IETF’s Network Working Group; SSH is a security protocol based on the application layer and the transport layer. SSH is currently a more reliable protocol designed to provide security for remote login sessions and other network services.
The first step
#Check whether the SSH software package is installed on this machine[[emailprotected] ~]# rpm -qa | grep sshopenssh-server-6.6. 1p1-12.el7_1.x86_64openssh-clients-6.6.1p1-12.el7_1.x86_64libssh2-1.4.3-8.el7.x86_64openssh-6.6.1p1-12.el7_1.x86_64#If not, you need to install [[emailprotected ] /]# yum install openssh-server
The second step
#Open SSH service[[emailprotected] ~]# service sshd startRedirecting to /bin/ systemctl start sshd.service#Check if TCP port 22 is open [[emailprotected] ~]# netstat -ntpl | grep 22tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 17816/sshd tcp6 0 0 :::22: ::* LISTEN 17816/sshd
CentOS opens port 22 by default. If it is not opened, you can manually add it to the firewall. # firewall-cmd –zone-public –add-port 22/tcp- -permanent, the firewall needs to be restarted after entering this command # service firewalld restart
The third step
Then you can use the terminal to log in to the remote host
< p>