Every time I try to start the server with my public IP I get the error:
[03:01:00] [Server thread/WARN]: The exception was: io.netty.channel.unix.Errors$NativeIoException: bind(…) failed: Cannot assign requested address
I’ve tried different ports but still doesn’t work.
It looks like your server is not able to start up due to theIP adress you put in the server setting, since it can’t find the address as an adress belonging to any of its network interfaces. I reccomend just using the default “0.0.0.0” there, since the minecraft server will listen to all network interfaces available.
I tried what you’ve suggested and it seems I still can only connect from my local IP and not my public IP.
Could the fact that I am running it on a VM be an issue?
This is a port forwarding issue, then. Being able to connect to your server locally is all you should expect to be able to do from your local network.
In some rarer cases, people’s routers will let them use their public IP to reach their locally-located server, but even in such cases, port-forwarding needs to be configured.