mirror of
https://github.com/mageddo/dns-proxy-server.git
synced 2026-04-25 17:35:54 +03:00
[GH-ISSUE #107] Hostname for the host machine IP #46
Labels
No labels
bug
confirmed
discussion
duplicate
enhancement
feature
feature-request
not-planned
pull-request
secondary-feature
stale
triage
waiting-feedback
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/dns-proxy-server-mageddo#46
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @ghost on GitHub (Mar 17, 2019).
Original GitHub issue: https://github.com/mageddo/dns-proxy-server/issues/107
Originally assigned to: @mageddo on GitHub.
Hi,
I'm using dns-proxy-server for a docker app development. I need to resolve the host machine IP by hostname. I know how to achieve it using host.docker, but I'm using a connector that I can't modify which is using my hostname.
So, is there any way to resolve my hostname to 127.0.1.1? Linking the dns proxy server to /etc/hosts or something like that.
Maybe it can be already achieved, but I can't do it reading the docs, http://mageddo.github.io/dns-proxy-server/ :S
Thanks!!
@mageddo commented on GitHub (Mar 17, 2019):
@ncapilla Not sure if you already tried and didn't achieve your objective but DPS have a local storage where you can create hostname entries (A DNS records)
You can access the GUI by http://localhost:5380 or http://dns.mageddo, configure a new hostname that solves to 127.0.1.1 then you're done.
The GUI will create a new hostname entry at the config.json see this page
Update
I realized that you wanna set the host IP the machine hostname not 127.0.1.1
Today it's not possible, I think we can make the hostname name be customizable, not fixed on
host.dockeror implement #82@mageddo commented on GitHub (Mar 17, 2019):
The issue here is that Linux solve hostnames looking at /etc/hosts before, then it try to solve using DNS server, so if you have some entry on your hosts file with machine hostname then DPS resolution will be discarded
Consider temporarily comment them
@ghost commented on GitHub (Mar 17, 2019):
When I execute "nslookup $HOSTNAME" it resolve to 127.0.1.1, but once dns-proxy-server started it stops resolving my hostname. And it should use the /etc/hosts file first...
I'm missing something, I'll check out my ubuntu config.
Update
Adding my hostname to the config.json is a valid workaround for my local machine. But I'm running this setup on multiple environment so I need to do it dinamically :s
Update 2
If I comment the line "nameserver 127.0.0.53" in the /etc/resolv.conf file, then "nslookup $HOSTNAME" stops resolving localhost. So when I start dns-proxy-server and this line get commented it also stop working.
@ghost commented on GitHub (Mar 17, 2019):
Is it possible to ask the local dns server after trying the other ones?
As your documentation points out, first it finds a match at docker containers, second at local db, then it try to look at 8.8.8.8. What about a final step asking to local dns server?
Update
I've tried this config but it doesn't work as I expected.
{
"remoteDnsServers": [ [172,19,0,1] ],
"envs": [
{
"name": ""
}
],
"activeEnv": "",
"lastId": 0,
"webServerPort": 0,
"dnsServerPort": 0,
"defaultDns": null,
"logLevel": "",
"logFile": "",
"registerContainerNames": null
}
@mageddo commented on GitHub (Mar 18, 2019):
A local entry inside your config.json will not work cause DPS is running inside docker container, it can't listen to local DNS server
You can define multiple nameservers at your /etc/resolv.conf
This sound very strange for me, I thought resolv.conf wasn't necessary to solve hosts file hostnames.
I see, I think make host machine hostname be configurable is not a big change, I will consider develop it in the next days
@ghost commented on GitHub (Mar 18, 2019):
I finally found the error, the connector is listening on a port in the host machine. Then a container is trying to open a connection to the host machine using its hostname.
So, It isn't a problem with the dns-proxy-server...
Anyway making host machine hostname configurable is a nice feature to consider ;)
Thanks for your help!!
@mageddo commented on GitHub (Mar 31, 2019):
Feature was developed, please check the release notes.
Be aware if you set the host machine hostname as the machine name then you will have to remove
it's name from
/etc/hostssince OS try to resolve names from hosts file firstthen from DNS server
@mageddo commented on GitHub (Mar 31, 2019):
Feel free to comment if you wish to discuss about anything related to this issue