|
|||||||
|
|
|
![]() |
|
|
Strumenti |
|
|
#1 |
|
Senior Member
Iscritto dal: May 2007
Città: Milano
Messaggi: 7103
|
[Server] Creare un Server DNS
Ciao a tutti,
in questi giorniho avuto bisogno di creare un dns server per la mia rete casalinga. Vi riporto qualche appunto che ho scritto, sperando vi sia utile nel caso voleste farlo anche voi. Ovviamente indirizzi ip,domini e hosts sono inventati e da sostituire con i vostri. Codice:
------------ Howto create a DNS server ------------
Clone Vm (or install a new host) and set its Ip address to 192.168.0.40 and its hostname to ns.example.com
--------------------------------------------------
# apt-get --purge remove isc-dhcp-client isc-dhcp-common dhcp3-client
--------------------------------------------------
# apt-get install bind9 dnsutils
--------------------------------------------------
# vi /etc/hosts
127.0.0.1 localhost.localdomain localhost
192.168.0.40 ns.example.com ns
# The following lines are desirable for IPv6 capable hosts
::1 ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
ff02::3 ip6-allhosts
--------------------------------------------------
# vi /etc/resolv.conf
and add this information.
search example.com
nameserver 192.168.0.40
nameserver 8.8.8.8
nameserver 8.8.4.4
--------------------------------------------------
# vi /etc/bind/named.conf.local
//
// Do any local configuration here
//
// Consider adding the 1918 zones here, if they are not used in your
// organization
// include "/etc/bind/zones.rfc1918";
zone "example.com" {
type master;
file "db.example.com";
};
zone "0.168.192.in-addr.arpa" {
type master;
file "db.192.168.0";
};
--------------------------------------------------
# vi /var/cache/bind/db.example.com
$TTL 604800
@ IN SOA ns.example.com. admin.example.com. (
2008080101 ;serial
04800 ;refresh
86400 ;retry
2419200 ;expire
604800 ;negative cache TTL
)
@ NS ns.example.com
ns IN A 192.168.0.40
router IN A 192.168.0.1
pi1 IN A 192.168.0.120
wprinter IN A 192.168.0.15
wheezy64 IN A 192.168.0.210
nas1 IN A 192.168.0.80
xenserver1 IN A 192.168.0.3
fisso IN A 192.168.0.200
--------------------------------------------------
# vi /var/cache/bind/db.192.168.0
$TTL 604800
@ IN SOA ns.example.com. admin.example.com. (
2008080101 ;serial
604800 ;refresh
86400 ;retry
2419200 ;expire
604800 ;negative cache TTL
)
@ IN NS ns.example.com.
@ IN A 192.168.0.40
40 IN A ns
1 IN A router
120 IN A pi1
15 IN A wprinter
210 IN A wheezy64
80 IN A nas1
3 IN A xenserver1
200 IN A fisso
--------------------------------------------------
# vi /etc/bind/named.conf.options
forwarders {
8.8.8.8;
8.8.4.4;
};
--------------------------------------------------
For every linux box
# vi /etc/resolv.conf
nameserver 192.168.0.40
And for every windows box use 10.0.0.40 as the primary DNS and add example.com as prefix.
--------------------------------------------------
# echo “kernel.domainname = example.com” >> /etc/sysctl.conf # sysctl -p
Luca
__________________
Apple Watch Ultra + iPhone 15 Pro Max + Rog Ally + Legion Go |
|
|
|
|
|
#2 |
|
Senior Member
Iscritto dal: May 2007
Città: Milano
Messaggi: 7103
|
Nel caso di aggiunte o rimozioni si incrementa il serial e si riavvia bind.
__________________
Apple Watch Ultra + iPhone 15 Pro Max + Rog Ally + Legion Go |
|
|
|
|
|
#3 |
|
Senior Member
Iscritto dal: Feb 2002
Messaggi: 2511
|
Se vi serve un dns in locale, magari per mascherare qualche ip o fare qualche prova con i server di posta (per i quali vi servono i record TX) provate con dnsmasq.
Vi propaga il file /etc/hosts , e per creare un record basta una semplice riga tipo: Codice:
# Add domains which you want to force to an IP address here. # The example below send any host in doubleclick.net to a local # webserver. #address=/doubleclick.net/127.0.0.1 |
|
|
|
|
| Strumenti | |
|
|
Tutti gli orari sono GMT +1. Ora sono le: 23:14.



















