How to connect to a specific server that has 192.168.0.X IP

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • abobo78
    New Member
    • May 2022
    • 1

    How to connect to a specific server that has 192.168.0.X IP

    Hello everyone
    I'm following a simple guide on the internet about how to create a local server for a specific game on a virtual machine
    I did all the steps without problems, but when I test, I can't connect to the server
    Someone told me it's happening because my virtual machine IP is 192.168.0.X and it should be 192.168.1.X
    I tried to set a static IP, but this didn't work
    My question is: How do I make it work using 192.168.0.X IP?
    Thanks in advance.

    This is the guide I'm following:
    Step 1 : Create the linux and prepare it
    1) Create Virtual machine on Virtual box with this setup
    - core : 2
    - ram : 4 gb
    - disk space : 50Gb

    2) Install Ubuntu 20.04.4
    - You must install SSH

    3) Execute the following commands
    Code:
    - sudo apt update
    - sudo apt upgrade
    - sudo apt install nano 
    - sudo apt install net-tools
    - sudo apt install screen
    - sudo apt install unzip
    4) Enable root login over SSH using
    Code:
    - nano /etc/ssh/sshd_config
    - Change or add line: PermitRootLogin yes
    5) Then restart SSH service
    - service ssh restart

    6) Then setup database
    - sudo apt install postgresql

    Step 2 : Setup the postgres database
    1) Change your user to postgres
    Code:
    - su postgres
    - Then write: psql ALTER ROLE postgres WITH SUPERUSER INHERIT CREATEROLE CREATEDB LOGIN REPLICATION BYPASSRLS PASSWORD 'test';
    2) Allow the login from external
    Code:
    - cd /etc/postgresql/12/main
    - Then: sudo su
    - Then: nano pg_hba.conf
    - Change this: host   all   all   127.0.0.1/32   md5
    - To this: host   all   all   0.0.0.0/0   md5
    3) Update postgresql.conf
    Code:
    - nano postgresql.conf
    - Change this: #listen_addresses = 'localhost'  # what IP address(es) to listen on;
    - To this: listen_addresses = '*'  # what IP address(es) to listen on;
    4) Restart postgres
    - service postgres restart

    Step 3 : Setup the database
    1) Change to postgres user
    Code:
    - su postgres
    - Copy your database.out to the VM in the folder /home
    2) Then:
    Code:
    - psql -f database.out
    - Copy your worlds.sql to the VM in the folder /home
    3) Edit the worlds.sql following your local IP
    Code:
    - INSERT INTO "public"."worlds" VALUES (1010, 'CHANNEL_NAME', 'YOUR_IP', 5712, 0, 150, 1, '002.003.05.67', 1, 0, 1, 100);
    4) Then:
    Code:
    - psql -d fnaccount  -f worlds.sql
    - Copy your serverstatus.sql to the VM in the folder /home
    5) Update serverstatus.sq l following your IP
    Code:
    - INSERT INTO "public"."serverstatus" VALUES (1010, 'WorldServer', 'YOUR_IP', 5712, '127.0.0.1', 5712, 0);
    INSERT INTO "public"."serverstatus" VALUES (1011, 'ZoneServer', 'YOUR_IP', 10166, '127.0.0.1', 10166, 0);
    INSERT INTO "public"."serverstatus" VALUES (-2, 'MissionServer', 'none', -1, '127.0.0.1', 7654, 1628266391);
    6) Then:
    - psql -d fndb1 -f serverstatus.sq l

    Step 4 : Launch the server
    Code:
    - Copy paste server folder in /home of your VM
    - sudo su
    - sudo chmod 777 /home/server -R **
    - Change all password database in files
    - Start the server with: ./start
    Last edited by zmbd; May 8 '22, 10:43 PM.
  • dev7060
    Recognized Expert Contributor
    • Mar 2017
    • 656

    #2
    How and from where are you trying to connect?

    Why does it have to be 192.168.0.X? How do you know if it hasn't been already allocated/assigned/in use?

    Step 4 : Launch the server
    Does it say something like server is up and running and says any IP/port number?

    Not this use case specifically (Postgres server). Long ago, I used NAT (Metasploitable or Kali VM, if I remember correctly) to set up a lab.

    The disadvantage of NAT mode is that, much like a private network behind a router, the virtual machine is invisible and unreachable from the outside internet. You cannot run a server this way unless you set up port forwarding.


    Might be useful to you.

    Comment

    • cactusdata
      Recognized Expert New Member
      • Aug 2007
      • 223

      #3
      Use the subnet:

      Code:
      255.255.0.0

      Comment

      Working...