[qubes-users] Modifying /etc/hosts in dispVM

I haven’t been able to figure out how I can modify /etc/hosts in a dispVM so that my entry (such as 10.1.1.1 myhost.example.com myhost) will be used instead of DNS.

I’m trying to direct my traffic to a different host than the one listed in DNS.

Anyone know an easy fix to this? Thanks.

It's a disposable - you need to set the change in the disposable
template.
Add this to /rw/config/rc.local in the disposable template:
echo "10.1.1.1 myhost.example.com" >> /etc/hosts

That will take effect in the disposable template, and in every
disposable that uses it.

I use this often because I block DNS for many qubes, provide hosts
entries, and whitelist those IPs.

Thanks, unman, but it’s not working for me. More precisely, your suggestion above worked fine. The line “10.1.1.1 myhost.example.com” is appended to /etc/hosts. But when I open a disposable terminal and type ‘host myhost.example.com’, I get the DNS address, not 10.1.1.1.

What am I doing wrong?

The line "10.1.1.1 myhost.example.com" is appended to
/etc/hosts. But when I open a disposable terminal and type 'host
myhost.example.com', I get the DNS address, not 10.1.1.1.

'host' isn't suitable for testing this, because it never looks at the
/etc/hosts file:

Rusty

[quote]
'host' isn't suitable for testing this, because it never looks at the
[/quote]
Right - neither are most of the *other* DNS utilities - ping should do.
Or `getent hosts ...`

Thank you both for this. Makes sense.