Add multiple hosts in DNS

Hello,

After all the many and recent troubles I’ve encountered , I decided to recreate the server from 0.
Since it wasn’t me to create it at first, I think this could help me out with a more understanding on the whole system.

well, there is a way to just add hundreds lines on the hosts file directly?
Of course I did a research on the forum already… but everything I’ve found out is a little to much tricky.

I 've already implemented ad secondary DNS server with dnsmasq and it is so easy to do it that I’m frustrating trying to figure it out how to do it with the nethserver…

Thanks for reading

Hi @trogloraspa,

Sorry for the late reply;
It is also because it is not clear what you want to achieve. :thinking:

No there is no official way to to this, in the end of the day ti is the job of a DNS/DHCP server to keep track of these.

IF I understand correctly you want to enter hundreds of hard coded dns records in the local DNS server of this nethserver installation right?

IF you insists on doing this without putting those in one by one in the web-gui :
system > dns > [Add DNS record]
You can make a custom-template to achieve this:

mkdir -p /etc/e-smith/templates-custom/etc/hosts

cat > /etc/e-smith/templates-custom/etc/hosts/90custom_hosts << EOF


#
# 90 Custom Hosts
#
#  <ip>            <hostname>

192.168.113.1      my.example.lan      
EOF

expand the template:

expand-template /etc/hosts

and check the results:

tail /etc/hosts

#
# 90 Custom Hosts
#
#  <ip>            <hostname>

192.168.113.1      my.example.lan

ping my.example.lan

Now you can add hundreds of lines to /etc/e-smith/templates-custom/etc/hosts/90custom_hosts (do not forget to expand the template :grinning:)

Please note with this approach you have hard-coded dns-records which do not show up in the Web-Gui/server-manager. (IMVHO this is an sub-optimal situation and would rethink my local NETWORK/DNS/DHCP setup)

@mark_nl

Hi

It would be easier to edit the /var/lib/nethserver/db/hosts directly, add in a line for each host (according to the already created hosts as a sample(. Reboot the server, and all these will show up in Cockpit and the older NethGUI…
And can be modified there, if needed later.
-> Best of both worlds… :slight_smile:

My 2 cents
Andy

Thanks @mark_nl , you understand perfectly the issue, but, since my server is managed by me in first person but occasionally by others, I think that all the entry must be visible on the Web-Gui.

A specific setting not clearly visible on the Web-Gui could lead to misunderstanding and confusion.
I really think should be improved a way to load a csv list file of dns entries directly by Web-Gui.

Thanks @Andy_Wismer , It seems to be the more fitting solution to my problem… too bad yesterday I’ve done it by hand :frowning: line by line

I’ll keep it it for next time :slight_smile: or maybe could help someone else looking for a way to do it

2 Likes