An SSH client can log in successfully with no port specified only when the server is monitoring port 22. If the server is monitoring another port, the port number must be specified upon login.
The ssh ipv4 server port command changes the IPv4 port number that an SSH server monitors.The ssh ipv6 server port command changes the IPv6 port number that an SSH server monitors.
After the monitoring port number is changed, all connections are disconnected and the server starts to monitor new port numbers.