6

Recently, I have been encountering an unusual problem with a testing TF2 server that I'm running on my local system. Namely, my client is completely unable to connect to the server. It does not appear on the LAN tab, and connecting it through connect localhost:27015 does absolutely nothing but time out.

The server is set up through srcds, with the following startup shell script:

#!/bin/sh
tf2/srcds_run -console \
    -game tf \
    -nohltv \
    +randommap \
    +maxplayers 24

The config file of the server is as follows:

hostname "Local_Dev_Server"
sv_contact "[email protected]"
sv_pausable 1
sv_stats 0
sv_region 1
fps_max 600
sv_allowupload 1
sv_allowdownload 1

The server is (obviously) running on my local computer, primarily for development purposes. The server itself is running on Ubuntu 16.04 LTS, and is starting up normally. The console reports no strange errors other than the usual SRCDS warnings and/or irrelevant mod errors.

The server itself binds to port 27015:

Network: IP 127.0.1.1, mode MP, dedicated Yes, ports 27015 SV / 27005 CL

Attempts to connect directly (with the connect 127.0.1.1:27015 command) return this in the console:

] connect 127.0.1.1:27015
WARNING: Port 27015 was unavailable - bound to port 27016 instead
WARNING: Port 27005 was unavailable - bound to port 27006 instead
Network: IP 127.0.1.1, mode MP, dedicated No, ports 27016 SV / 27006 CL
m_face->glyph->bitmap.width is 0 for ch:32 TF2
m_face->glyph->bitmap.width is 0 for ch:32 TF2
m_face->glyph->bitmap.width is 0 for ch:32 Verdana
Connecting to 127.0.1.1:27015...
Retrying 127.0.1.1:27015...
Retrying 127.0.1.1:27015...
Retrying 127.0.1.1:27015...
Connection failed after 4 retries.

No entry shows in the server logs. netstat -tulpn | grep 27015 returns the following, showing the server is running and bound to the port:

tcp   0   0   127.0.1.1:27015   0.0.0.0:*  LISTEN  26665/srcds_linux
udp   0   0   0.0.0.0:27015     0.0.0.0:*          26665/srcds_linux

My system's firewall is blocking connections from the world (as this is only a local development server), but connections to/from the 127.0.0.0/8 subnet are all globally permitted. Similarly, debug utilities like netcat and telnet are able to connect to these ports, showing that they are in fact bound and accessible locally.

I've confirmed that this problem happens with both sv_lan 0 and sv_lan 1.

What am I doing wrong?

11
  • Try sv_lan 1? It shouldn't be necessary afair, but it might help.
    – user140963
    Commented May 18, 2017 at 17:47
  • @Riker I'll give sv_lan 1 a shot after work, though I seem to remember it causing my server to crash on map switch.
    – Kaz Wolfe
    Commented May 18, 2017 at 17:48
  • Huh, never done that for me.
    – user140963
    Commented May 18, 2017 at 17:49
  • 2
    I can't help but notice that the server says it's binding to port 27016 because 27015 is currently unavailable.
    – Powerlord
    Commented May 18, 2017 at 18:11
  • 1
    Oh, I think I see the problem: Try connecting to 192.x.x.x instead of 172.y.y.y. (where 192.x.x.x is your internal IP).
    – user140963
    Commented May 20, 2017 at 15:30

2 Answers 2

1

AIUI the client needs to listen on some port (usually 27015) on the loopback interface (why, I don't know). When you try to put the server on that same port, the client ends up moving to a different port, and for some reason, the two of them get confused. I run my server on my LAN IP, and then use iptables to control access. When working with closed-source software, it's usually easiest to manage security elsewhere :)

-3

A localhost address looks like this: 192.168.*.*

Press your Windows Key + R to open run and open up cmd.

type ipconfig /all and look for your ipv4 address.

Once you've got that use ~ to open console and use

connect 192.168.*.*

With the * being the numbers cmd showed. It shouldn't be necessary to assign a port.

5
  • zsh: command not found: ipconfig.
    – Kaz Wolfe
    Commented Jun 22, 2017 at 17:02
  • 1
    localhost is actually 127.0.0.1.
    – aytimothy
    Commented Jul 5, 2017 at 13:08
  • 1
    @KazWolfe use $ ifconfig -a if you are using linux to find ipv4
    – David Born
    Commented Jul 7, 2017 at 10:24
  • Local IP: 10.137.42.29. If I connect to that, it works. However, this still does not explain why my system can not connect to localhost (loopback) IPs, or show the server in the LAN list. While this works, it's still a massive pain to have to look this up every time I want to work on the server, especially as my network has a very low DHCP expiry threshold.
    – Kaz Wolfe
    Commented Jul 7, 2017 at 14:53
  • maybe you have bound a dynamic ip for your system to your router. see if you can set your local ip to be static
    – David Born
    Commented Jul 17, 2017 at 8:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.