Public network access LAN network setup Tutorial
本文最后更新于:2024年8月9日 晚上
Why I write this article ?
Because I have some test environment or Applications running on my Home server, the problem is when I leave the LAN
net work, everything become unaccessible. That’s a very big problem and here’s a solution to solve this problem.
Network topology
home.msft.vip——>192.168.3.200 ????
DDNS on R2S(optional)
NOTE
if you have an
static public IP address
fromnetwork provider
just skip this step and add aA record
withIP address and domain
.For my own scenario, I don’t have
static public IP address
fromChina Unicom
,the Public address changes time to time,DDNS is for this case, it will updatechanged IP and A record with domain
on Tencent Cloud.
https://github.com/Tencent-Cloud-Plugins/tencentcloud-openwrt-plugin-ddns
Install Tencent ddns plugin on openwrt
1 |
|
Configure Tencent ddns plugin
make sure r2s
WAN
portal usePPPoe
access token create :https://console.dnspod.cn/account/token/token
make sure you have your own domain : https://console.dnspod.cn/dns/list
Configure :
After about steps, you should have a domain which point to your public IP from network provider.
Configure network port forwards (DMZ)
All network traffics from your domain with forward to 192.168.4.5
. For most cases, that’s it. BUT 192.168.4.5
actually is my router , so I have to set another port forward on my router .
Network port forwards (DMZ) on R2S
1 |
|
Or use web UI:
Now all network traffic from Public domain will been forwarded to router, last thing we have to do is configure another port forward to the real my real server.
Configure port forward on router(Xiaomi)
Fanal work and validate
1 |
|
Improvement
As you can see there are some limits when use Tencent DDNS Plugin
: only can update one sub domain each time.
ddns-go Plugin
could fix this problem and could update multiple domains one time , let’s get started:
Install ddns-go
(any server is fine)
https://github.com/jeessy2/ddns-go/releases
1 |
|
Go to webUI to configure
Note
How we got IP addr, I try to update same ip from r2s
server which have installed Tencent ddns
and use command
to get it. For different devices and different network, you have to test the command meet your own requires. below is my output which is correct.
1 |
|
After all setting update complete then don’t forget to save your changes. Wait a few seconds, then check the logs:
1 |
|