My Internal Network Setup and Configuration

Prologue

For example, I have following services running in my local network.

  • Git Server: Located at 192.168.1.100:80
  • Jellyfin Server: Located at 192.168.1.101:8000
  • NAS (Network Attached Storage): Located at 192.168.1.101:8010

Is there any good way to access them without typing ip address?

Yes. In this blog post, I'll walk you through how I set up my internal network.

Setting Up a Private DNS Server

The first step in our journey is to set up a private DNS server within our local network. For this, I chose AdGuardHome, which I deployed at 192.168.1.102.

With AdGuardHome, I was able to set up custom DNS resolutions. For instance:

  • server1.cuora resolves to 192.168.1.101
  • server2.cuora resolves to 192.168.1.100

However, if a service operates on a different port, we need to employ a reverse proxy, like nginx, to handle the traffic.

Setting Up a Reverse Proxy

I set up a proxy server at 192.168.1.103. This means that any requests to *.internal.cuora are directed to the proxy server at 192.168.1.103.

Screenshot_20230909_211036

Nginx Configuration

Here's a brief overview of my nginx setup:

  • For jellyfin.internal.cuora, traffic is directed to 192.168.1.101:8000
  • For git.internal.cuora, traffic is directed to 192.168.1.100:80
  • For nas.internal.cuora, traffic is directed to 192.168.1.101:8010

With this configuration, I can easily access all my internal services using domain names, making the entire process seamless and user-friendly.

Example Config

1
2
3
4
5
6
7
8
9
10
11
12
server {
listen 80;

server_name jellyfin.internal.cuora;

location / {
proxy_pass http://192.168.0.180:8030/;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Port $server_port;
}
}

don't forget to add a default nginx config

1
2
3
4
5
6
7
8
9
10
11
12
server {    
listen 80 default;
server_name _;

root /usr/share/nginx/html;

index index.html index.htm;

location / {
try_files $uri $uri/ =404;
}
}

Settup Router

This part is quite easy. In DHCP setting, just set default DNS server to our own private dns server 192.168.1.102.

Screenshot_20230909_212032

Network Structure

network_structure

Done!

Screenshot_20230909_212136