What's new

Unbound Rewrite Domain to local IP with Unbound_Manager Views?

  • SNBForums Code of Conduct

    SNBForums is a community for everyone, no matter what their level of experience.

    Please be tolerant and patient of others, especially newcomers. We are all here to share and learn!

    The rules are simple: Be patient, be nice, be helpful or be gone!

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?
 
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
 
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.
 
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

Support SNBForums w/ Amazon

If you'd like to support SNBForums, just use this link and buy anything on Amazon. Thanks!

Sign Up For SNBForums Daily Digest

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