Modifying /etc/hosts in dispVM

13 views
Skip to first unread message

john.e...@gmail.com

unread,
Apr 19, 2023, 10:06:19 AM4/19/23
to qubes-users
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.

unman

unread,
Apr 19, 2023, 11:19:56 AM4/19/23
to qubes...@googlegroups.com
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.

john.e...@gmail.com

unread,
Apr 19, 2023, 1:57:32 PM4/19/23
to qubes-users
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?

Rusty Bird

unread,
Apr 20, 2023, 7:35:46 AM4/20/23
to john.e...@gmail.com, qubes-users
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

> 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:

https://serverfault.com/questions/121890/hosts-file-seems-to-be-ignored

Rusty
-----BEGIN PGP SIGNATURE-----

iQKTBAEBCgB9FiEEhLWbz8YrEp/hsG0ERp149HqvKt8FAmRBIgRfFIAAAAAALgAo
aXNzdWVyLWZwckBub3RhdGlvbnMub3BlbnBncC5maWZ0aGhvcnNlbWFuLm5ldDg0
QjU5QkNGQzYyQjEyOUZFMUIwNkQwNDQ2OUQ3OEY0N0FBRjJBREYACgkQRp149Hqv
Kt9f0w//YnwHK/X+kaSu1hXQfZ0rQbi8iRNjB764+BNW7WXBEK4wOR+aMrpIJz0R
qjrYleqW8lhZ1tZwWxEmcSPZFUOE7KtXM2RyAi2M8lLrd83/QJEbVHxZIFY1twIs
upVDxnayDF1+oqsNSfIVX8T7aq3Arp93Od5afMztfOg88EqWthbia5klig3S6Rg1
1qyelWSzsT6sic6M/UrXzE902g/kVFchsXEYNmnKH6etdlS6ZHr+E9nUypZc+U0o
20f3t3okjNvBrGddVIkbgLR/iAuJ7+C/fL5dCCL8b3z6QlcI2WhY4fVBYFzWbWTu
Hr448m92kRJyuOB5AGF1nfNm8WjDFt2Rr6NDxSIv7oFVJRtbmuBkDGw4J1UCFHNc
xCeVE93OkFlAeqEt+7Gvj2HvcQJqUQzWM92OPRUk5b2HXV0NMmYgPcVQV+vgtLy1
CkGs+3WSY61eKkUxARPaTJxCBwTY+LALOt+9aYsPpRK5P5Nj6SwdpjzGugWeKnxk
5ZEH8UhBLefFxItl2+hUCFWPuaBdQ0XOG0zitXVgLwXwn/CCRxV7Ibp+0lv6w+MT
nmtdL38wigQkLEG8uKqQAFpow5asNdTQe66aXwrU7Z74JLclK62ZaaaszLT8K3oq
Rc7b87rNbVjWmLErkLhWIo3mlq8EBme8iGvahasHPt+QGX/R8UQ=
=mRxX
-----END PGP SIGNATURE-----

unman

unread,
Apr 20, 2023, 8:15:02 AM4/20/23
to john.e...@gmail.com, qubes-users
On Thu, Apr 20, 2023 at 11:29:08AM +0000, Rusty Bird wrote:
[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 ...`

john.e...@gmail.com

unread,
Apr 20, 2023, 9:39:22 AM4/20/23
to qubes-users
Thank you both for this. Makes sense.
Reply all
Reply to author
Forward
0 new messages