How to prevent client from going to internet when server is local

I have set up a home Seafile server on Ubuntu Server 16.04 and most everything works fine, except… Every time I try to interact with the server using the Windows client while on the same local server it seems to be going through the internet instead of directly communicating with the local ip of the server. The server is set up with ddclient to keep my personal domain pointed to it, and the client is using that domain to easily connect to the server. While it works, I believe it is going much slower than it should because it is going to the internet and back instead of going straight to the server and back within the local network (and also eating through the data cap from my ISP in the process). I don’t know how to accurately test this to see what is actually happening, I am just assuming I have something set wrong.

I am now setting up a new server that I want to migrate my seafile server to, and am now taking the opportunity to set this up better this time around. With that being said, how do I properly set up the server such that it will:
a) have the dynamic dns to easily connect to
b) skip going to the internet and back when on the same local internet as the server?

I know this may be more complicated than simply tweaking settings for the Seafile server or client, but I can’t seem to find the answer elsewhere.

Please help educate the noob that I am, that I may rise above this…

1 Like

You need a local resolver, so it resolves to the internal IP

Does your server use SSL too?

@fr500 Thank you for the info. However, I don’t quite understand what you mean by a local resolver. Is that something I set up on my local router?

I haven’t set that up, no. Is that something I should look into?

No, it’s simpler the way you have it.

Have you considered using the hosts file to redirect your connection? You can find info on the Windows version and some likely tools here.

A more general solution is along the lines of a local DNS server as @fr500 suggests.

1 Like

Thanks. I will take a look at those options to see if I can resolve the issue.

a local resolver means an internal DNS server that overrides your seafile hostname, so when you resolve internally it will give you a LAN IP

When you resolve outside the LAN it will use the authoritative DNS.

Few home routers have this. But that’s your only choice other than a router that supports NAT reflection which is even less common.

If you have a server on your LAN, you may setup DNSMASQ there, and make that the DNS for all your LAN clients

1 Like

Thank you for your instructions. Apparently my router doesn’t support that, so I may have to revisit this in a future upgrade…