Score:-1

How can I keep network routing internal?

cn flag

I have a web server behind Nginx reverse proxy. When I access the server with a client from the same internal network via its secure URL, how can I ensure the traffic routing stays within the internal network. It makes no sense in my view for traffic to go outside, travel through public internet and and come back into the internal network.

HBruijn avatar
in flag
One of the methods used is split horizon DNS , where internal clients resolve an internal rather than the public IP address of a particular on-premise service/site. -|- Usually a router can also ensure that traffic for your on premise website gets routed there directly without going via the public internet.
Score:1
ws flag

There is a lot of information missing from your post.

I assume you mean that your webserver is accessed from the internet via a NATted address and the DNS records point to that public address. And you want to use the same DNS name when accessing the service from inside your LAN. Further, any discussion of this becomes a lot more complicated if your LAN has more than one IP subnet - so I'll assume that is not the case.

The additional complexity of the nginx reverse proxy is irrelevant to how you access the service from a browser. You simply want to connect to the service using the DNS name which points (albeit indrectly) at the proxy rather than the origin server.

Connections from inside your LAN will not go out onto the internet (unless there is something very wrong with your router). What should happen is that the request will go to the router and be sent back into the LAN. However it is conceivable that the router may have explicit ACLs configured and be lacking one to allow connection from your subnet to the pubnet addresses - in which case you simply won't be able to connect until you fix the omission. But that is a very unusual edge case.

Going via the router does mean that there is an extra network hop, adding maybe a millisecond of latency to network traffic. You're really not going to notice this. It does however mean that access to the service is dependent on the router functioning correctly, and the stats collection on the router may be impacted.

As others have said, it is common to use split DNS in such a scenario. You simply ensure that all clients on your LAN point to a DNS server which claims to be authoritative for the domain of your service.

A simpler, but less scalable solution is to just add an entry in hosts file of the clients to override the default DNS data.

Some more complex routers provide the facility to intercept and rewrite DNS packets entering the network to replace NATted addresses (Cisco call this technology DNS doctoring). But if this applies to your environmet, then you already have a team of network engineers on-site who will know how to provision this.

In the absence of any reason to do anything different, I suggest going with the first option and just bouncing the traffic off the router.

Marc avatar
cn flag
Yes - your assumptions above are all correct. I am surprised though that the router would keep traffic inside. I would have thought that, when I am calling the "https://example.com" from inside my network, the router will then call on the external DNS 1.1.1.1 (as setup in the router settings) and then obviously obtain my external IP back. Consequently the traffic will then all follow the My_HTTPS_server ---> MyRouter ---> my Inet provider's backbone ---> my external IP ---> Myrouter ----> My_internal_client. How can I check the exact package routing?
Marc avatar
cn flag
Who has down voted my question?
HBruijn avatar
in flag
Commonly your external IP is associated with the external interface on your router and traffic from your internal network to that external IP won’t have to go beyond your router. Just like you don’t need to leave your house to reach your own front door.
HBruijn avatar
in flag
@Marc By philosophy and design votes are anonymous and **neither voting [up](https://serverfault.com/help/privileges/vote-up) nor voting [down](https://serverfault.com/help/privileges/vote-down) requires any mandatory explanation**. The tooltip that appears when your mouse pointer hoovers over the down button states: *"this question does not show any research effort; it is unclear or not useful"*. Also questions can attract a down vote when not [well written](http://meta.serverfault.com/a/3609/37681), not quite [on-topic](https://serverfault.com/help/on-topic) or missing details.
Marc avatar
cn flag
@HBruijn Thank you for explaining. The down vote is unfair and unwarranted as I did not breach any of those requirements and the question is well written. If this forum wants to deter users like myself from getting involved in this community, then keep down-voting. Not a great way to win new users.....
Score:1
ru flag

When I access the server with a client from the same internal network via its secure URL, how can I ensure the traffic routing stays within the internal network.

Simply use the server's private IP address for access and don't route that address through anything you don't want.

If you use the reverse proxy's public name to access the server you need to implement split-horizon/split-brain DNS on your DNS server for the private LAN. For queries from your private network, resolve the name to the web server's private IP address. For queries from the open Internet resolve as before.

Marc avatar
cn flag
Thanks Zac. That sound really helpful. Unfortunately, I am managing the Nginx proxy via a package called Nginx Proxy manager. This is a web application which does not allow to setup split-brain DNS. Do you know what to tweak, maybe I can change sme config files myself.
Zac67 avatar
ru flag
You need to set up split brain on your DNS server (used by the private clients), not on the proxy.
cn flag
@Marc: `Unfortunately, I am managing the Nginx proxy via a package called Nginx Proxy manager.` Why?
Marc avatar
cn flag
I dont run my own DNS server internally. My DNS is 1.1.1.1
Zac67 avatar
ru flag
@Marc Then you will need to get yourself a DNS server. Split brain isn't possible without.
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.