Unbound Rewrite Domain to local IP with Unbound_Manager Views?

  • ATTENTION! You'll notice a Prefix dropdown when you create a thread. If your post applies to one of the topics listed, please use that Prefix for your post. When browsing the thread list you can use the Prefix to filter the view.
  • ATTENTION! As of November 1, 2020, you are not able to reply to threads 6 months after the thread is opened if there are more than 500 posts in the thread.
    Threads will not be locked, so posts may still be edited by their authors.
    Just start a new thread on the topic to post if you get an error message when trying to reply to a thread.

Mikey Dread

Occasional Visitor
I have been trying to figure out how to rewrite/redirect a domain lookup to a local IP. I think I can do that with "views" in unbound manger but can't seem to make it work. This adds it as type refuse

A:Option ==> views "name" domain.com redirect 192.168.1.xxx

What am I doing wrong?
 

tomsk

Very Senior Member
you need to put redirect after the view name and before the domain

A:Option ==> views "name" redirect domain.com

then you will be prompted to put the resource record (RR) of the IP you're redirecting to

Enter RR for "name" redirect e.g. IN A 192.168.5.1 ==>: IN A 192.168.1.xxx
 

Mikey Dread

Occasional Visitor
T
you need to put redirect after the view name and before the domain

A:Option ==> views "name" redirect domain.com

then you will be prompted to put the resource record (RR) of the IP you're redirecting to

Enter RR for "name" redirect e.g. IN A 192.168.5.1 ==>: IN A 192.168.1.xxx
Thank You! Unbound takes it without an error now.
 

tomsk

Very Senior Member
Thank You! Unbound takes it without an error now.
Don't forget that you you will want to create an access-control-view statement to specify the source IP or IP block that you want to redirect... fortunately unbound manager does this for you

Example : if you have a machine at 192.168.1.100 that you want to redirect to 192.168.1.200 if it queries domain.com then your view would be created by typing

A:Option ==> views "name" redirect domain.com 192.168.1.100

then when you are prompted for an RR you can type

Enter RR for "name" redirect e.g. IN A 192.168.5.1 ==>: IN A 192.168.1.200

this would create an entry in the unbound.config.views file like this.

# View: Clients
access-control-view: 192.168.1.100/32 "name"
# EndView Clients

# View: name
view:
name: "name"
view-first: yes
local-zone: "domain.com." redirect # "name"
local-data: "domain.com. IN A 192.168.1.200" # "name"
# EndView: name
 

Similar threads

Latest threads

Sign Up For SNBForums Daily Digest

Get an update of what's new every day delivered to your mailbox. Sign up here!
Top