(Optional) Changing the SSH Port
For security and management purposes, you need to change the default port 22 of the SSH service.
- Change the default SSH port.
- Open the SSH configuration file.
vi /etc/ssh/sshd_config
- Press i to enter the insert mode and change the value of Port (8700 is used as an example).
Port 8700

- Press Esc to exit the insert mode. Type :wq! and press Enter to save and exit the file.
- Open the SSH configuration file.
- In the SELinux environment, allow the SSH service to use the specified port 8700.
semanage port -a -t ssh_port_t -p tcp 8700
If the system displays a message indicating that the semanage command is not installed, run the following command to install it:
yum provides semanage

dnf install policycoreutils-python-utils-3.3-8.oe2203sp3.noarch
- Enable port 8700 on the firewall.
firewall-cmd --zone=public --add-port=8700/tcp –-permanent firewall-cmd --reload
- Restart the SSH service.
systemctl restart sshd
- Verify the SSH port.After the port is changed, the original default port 22 cannot be connected using ssh. You must use the -p option in ssh to specify the new port (8700) for connection.
ssh 192.168.20.150

ssh -p 8700 192.168.20.150

Parent topic: Configuring the VM Network