Bind resolve to private ip address

Hello. I have a problem resolving the public ip of my machine since i changed the ip address of mail-in-a- box.

I have installed mail-in-a-box in a virtual machine in a phisical vmware server (It is not installed in a cloud, it is in a machine in my own network).

From outside of the network, i can resolve the name of the server correctly

C:\Users\marcosms>ping correo.tabigal.com

Haciendo ping a correo.tabigal.com [185.179.142.57] con 32 bytes de datos:
Respuesta desde 185.179.142.57: bytes=32 tiempo<1m TTL=64

From a computer in my local network, i have the same (The domain resolves to a public ip).

But if I check in the terminal of the mail-in-a-box installation, I can see this.

root@box:/etc/bind# dig correo.tabigal.com

; <<>> DiG 9.11.3-1ubuntu1.16-Ubuntu <<>> correo.tabigal.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 20038
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 6, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
; COOKIE: 8c76bcf1a00b5f08cdebb08261f7f7d3c98f55a4cd8d1db2 (good)
;; QUESTION SECTION:
;correo.tabigal.com.            IN      A

;; ANSWER SECTION:
correo.tabigal.com.     86400   IN      A       192.168.0.23

;; AUTHORITY SECTION:
tabigal.com.            172799  IN      NS      ns3.dinahosting.com.
tabigal.com.            172799  IN      NS      ns2.box.correo.tabigal.com.
tabigal.com.            172799  IN      NS      ns1.box.correo.tabigal.com.
tabigal.com.            172799  IN      NS      ns4.dinahosting.com.
tabigal.com.            172799  IN      NS      ns2.dinahosting.com.
tabigal.com.            172799  IN      NS      ns.dinahosting.com.

;; Query time: 647 msec
;; SERVER: 127.0.0.1#53(127.0.0.1)
;; WHEN: Mon Jan 31 15:53:07 CET 2022
;; MSG SIZE  rcvd: 214

Note than the “Answer Section” says that the public ip of “correo.tabigal.com” is “192.168.0.23” instead of my public ip address.

But some of the domains that i have installed in this machine brings the right IP adress, like “correo.disacustic.com”. This address resolves to my public ip if I made a “dig” command.

It appears that bind have a problem since i changed the public ip of the machine, but i don’t know how to solve it.

Any idea about how to solve this trouble?

Thanks.

Have you tried running sudo mailinabox?

Yes. I tried it several times and all seems equal.

I’m sorry, but I’m not sure what you mean by all seems equal.

Sorry. Translation problem :roll_eyes:

What I say is that everything seems to stay the same. Nothing changed when I execute the “mailinabox” command. I try to execute it one more time, but i made it about 3 or 4 times and nothing changes.

What i see is the following. When the “mailinabox” command finished, i tryed to made a “dig box.correo.tabigal.com” command and I obtained the right ip. So, i Went to the admin page of mail-in-a-box to see if any of the errors disappeared. Then I noticed that i have still errors in the admin panel, so i runed the “dig box.correo.tabigal.com” command and… The wrong ip is again here!!

This is what i can see in terminal.

This is what i can see in terminal.

root@box:/home/marcosms# dig box.correo.tabigal.com

; <<>> DiG 9.11.3-1ubuntu1.16-Ubuntu <<>> box.correo.tabigal.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 19871
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 4, ADDITIONAL: 5

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
; COOKIE: 668079f3d4ca5ed13876da8b61f8018bc3004648f3b623e0 (good)
;; QUESTION SECTION:
;box.correo.tabigal.com.                IN      A

;; ANSWER SECTION:
box.correo.tabigal.com. 272     IN      A       185.179.142.57

;; AUTHORITY SECTION:
tabigal.com.            289     IN      NS      ns3.dinahosting.com.
tabigal.com.            289     IN      NS      ns.dinahosting.com.
tabigal.com.            289     IN      NS      ns2.dinahosting.com.
tabigal.com.            289     IN      NS      ns4.dinahosting.com.

