Filtering and redirecting websites using dnsmasq

I've got a LAN connected to fibre router/modem for internet access, four client machines and low powered SBC running Ubuntu Server and Nginx. I'm wanting to use the SBC to filter out requests for certain websites and redirect them on to it's own Nginx instance whilst letting all other normal site requests continue on to our ISP's DNS servers. I can already configure the router to pass DNS requests to the SBC.

Is dnsmasq the best method to achieve this, and if so which bit of dnsmasq's configuration allows me to ignore normal traffic and just capture that handful of websites? Can the redirect in dnsmasq be switched on and off dynamically (at certain times for instance) or does it require a restart of the dnsmasq service?

Most dnsmasq tutorials a quite poor for explaining this kind of usage but I can't find any other Linux tools that would allow me to achieve the same thing.

0
задан 4 July 2018 в 21:45
1 ответ

Dnsmasq по умолчанию читает файл / etc / hosts, поэтому одним из возможных решений может быть добавление всех доменных имен, которые вы хотите перенаправить, в файл hosts.

Однако это не позволяет динамически правки или запланированные перенаправления. Включение и выключение перенаправления таким способом вряд ли удастся. Например, записи DNS также кэшируются на стороне клиента, поэтому внесение изменений на сервере не обязательно сразу же повлияет на клиентов. Сам DNS не предназначен для этого. Брандмауэры и прокси-серверы предназначены для управления веб-трафиком.

0
ответ дан 5 December 2019 в 05:44

Теги

Похожие вопросы