Home
Help
Search
Login
Register
OPNsense Forum
»
Archive
»
18.1 Legacy Series
»
/etc/hosts modifications
« previous
next »
Print
Pages: [
1
]
Author
Topic: /etc/hosts modifications (Read 6514 times)
nycaleksey
Newbie
Posts: 24
Karma: 3
/etc/hosts modifications
«
on:
July 17, 2018, 06:13:43 pm »
Hi,
Is there any way to edit /etc/hosts entries via UI? I know, similar functionality exists when enabling Unbound or DNSMasq, but I am using neither and just need to alter name resolution on the firewall for one hostname.
Thank you.
Logged
JasMan
Full Member
Posts: 175
Karma: 9
Re: /etc/hosts modifications
«
Reply #1 on:
July 18, 2018, 08:00:24 am »
As far as I know there's no point in the GUI where you can modify the hosts file.
I'm not an Linux expert, but maybe you can do it with a cron job:
echo "127.0.0.1 name.tld" >> /etc/hosts
Logged
Duck, Duck, Duck, Duck, Duck, Duck, Duck, Duck, Goose
franco
Administrator
Hero Member
Posts: 17661
Karma: 1611
Re: /etc/hosts modifications
«
Reply #2 on:
July 19, 2018, 12:29:09 am »
So.... if you don't use Unbound or Dnsmasq /etc/hosts is only for the firewall itself. Why do you need to modify one entry for the firewall itself?
Cheers,
Franco
Logged
nycaleksey
Newbie
Posts: 24
Karma: 3
Re: /etc/hosts modifications
«
Reply #3 on:
July 19, 2018, 10:13:18 pm »
Franco,
I am migrating Squid web proxy functionality from a Linux server to OPNsense, and on the old Linux-based proxy /etc/hosts is used for a dirty one-off URL rewriting hack (certain hostname in the host portion of the URL needs to always be resolved by the proxy to specific IP, no matter what DNS points to).
I know I can probably do it in the squid.conf somehow, but just wanted to copy the existing functionality as-is, and optimize it later.
JasMan, thanks for the cron trick, it worked for now, although I would prefer a cleaner interface.
Logged
franco
Administrator
Hero Member
Posts: 17661
Karma: 1611
Re: /etc/hosts modifications
«
Reply #4 on:
July 20, 2018, 12:42:06 am »
Thanks for the clarification. From ease of integration point of view it's best to use Dnsmasq for this. It's cheap and fast.
You said you don't use it, but have the perfect use case for it. I would encourage you to try it instead of editing /etc/hosts.
Another way would be patching the code to always inject that entry, but that is lost on updates so then needs to be reapplied.
Cheers,
Franco
Logged
Print
Pages: [
1
]
« previous
next »
OPNsense Forum
»
Archive
»
18.1 Legacy Series
»
/etc/hosts modifications