;; ADDITIONAL SECTION:
ns.dinahosting.com.     289     IN      A       185.192.220.10
ns2.dinahosting.com.    289     IN      A       185.192.221.10
ns3.dinahosting.com.    289     IN      A       185.192.222.10
ns4.dinahosting.com.    289     IN      A       185.192.223.10

;; Query time: 0 msec
;; SERVER: 127.0.0.1#53(127.0.0.1)
;; WHEN: Mon Jan 31 16:34:35 CET 2022
;; MSG SIZE  rcvd: 242



root@box:/home/marcosms# dig box.correo.tabigal.com

; <<>> DiG 9.11.3-1ubuntu1.16-Ubuntu <<>> box.correo.tabigal.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 35303
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 4, ADDITIONAL: 5

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
; COOKIE: a9275972358e8e7fde2444d361f801c8bb628ac7667df94f (good)
;; QUESTION SECTION:
;box.correo.tabigal.com.                IN      A

;; ANSWER SECTION:
box.correo.tabigal.com. 86373   IN      A       192.168.0.23

;; AUTHORITY SECTION:
tabigal.com.            282     IN      NS      ns4.dinahosting.com.
tabigal.com.            282     IN      NS      ns.dinahosting.com.
tabigal.com.            282     IN      NS      ns2.dinahosting.com.
tabigal.com.            282     IN      NS      ns3.dinahosting.com.

;; ADDITIONAL SECTION:
ns.dinahosting.com.     282     IN      A       185.192.220.10
ns2.dinahosting.com.    282     IN      A       185.192.221.10
ns3.dinahosting.com.    282     IN      A       185.192.222.10
ns4.dinahosting.com.    282     IN      A       185.192.223.10

;; Query time: 0 msec
;; SERVER: 127.0.0.1#53(127.0.0.1)
;; WHEN: Mon Jan 31 16:35:36 CET 2022
;; MSG SIZE  rcvd: 242

root@box:/home/marcosms#

You can see that I obtained something different at the second try.

And this is what I can see in the admin panel of mail-in-a-box

This domain must resolve to your box's IP address (185.179.142.57) in public DNS but it currently resolves to 192.168.0.23. It may take several hours for public DNS to update after a change. This problem may result from other issues listed above.

I forgotted this: if i made ping to the domain from the mail-in-a-box installation, i can see the right ip.

marcosms@box:~$ ping box.correo.tabigal.com
PING box.correo.tabigal.com (185.179.142.57) 56(84) bytes of data.
64 bytes from box.correo.tabigal.com (185.179.142.57): icmp_seq=1 ttl=64 time=0.165 ms

So i think that this is a “bind” problem. Bind is the program that brings me a wrong ip for this domain, but how can i arrange this?

Another thing that I forgotted. I tried to add this line to the hosts file (/etc/hosts)

185.179.142.57 box.correo.tabigal.com

This force that the “ping” command to bring the right IP, but the “dig” command still shows the private ip instead of the public IP

Have a look in /etc/mailinabox.conf

That file contains the addresses used by the last “sudo mailinabox”. If your system is somehow picking up the wrong local or external IP address for the setup, you should see it in that file.

You can edit the file and “sudo mailinabox” again, as the contents of mailinabox.conf becomes the new defaults.

It seems that all is right there.

Captura de pantalla 2022-02-01 a las 7.30.06

I’m very confused with this trouble. Anybody knows any way to force bind to resolve the right ip when i asked it the ip of the domain?

System still playing up?

For your info, /etc/hosts and your DNS server (nsd) are two separate systems.

Ping asks Linux to to convert name into IP address, then tries to contact it. Linux uses /etc/hosts or (if it can’t find it) your default DNS resolver (probably your provider’s DNS server if you’re hosted, or your router if local). So ping will uses “hosts” or an external server, not necessarily your local name server (nsd).

You can tell dig which name server to ask. Try “dig @185.179.142.57 box.correo.tabigal.com” to ask your own name server what the address of your box is. Your “nsd” process (your name server) doesn’t use “hosts” at all.