470,632 Members | 1,441 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,632 developers. It's quick & easy.

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
Expand|Select|Wrap|Line Numbers
  1. - sudo apt update
  2. - sudo apt upgrade
  3. - sudo apt install nano 
  4. - sudo apt install net-tools
  5. - sudo apt install screen
  6. - sudo apt install unzip
4) Enable root login over SSH using
Expand|Select|Wrap|Line Numbers
  1. - nano /etc/ssh/sshd_config
  2. - 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
Expand|Select|Wrap|Line Numbers
  1. - su postgres
  2. - Then write: psql ALTER ROLE postgres WITH SUPERUSER INHERIT CREATEROLE CREATEDB LOGIN REPLICATION BYPASSRLS PASSWORD 'test';
2) Allow the login from external
Expand|Select|Wrap|Line Numbers
  1. - cd /etc/postgresql/12/main
  2. - Then: sudo su
  3. - Then: nano pg_hba.conf
  4. - Change this: host   all   all   127.0.0.1/32   md5
  5. - To this: host   all   all   0.0.0.0/0   md5
  6.  
3) Update postgresql.conf
Expand|Select|Wrap|Line Numbers
  1. - nano postgresql.conf
  2. - Change this: #listen_addresses = 'localhost'  # what IP address(es) to listen on;
  3. - 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
Expand|Select|Wrap|Line Numbers
  1. - su postgres
  2. - Copy your database.out to the VM in the folder /home
2) Then:
Expand|Select|Wrap|Line Numbers
  1. - psql -f database.out
  2. - Copy your worlds.sql to the VM in the folder /home
3) Edit the worlds.sql following your local IP
Expand|Select|Wrap|Line Numbers
  1. - INSERT INTO "public"."worlds" VALUES (1010, 'CHANNEL_NAME', 'YOUR_IP', 5712, 0, 150, 1, '002.003.05.67', 1, 0, 1, 100);
4) Then:
Expand|Select|Wrap|Line Numbers
  1. - psql -d fnaccount  -f worlds.sql
  2. - Copy your serverstatus.sql to the VM in the folder /home
5) Update serverstatus.sql following your IP
Expand|Select|Wrap|Line Numbers
  1. - INSERT INTO "public"."serverstatus" VALUES (1010, 'WorldServer', 'YOUR_IP', 5712, '127.0.0.1', 5712, 0);
  2. INSERT INTO "public"."serverstatus" VALUES (1011, 'ZoneServer', 'YOUR_IP', 10166, '127.0.0.1', 10166, 0);
  3. INSERT INTO "public"."serverstatus" VALUES (-2, 'MissionServer', 'none', -1, '127.0.0.1', 7654, 1628266391);
6) Then:
- psql -d fndb1 -f serverstatus.sql

Step 4 : Launch the server
Expand|Select|Wrap|Line Numbers
  1. - Copy paste server folder in /home of your VM
  2. - sudo su
  3. - sudo chmod 777 /home/server -R **
  4. - Change all password database in files
  5. - Start the server with: ./start
2 Weeks Ago #1
2 9518
dev7060
569 Expert 512MB
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.
https://docs.oracle.com/en/virtualiz...twork_nat.html

Might be useful to you.
1 Week Ago #2
cactusdata
199 Expert 128KB
Use the subnet:

Expand|Select|Wrap|Line Numbers
  1. 255.255.0.0
1 Week Ago #3

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

7 posts views Thread by ajikoe | last post: by
7 posts views Thread by Cyphos | last post: by
3 posts views Thread by privateson | last post: by
2 posts views Thread by jephperro | last post: by
1 post views Thread by jwgoerlich | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.