I’m new to VyOS and have a question about DNS redirection. I want to know if there’s a feature or method in VyOS to modify DNS queries. For example, when a user tries to access domain.com (which normally resolves to IP 1.1.1.1), I want to redirect the request so it resolves to a different IP, like 2.2.2.2.
This is similar to modifying the /etc/hosts file on a Linux system. Does VyOS support something like this? If so, how can I configure it?
First of all, you need to ensure your clients are using your VyOS device as their DNS server. I assume you are assigning your clients IP Addresses via DHCP and handing out your routers LAN interface address as the DNS Server.
You can then simply do
set system static-host-mapping host-name rewrite.domain.com inet '2.2.2.2'