I'm trying to setup a dedicated server for Rust (a game) on an AWS EC2 VPC instance running Ubuntu 14.04 64-bit. Following the instructions, I got the application started and listening on its default ports (UDP 28105, TCP 28106.)
netstat -tulpn
shows:
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:28016 0.0.0.0:* LISTEN 7370/RustDedicated
udp 0 0 0.0.0.0:28015 0.0.0.0:* 7370/RustDedicated
udp 0 0 0.0.0.0:4209 0.0.0.0:* 7370/RustDedicated
That seems to look okay, but trying to connect to it with the game client and remote console (RCON) yielded a connection refused. I suspected it might be a typical firewall/security group issue, so just for testing purposes, I exposed instance's security group to all ports. Still no dice.
Instead, I decided to see if I could at least connect to it locally, from an SSH session on the same box the application is running.
I ran telnet 127.0.0.1 28106
which yielded:
Trying 127.0.0.1...
telnet: Unable to connect to remote host: Connection refused
How can my application be listening on this port, but still refuse connections from its loopback address? As you can see, it's bound to 0.0.0.0
.
How can configure this so it won't throw "Connection refused"?
EDIT
sudo iptables -L
shows:
Chain INPUT (policy ACCEPT)
target prot opt source destination
Chain FORWARD (policy ACCEPT)
target prot opt source destination
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
Then I updated it with settings that should allow connections through:
Chain INPUT (policy ACCEPT)
target prot opt source destination
ACCEPT tcp -- anywhere anywhere tcp dpt:28016 flags:FIN,SYN,RST,ACK/SYN
ACCEPT udp -- anywhere anywhere udp dpt:28015
ACCEPT tcp -- anywhere anywhere tcp dpt:28015 flags:FIN,SYN,RST,ACK/SYN
Chain FORWARD (policy ACCEPT)
target prot opt source destination
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
In your netstat you are showing ports 28016 TCP instead of 28106, and UDP 28015 instead of 28105.
Also in your telnet you are not trying to connect to the open port (28016 TCP) but to the port that you think it is open (28106 TCP).