Server is not Reachable/Visible

I have some Problems with Netcode and Serverbuild

I build the Server Project and Put in on a Server. All Port and Adresses are open and fine. But if i start the applikation the Server does not Listen to the Port. I hardcoded the Ip but nothink works

Unity Version : 2022.3.27f1
Netcode for GameObjects Version: 1.9.1

In local Network all works fine. Server Starts and Client Connect. But not on Internet

Servercode

 #region #####PROPERTYS#####
private string IpAdress { get; set; } ;
private ushort Port { get; set; } = 27012;
private string ListenAdress { get; set; } = "0.0.0.0";

#endregion #####PROPERTYS#####

#region #####CONSTRUCTOR#####
#endregion #####CONSTRUCTOR#####

#region #####UNITY#####

//private void OnEnable()
//{
//    UnityTransport transport = gameObject.GetComponent<UnityTransport>();
//    transport.SetConnectionData(IpAdress, Port, ListenAdress);
//    NetworkConfig.NetworkTransport = transport;

//    OnServerStarted += ServerManager_OnServerStarted;
//    OnClientConnectedCallback += ServerManager_OnClientConnectedCallback;
//    OnClientDisconnectCallback += ServerManager_OnClientDisconnectCallback;

//    StartServer();
//}

// Start is called before the first frame update
void Start()
{
     IpAdress = GetLocalIPAddress();

     UnityTransport transport = gameObject.GetComponent<UnityTransport>();
     transport.SetConnectionData(IpAdress, Port, ListenAdress);
     NetworkConfig.NetworkTransport = transport;

     OnServerStarted += ServerManager_OnServerStarted;
     OnClientConnectedCallback += ServerManager_OnClientConnectedCallback;
     OnClientDisconnectCallback += ServerManager_OnClientDisconnectCallback;

     StartServer();
}

// Update is called once per frame
void Update()
{
     if (Console.ReadLine() == "Exit")
     {
         Debug.Log("Server gestoppt");
         Application.Quit();
     }
}

#endregion #####UNITY#####

#region #####FUNKTIONS#####

private void ServerManager_OnClientDisconnectCallback(ulong obj)
{
     Console.WriteLine("Client Disconnectet");
     //Debug.Log("Client Disconnectet");
}

private void ServerManager_OnClientConnectedCallback(ulong obj)
{
     Console.WriteLine("Client Connectet");
     //Debug.Log("Client Connectet");
}

private void ServerManager_OnServerStarted()
{
     Console.WriteLine("Server listening for any Actions");
     //Debug.Log("Server listening for any Actions");
}

public string GetLocalIPAddress()
{
     using (Socket socket = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, 0))
     {
         socket.Connect("8.8.8.8", Port);
         IPEndPoint endPoint = socket.LocalEndPoint as IPEndPoint;
         Console.WriteLine("Endpoint : " + endPoint.Address.ToString());
         return endPoint.Address.ToString();
     }
}

#endregion #####FUNKTIONS#####

What did i wrong ?

probably because your local Ip is say 10.x.x.x or 172.x.x.x and those are not routable on the internet…

so my IP could be 10.10.10.1 and this gives you nothing, but its the only IP my pc knows.

In the Ip Adress i Put in the ServerIP Adress but nothing happend

what exactly is not connecting? I dont see why google dns servers would be listening on port 27012, which is what 8.8.8.8 is… so…

Either way your code returned a local IP not an internet IP, so, tbh you can listen all you like but the IP you give out has to be that of the router which must know to forward it on… OR you use a relay in which case you dont need any of that shenanigans

I think that was my misstake. I search for result to fix it and the 8.8.8.8 is a misstake.

public class ServerManager : NetworkManager
{
    #region #####PROPERTYS#####
    private string IpAdress { get; set; }
    private ushort Port { get; set; } = 27012;
    private string ListenAdress { get; set; } = "0.0.0.0";

    #endregion #####PROPERTYS#####

    #region #####CONSTRUCTOR#####
    #endregion #####CONSTRUCTOR#####

    #region #####UNITY#####

    //private void OnEnable()
    //{
    //    UnityTransport transport = gameObject.GetComponent<UnityTransport>();
    //    transport.SetConnectionData(IpAdress, Port, ListenAdress);
    //    NetworkConfig.NetworkTransport = transport;

    //    OnServerStarted += ServerManager_OnServerStarted;
    //    OnClientConnectedCallback += ServerManager_OnClientConnectedCallback;
    //    OnClientDisconnectCallback += ServerManager_OnClientDisconnectCallback;

    //    StartServer();
    //}

    // Start is called before the first frame update
    void Start()
    {
        IpAdress = "0.0.0.0";//GetLocalIPAddress();

        UnityTransport transport = gameObject.GetComponent<UnityTransport>();
        transport.SetConnectionData(IpAdress, Port,ListenAdress);
        NetworkConfig.NetworkTransport = transport;

        OnServerStarted += ServerManager_OnServerStarted;
        OnClientConnectedCallback += ServerManager_OnClientConnectedCallback;
        OnClientDisconnectCallback += ServerManager_OnClientDisconnectCallback;

        StartServer();
    }

    // Update is called once per frame
    void Update()
    {
        if (Console.ReadLine() == "Exit")
        {
            Debug.Log("Server gestoppt");
            Application.Quit();
        }
    }

    #endregion #####UNITY#####

    #region #####FUNKTIONS#####

    private void ServerManager_OnClientDisconnectCallback(ulong obj)
    {
        Console.WriteLine("Client Disconnectet");
        //Debug.Log("Client Disconnectet");
    }

    private void ServerManager_OnClientConnectedCallback(ulong obj)
    {
        Console.WriteLine("Client Connectet");
        //Debug.Log("Client Connectet");
    }

    private void ServerManager_OnServerStarted()
    {
        Console.WriteLine("Server listening for any Actions");
        //Debug.Log("Server listening for any Actions");
    }

    //public string GetLocalIPAddress()
    //{
    //    using (Socket socket = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, 0))
    //    {
    //        socket.Connect("212.227.189.98", Port);
    //        IPEndPoint endPoint = socket.LocalEndPoint as IPEndPoint;
    //        Console.WriteLine("Endpoint : " + endPoint.Address.ToString());
    //        return endPoint.Address.ToString();
    //    }
    //}

    #endregion #####FUNKTIONS#####
}

i chaged my code but the Server is not Listen to his adress and port.
I dont kow how to fix it.
I have an Public Ip Adress and Port on the Server. But i dont know what i must parse in the connection Parameter so that the Server is Visible in Linux View where i can see which ports are listen.
Where the ip adress 0.0.0.0 is , there i put my server adress in

so stop just pasting other peoples code and understand the code you have

0.0.0.0 listens on all the ports the server has - that isnt necessarily wrong… what is more than likely wrong is either the assumption that that port can be got to from the internet, that there are no firewalls, or the IP you are entering on the clients is non routable (see above) …

Welcome to basic networking

After doing a lot of reading and getting help from network technician friends, it has now worked. There were several errors in the configuration of the server. After everything was fixed, a client was able to connect for the first time. I am relieved