I have a
I want to redirect all requests made to
https://www.youtube.com/ to my own NodeJS server running in the Local Network at say
Note: I want requests of all devices connected to my network to be redirected!
I tried changing my router firmware to
OpenWrt, etc but my router was not installing it!
I cannot find any way to do it as of now?
Can anyone help?
I checked the manual of your router for the ability to create a static DNS entry, however I did not find that it supports that (can’t rule out it does allow that).
One way to achieve this would be to host your own DNS relay server in your LAN. This is a DNS server that caches DNS requests and forwards DNS requests that are not in cache to another recursive DNS server. There, you can normally add static entries, in this case an
A record for
A popular software for this is pi-hole, which many people use to block requests to ad-serving hosts (e.g. something with
ads.example.com resolves to
0.0.0.0 based on a blacklist in the server). To achieve what you are trying to do with this exemplary software you need to:
- Setup pihole
- Make pihole the primary DNS server in the DHCP settings of your router (ie telling every host on the network to use this server to resolve domains)
- Add a custom entry to resolve youtube.com
A few things need to be noted here:
- This only blocks access to
youtube.comon the DNS-layer. For example, an application that has a hardcoded IP-address of youtube.com as a fallback will still be able to connect to that server since the blocking/redirecting is on a layer above that.
- You will get SSL warnings/errors in the clients connecting to the host on your LAN if
https://youtube.comis being used since that is essentially a man-in-the-middle attack. Thus, such an approach works well for blocking access to that site but not for forwarding the traffic transparently. If you want to achieve that you will need to use a HTTP proxy and configure that in each browser of each host of the network. As you can see this solution would then involve manual configuration of each host and is not a transparent network-wide solution – therefore it is probably not what you want.