Pool Stake operator course: unable to connect pool node to relay node 2 servers same public ip

I am trying to connect my pool node to the relay node but its not possible. Pool node and relay node are in different servers but with the same public ip and they are running in different ports. I ve opened with ufw both ports in both servers, and I ve config the topology files with the public ip. I ve also tried with
How should I run the nodes (with or public IP), how should I config topology file (with publi ip or other?) and should I opened or do anything else with the firewall config?
Many thanks for you help in advance