• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

cannot connect to server. only works with 127.0.0.1

Vapous

New Member
Joined
Jul 9, 2008
Messages
114
Reaction score
3
Location
England
I have seen many threads on fixing this but i tried it all and it still wont work.

All my ports are open i have checked this.
I can connect using 127.0.0.1 in config and ip changer
If i add my global ip in config my friend can connect but then i cant.
I have tried the hosts file adding my ipv4 and domain server

All of the above still didnt work. wondering if i did something wrong or its something simple. Read through all articles and 2 days of no results.

Note: i am using nostalrius 7.7

Really would appreciate any help. happy to screenshare on discord or whatever.

Cheers
 
Once you have added your global IP to the config.lua and your friend can connect - ensure that you are still trying to connect with 127.0.0.1 as before. You cannot connect to your own locally hosted server with the global IP address - you must always use the local address.

Hope it was as easy as that!
 
Once you have added your global IP to the config.lua and your friend can connect - ensure that you are still trying to connect with 127.0.0.1 as before. You cannot connect to your own locally hosted server with the global IP address - you must always use the local address.

Hope it was as easy as that!
Hey buddy thanks for the reply. no I'm afraid it's not that simple. I've tried many combo's using my ipv4 address and also my global and also 127.0.0.1

when he is online with my global ip in config.. no matter what ip i use i cant connect. Loads the character list but wont log in
 
Add to your host file C:\Windows\System32\drivers\etc\hosts

Make sure there is no # symbol on the line as that comments that line

yourexternalip localhost
yourexternalip 127.0.0.1

Where yourexternalip is your DNS/IP here

Need privileges so open as admin - restart server and client and try if this fixes it.

On config.lua you need to use your DNS/global IP and on client you connect as 127.0.0.1 while others out of your network as your DNS/Global IP
 
JUST FOR WINDOWS :cool:
@Vapous You just need to do these things and that's all:
  1. You must enable the ports in the windows firewall.
  2. You must enable the ports in your router's firewall according to your IPv4.
  3. You must see what is your PUBLIC IP (do not use the IPv4).
  4. Put the PUBLIC IP (it is numerical) in config.lua (to allow external persons to enter)
  5. Open the server and log in.
These would be the ip's you would use to login:
  • NUMERIC PUBLIC IP = To let the players in, and you can use it too.
  • IPv4 = Only people connected to your router will be able to log in with this IP.
  • 127.0.0.1 = The typical local ip, only you will be able to enter, it is the same as putting localhost in an ipchanger.

PD: Some companies have blocked the ports through the router, and to enable them you must make a call to the company. And if it is too much trouble, buy a VPS, it is much simpler because you just place the server and open it, besides it is more secure because you will not expose your information to the internet.
 
Add to your host file C:\Windows\System32\drivers\etc\hosts

Make sure there is no # symbol on the line as that comments that line

yourexternalip localhost
yourexternalip 127.0.0.1

Where yourexternalip is your DNS/IP here

Need privileges so open as admin - restart server and client and try if this fixes it.

On config.lua you need to use your DNS/global IP and on client you connect as 127.0.0.1 while others out of your network as your DNS/Global IP
i have done this but it does'nt work. i saw on a thread they did a team share and they fixed it because he saved the file as a .txt file by accident? how do i know if ive done this? when editing the hosts file when i hit save as what do i select as file type?
 
I think the following is happening:
  • Character list works because you have specified the local ip address to the client
  • Character list data received from server includes the global ip address from config.lua
  • When you try and connect to the game from character list, you are trying to connect with the global IP and so it fails

I don't remember this ever being an issue with the real tibia client so I am guessing you're using OTClient?
If the above assumptions are correct, then @BahamutxD's solution will probably work.
  • Open C:\Windows\System32\drivers\etc\hosts
  • Add a new line to the bottom with: yourexternalip 127.0.0.1 (replace yourexternalip as necessary)

Alternatively you can edit your otclient client_entergame module to force the local IP at login attempt

@Vapous you can DM me on Discord if you like
 
i have done this but it does'nt work. i saw on a thread they did a team share and they fixed it because he saved the file as a .txt file by accident? how do i know if ive done this? when editing the hosts file when i hit save as what do i select as file type?

Use notepad++ and just hit save.
 
Dont put ip copy the rsa and change ur client pem for ur engine
His issue has nothing to do with RSA.

How do I know this?
  • He can connect locally if the IP in config.lua is set to 127.0.0.1
  • His friend can connect remotely if the IP in config.lua is set to his global IP
  • He can reach his own character list in all circumstances

None of the above would be possible if the RSA between client & server was mismatched.
 
ok so just tried something weird!! SO if i put config to 127.0.0.1 and ip changer.. i can log in fine but my friend cant. So if i then log out but do not close tibia client and close down server change config ip to my global ip and start server again. we can BOTH LOG IN but if i close down tibia client i cant get back in again
 
thanks for this, the work around would be ok with me but his protocollogin.lua is different to mine.

here is mine..

Lua:
/**
 * Tibia GIMUD Server - a free and open-source MMORPG server emulator
 * Copyright (C) 2017  Alejandro Mujica <[email protected]>
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License along
 * with this program; if not, write to the Free Software Foundation, Inc.,
 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 */

#include "otpch.h"

#include "protocollogin.h"

#include "outputmessage.h"
#include "tasks.h"

#include "configmanager.h"
#include "iologindata.h"
#include "ban.h"
#include "game.h"

extern ConfigManager g_config;
extern Game g_game;

void ProtocolLogin::sendUpdateRequest()
{
    auto output = OutputMessagePool::getOutputMessage();

    output->addByte(0x1E);
    send(output);

    disconnect();
}

