F
F
FEDKOTV2020-08-04 15:23:44
linux
FEDKOTV, 2020-08-04 15:23:44

How to configure Desktop to resolve domains from a virtual machine?

There are:
1) main PC - Ubuntu 20.4 Desktop ( IP 192.168.1.1 )
2) virtual machine - Ubuntu 20.4 Server ( IP 10.10.10.10 )

The web and dns server are running on the virtual machine.
When making entries in the hosts file of the main PC (such as site.com 10.10.10.10 ), the desired site opens.

Required:
The main PC must open sites from Wirth. machines without manipulating the hosts file.

Question:
What needs to be done and how to configure it so that domains / sites on the virtual machine are resolved without unnecessary manipulations on the main PC?

It was done:
1) Using a python script (dnsproxy)
2) Setting in the Network Manager (GUI) in the DNS parameters IP Wirth. machines
3) Change resolv.conf

all of the above were configured according to the instructions, but in the end did not work (reason: my illiterate address or "is it supposed to be?")

I would appreciate any help! Thanks in advance :)

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Andrey Barbolin, 2020-08-04
@FEDKOTV

You can put DNS unbound and resolve it with a forward.
/etc/unbound/unbound.conf

server:
        verbosity: 1
        interface: 0.0.0.0
        do-ip4: yes
        access-control: 0.0.0.0/0 allow
        chroot: ""
        hide-version: yes
        key-cache-size: 0
        cache-max-ttl: 0

        private-address: 10.0.0.0/8
        private-address: 172.16.0.0/12
        private-address: 192.168.0.0/16

        private-domain: "site.com"

        local-zone: "10.in-addr.arpa." nodefault
        local-zone: "16.172.in-addr.arpa." nodefault
        local-zone: "168.192.in-addr.arpa." nodefault
        local-data: "ntp.site.com IN A 10.10.10.1"

## Если нет записи в local-data то дальше резолвим домены site.com на 1.1.1.1
forward-zone:
        name: "site.com"
        forward-addr: 1.1.1.1

## Все остальное резолвим на 1.1.1.1
forward-zone:
        name: "."
        forward-addr: 1.1.1.1

D
Dmitry Aleksandrov, 2020-08-04
@jamakasi666

It's not all that simple, and a ton of more detailed information is needed.
You probably brought up some sites like example.org and example1.org. In addition, there is also the hostname of the machine itself.
You have some kind of webserver (apache\nginh\...) spinning in which these sites example.org and example1.org are registered in the configs.
As a result, dns will not know anything about example.org and example1.org.
Those. in your case, you need to register on the DNS server, for example, in the router, the A records of example.org and example1.org with addresses 10.10.10.10.
As a result, you register the site in the web server config (apache\nginh) and on the DNS server.
Another option is to keep the site (in the singular) under whatever name, and already conditionally in the directories to keep other sites in it will be something like 10.10.10.10/example.org/ and 10.10.10.10/example1.org/ . But you have to cheat with the web server config.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question