host localhost with a port will be forwarded to guest ip + port
https://linuxconfig.org/how-to-open-ssh-port-22-on-rehdat-7-linux-server
The SSH protocol operates on port 22 by default. In order to accept incoming connections on your Red Hat 7 Linux SSH server, you will need to ensure that port 22 is allowed through the firewall. This will involve opening the port in firewalld, the default firewall interface for Red Hat.
In this tutorial, you will learn how to open SSH port 22 on Red Hat Enterprise Linux version 7. The only prerequisite is that you must already have SSH installed.
In this tutorial you will learn:
Category | Requirements, Conventions or Software Version Used |
---|---|
System | Red Hat 7 Linux |
Software | OpenSSH |
Other | Privileged access to your Linux system as root or via the sudo command. |
Conventions | # – requires given linux commands to be executed with root privileges either directly as a root user or by use of sudo command$ – requires given linux commands to be executed as a regular non-privileged user |
# firewall-cmd --zone=public --permanent --add-service=ssh
# firewall-cmd --reload
# firewall-cmd --list-all
Alternatively check the iptables
rules directly:
# iptables-save | grep dport\ 22
# firewall-cmd --zone=public --remove-service=ssh --permanent # firewall-cmd --reload
https://linuxconfig.org/how-to-open-http-port-80-on-redhat-7-linux-using-firewall-cmd
# firewall-cmd --zone=public --add-port=80/tcp --permanent
# firewall-cmd --reload
# iptables-save | grep 80 -A IN_public_allow -p tcp -m tcp --dport 80 -m conntrack --ctstate NEW -j ACCEPT
firewall-cmd
command:# iptables-save | grep 80 -A IN_public_allow -p tcp -m tcp --dport 80 -m conntrack --ctstate NEW -j ACCEPT # firewall-cmd --zone=public --remove-port=80/tcp --permanent success # firewall-cmd --reload success # iptables-save | grep 80