void ProtocolLogin::disconnectClient(const std::string& message)
{
    auto output = OutputMessagePool::getOutputMessage();

    output->addByte(0x0A);
    output->addString(message);
    send(output);

    disconnect();
}

void ProtocolLogin::getCharacterList(uint32_t accountNumber, const std::string& password)
{
    Account account;
    if (!IOLoginData::loginserverAuthentication(accountNumber, password, account)) {
        disconnectClient("Accountnumber or password is not correct.");
        return;
    }

    auto output = OutputMessagePool::getOutputMessage();

    //Update premium days
    Game::updatePremium(account);

    const std::string& motd = g_config.getString(ConfigManager::MOTD);
    if (!motd.empty()) {
        //Add MOTD
        output->addByte(0x14);

        std::ostringstream ss;
        ss << g_game.getMotdNum() << "\n" << motd;
        output->addString(ss.str());
    }

    //Add char list
    output->addByte(0x64);

    uint8_t size = std::min<size_t>(std::numeric_limits<uint8_t>::max(), account.characters.size());
    output->addByte(size);
    for (uint8_t i = 0; i < size; i++) {
        output->addString(account.characters[i]);
        output->addString(g_config.getString(ConfigManager::SERVER_NAME));
        output->add<uint32_t>(inet_addr(g_config.getString(ConfigManager::IP).c_str()));
        output->add<uint16_t>(g_config.getNumber(ConfigManager::GAME_PORT));
    }

    //Add premium days
    if (g_config.getBoolean(ConfigManager::FREE_PREMIUM)) {
        output->add<uint16_t>(0xFFFF);
    } else {
        output->add<uint16_t>(account.premiumDays);
    }

    send(output);

    disconnect();
}

void ProtocolLogin::onRecvFirstMessage(NetworkMessage& msg)
{
    if (g_game.getGameState() == GAME_STATE_SHUTDOWN) {
        disconnect();
        return;
    }

    msg.skipBytes(2); // client OS

    /*uint16_t version =*/ msg.get<uint16_t>();
    msg.skipBytes(12);

    /*
     * Skipped bytes:
     * 4 bytes: protocolVersion
     * 12 bytes: dat, spr, pic signatures (4 bytes each)
     */

    if (!Protocol::RSA_decrypt(msg)) {
        disconnect();
        return;
    }

    uint32_t key[4];
    key[0] = msg.get<uint32_t>();
    key[1] = msg.get<uint32_t>();
    key[2] = msg.get<uint32_t>();
    key[3] = msg.get<uint32_t>();
    enableXTEAEncryption();
    setXTEAKey(key);

    /*if (version < CLIENT_VERSION_MIN || version > CLIENT_VERSION_MAX) {
        //sendUpdateRequest();
        disconnectClient("Use Tibia 7.72 to login!");
        return;
    }*/

    if (g_game.getGameState() == GAME_STATE_STARTUP) {
        disconnectClient("Gameworld is starting up. Please wait.");
        return;
    }

    if (g_game.getGameState() == GAME_STATE_MAINTAIN) {
        disconnectClient("Gameworld is under maintenance.\nPlease re-connect in a while.");
        return;
    }

    BanInfo banInfo;
    auto connection = getConnection();
    if (!connection) {
        return;
    }

    if (IOBan::isIpBanned(connection->getIP(), banInfo)) {
        if (banInfo.reason.empty()) {
            banInfo.reason = "(none)";
        }

        std::ostringstream ss;
        ss << "Your IP has been banned until " << formatDateShort(banInfo.expiresAt) << " by " << banInfo.bannedBy << ".\n\nReason specified:\n" << banInfo.reason;
        disconnectClient(ss.str());
        return;
    }

    uint32_t accountNumber = msg.get<uint32_t>();
    if (!accountNumber) {
        disconnectClient("Invalid account number.");
        return;
    }

    std::string password = msg.getString();
    if (password.empty()) {
        disconnectClient("Invalid password.");
        return;
    }

    auto thisPtr = std::static_pointer_cast<ProtocolLogin>(shared_from_this());
    g_dispatcher.addTask(createTask(std::bind(&ProtocolLogin::getCharacterList, thisPtr, accountNumber, password)));
}
 
  • Download OTCv8
  • Unzip it
  • Navigate into the data directory and create a new directory in there called things
  • Inside the things directory, create a new directory called 772
  • Inside the 772 directory, paste your tibia.dat & tibia.spr file from the real tibia client
  • Open the init.lua file in the main client directory
  • Remove all the commented-out data inside the Servers table
  • Inside the Servers table, paste the following: localserver = "127.0.0.1:7171:772"
  • It should now look like this:
Code:
Servers = {
  localserver = "127.0.0.1:7171:772"
}
  • Also in the init.lua file, change ALLOW_CUSTOM_SERVERS to false
  • Now you can go ahead and make the changes specified in Xikini's post
  • Once all of the above is complete, you should be able to run the client and log in locally
 
  • Download OTCv8
  • Unzip it
  • Navigate into the data directory and create a new directory in there called things
  • Inside the things directory, create a new directory called 772
  • Inside the 772 directory, paste your tibia.dat & tibia.spr file from the real tibia client
  • Open the init.lua file in the main client directory
  • Remove all the commented-out data inside the Servers table
  • Inside the Servers table, paste the following: localserver = "127.0.0.1:7171:772"
  • It should now look like this:
Code:
Servers = {
  localserver = "127.0.0.1:7171:772"
}
  • Also in the init.lua file, change ALLOW_CUSTOM_SERVERS to false
  • Now you can go ahead and make the changes specified in Xikini's post
  • Once all of the above is complete, you should be able to run the client and log in locally

Special thanks to michael and manigold. This is not ideal but its a work around that i can deal with. i followed michaels guide and now im using otclient with the modifications.

Thanks everyone.
 
Back
Top