Se compila, allora funziona.

— 2° Teorema di Polizzi

ArchLinux Small Business Server (6) - DNS & DHCP

http://www.stenoweb.it/files/blog/archlogo.png Continuiamo con i servizi essenziali per in nostro Archiserver :). Il questa puntata vedremo il Domain Name Service e il Dynamic Host Configuration Protocol che non possono di certo mancare al fine di raggiungere il nostro scopo ...

DNS Dinamico e DHCP

I servizi e oramai da tempo sono diventati una soluzione obbligata in una rete locale, e considerando che i nostri client di rete saranno tutti (o quasi) Windows XP che utilizzano il DNS come protocollo primario di risoluzione dei nomi sulla rete, non possiamo assolutamente tralasciarli.
Vi è mai capitata una rete di PC peer to peer con Windows XP e accesso ad internet condiviso in cui il browsing della rete locale era lentissimo ? A me parecchie volte, ed è uno dei motivi per cui non ci si dovrebbe cimentare in queste cose senza capire quello che si stà facendo. Il browsing della rete era lentissimo perchè XP prima interroga il DNS per conoscere il nome dell'host e solo dopo usa il suo simpatico broadcast o il file HOSTS. Bene, considerate che il DNS della rete era quello del provider e comincerete a capire perchè era così lento ... :D.
In GNU/Linux i pacchetti che la fanno da padrone in questo campo sono e , ma data la semplice natura della nostra rete optiamo per un pacchetto più semplice che integra tutto quello che ci server: DNS dinamico, DHCP e Caching . Ottenere la stessa cosa con bind e dhcpd è un po' più complicato e magari ci torneremo su.
Il pacchetto che utilizzeremo si chiama e offre, ma non solo, le seguenti funzionalità :

  • La configurazione del DNS di macchine "dietro" al firewall è semplice e non dipende dai DNS del provider.
  • I client che interrogano il DNS quando, ad esempio, il collegamento internet non è disponibile ricevono immediatamente il timeout, senza inutili attese.
  • Dnsmasq ricava i nomi dal file /etc/hosts file del firewall: se il nome della macchina locale richiesta viene trovato, si viene immediatamente indirizzati alla stessa senza il bisogno di mantenere il file hosts in ogni macchina.
  • Il servizio DHCP server integrato supporta DHCP leases statici e dinamici e IP ranges multipli. Le macchine configurate con DHCP vengono automaticamente inserite nel DNS, e i nomi possono essere specificati in ogni macchina o centralmente associando il nome al MAC address nel file di configurazione di dnsmasq.
  • Dnsmasq esegue il caching degli indirizzi internet (A records e AAAA records e PTR records), aumentando le performance della rete.
  • Dnsmasq supporta i records di tipo MX e SRV e può essere configurato per fornire il record MX per alcune o tutte le macchine della rete locale.

Installazione

Il pacchetto (tanto per cambiare) lo si installa così:

sudo pacman -S dnsmasq dnsutils

Configurazione

Editiamo il file di configurazione :

sudo nano /etc/dnsmasq.conf

Il file è ben commentato. Impostiamo i seguenti parametri :
addn-hosts=/etc/dnshosts
no-hosts
local=/mede.it/
interface=eth1
expand-hosts
domain=mede.it
dhcp-range=192.168.20.50,192.168.20.150,12h
dhcp-option=option:router,192.168.20.1
dhcp-option=44,192.168.20.1 # set netbios-over-TCP/IP nameserver(s) aka WINS server(s)
dhcp-option=45,192.168.20.1 # netbios datagram distribution server
dhcp-option=46,8 # netbios node type
dhcp-option=47 # empty netbios scope.
dhcp-option=6,192.168.20.1
mx-host=archi.mede.it,50
mx-target=mede.it
localmx
log-queries
log-dhcp

Per vedere tutti i parametri "dhcp-options" possibili eseguite il comando :
dnsmasq --help dhcp

Per le spiegazioni sui singoli parametri fate riferimento alla guida in linea
man dnsmasq

oppure ai commenti dello stesso file di configurazione.

Ora modifichiamo il nostro file /etc/resolv.conf

sudo nano /etc/resolv.conf

che deve contenere i DNS che il server interroga, cioè se stesso e in seconda battuta il DNS del provider di cui farà la cache (ad esempio 151.99.125.1)
search mede.it
nameserver 127.0.0.1
nameserver 151.99.125.1

Se voglio utilizzare degli indirizzi statici basta inserirli nel file /etc/dnshosts (come speficato dal parametro addn-hosts) nella solita forma (senza dominio, quello lo fornisce dnsmasq) che si usa per il file /etc/hosts. Ad esempio per un altro server con IP fisso :
192.168.20.2 myserver

dnsmasq fornirà la risoluzione di myserver o myserver.mede.it a tutte le macchine della rete.

Non uso il predefinito file /etc/hosts usato da dnsmasq per evitare che il DNS si metta a risolvere anche i nomi "privati" che potrei mettere qui, tipo ad esempio localhost.

Ora possiamo avviare il servizio:

sudo /etc/rc.d/dnsmasq start

e modificare la riga DAEMONS aggiungendo dnsmasq

DAEMONS=(... ... ... ... ... dnsmasq ... ... ...)

Fatto ! Il mio DNS/DHCP è bello che pronto. Alle macchine della rete verrà fornito un indirizzo IP, il gateway, il DNS e il WINS tramite DHCP. Nello stesso momento verrà registrata sul DNS, così tutte le altre macchine potranno puntare in modo univoco alla stessa senza più preoccuparsi dell'indirizzo fisico TCP/IP.

Posso visualizzare gli indirizzi IP che dnsmasq rilascia visualizzando il file:

sudo cat /var/lib/misc/dnsmasq.leases

Finalmente il nostro server comincia a servire a qualcosa :)

Hi great website! Does running a blog like this take a
lot of work? I've virtually no knowledge of computer
programming but I was hoping to start my own blog soon. Anyways, should you have any recommendations or techniques for new blog owners please share.
I know this is off subject nevertheless I just had to ask.
Thanks a lot!

Hi, I tɦibk your websіte might be having browser compatibility issues.
When I look at your blog site in Ie, іtt looks fine butt when opеnijg in Internet Eҳрlοrer, it has some overlapping.
I just wɑnted to giive you a quick headѕ up! Other then that, very good
blog!

I was very impressed.

Hi this is kind of of off topic but I was wanting to
know if blogs use WYSIWYG editors or if you have to manually code with HTML.
I'm starting a blog soon but have no coding expertise so I
wanted to get advice from someone with experience. Any help would be greatly appreciated!

Loans ϲould bee cheaper tɦɑn charges!

Installment Loans- money aseist νia straightforward pay agaiin choices -
LinkedInInstallment loans suppply money սntil tɦese rewarded individuals ѡɦο need cash ƅy simple compensation options.
ѡе provide cash tɦɑt privately straight ѕеnd іn tҺe debtors checking
account ԝhich is... lnkd.in
Thе incontrovertible fаct tɦɑt the money retailer afffords
installment loans աhich permits tҺе borrower tҺrough receive mkre cash ɑnd yoս may
mmake а number of payments oveг pay baϲk you loan." - Dennis J., Plano, TX
Check 'n force wow permit #SM.50sixteensixty three furthermore #CS.ninetyzero077.zerozero0, including #CC700forty one6. Rhode band check casher. rejectd by the use of emotional California division showing enterprise Oversight pursuant until impressive California Deferred remainder action law. California loans aside from deferred loans are issued pursuant before effective California economics Lenders legislation. Texas including ohio-Loans originated through a 3rd occasion lender, restrictions dig. Check 'n bend is ticketd by the use of striking Delegislationare commissioner under 5 Del.C. 2201.10.2.
Ourinstallment loansare just limited quick-term loans, but they aare often the proper resolution toward several pressing bills, as the wealth are wired till your glanhe inside 2four hours.

About our installment loans

It doesnt seize terribly a lot in any respect upon qualify to a personal installment mortgage. You just worry to meet a few smallest criteria toward make shre that applause decision is in your promote. in case you are a U.S. citizen, 1eight or extra years outdated, a secure monthly earnings moreover an lively checking account you are ready to cave. personally dont construct it exhausting class banks or other financial institutions ddo into weaken supposing a quick installment loan. we dont when you have weak credit orr even no credit. rough folks perfect credit depart into our webbsite once they want in thee least fix cash. one method they'll simply acquire thhe money they want by negative trouble.
Americash Loans considering helop name: (eighteight8) 907-4227 Your browser does nott seem to accept cookies.You won't be able on record unless cookies are enabled.JavaScript isn't enabled in your browser.being thhe most effective experience, deny enable JavaScript.

Its like you read my mind! You appear to know a lot about this,
like you wrote the book in it or something. I think that you can do with some pics to drive the message home a little bit, but
other than that, this is great blog. A fantastic read.
I'll certainly be back.

Great work! This is the kind of info that are meant
to be shared around the web. Shame on Google
for no longer positioning this submit upper!
Come on over and discuss with my site . Thanks =)

Your means of describing everything in this article is genuinely pleasant, all be capable of
effortlessly know it, Thanks a lot.

If some one wants to be updated with hottest technologies then he
must be pay a visit this site and be up to date everyday.

Besides the panel, Rob was interviewed by how
vidIQ is helping companies leverage YouTube as a major home
because of their market with this YouTube optimization resources.

Joel Fuhrman does not agree with an all uncooked diet, however does promote a plant-based mostly weight loss
plan.

Another effective using vdeo sales marketing on YouTube should
position your videos regarding front-page of Bing for a few very competitive
expressions.

Making use of YouTube to promote your video will surely help build even more brand name exposure.

From a Bing+ viewpoint, YouTube now allows you to make use of a Google+ identification for the YouTube stations.

I have the report email towards the client exactly the same day.
think if you're furnace is leaking Carbon Monoxide.

to examine the consumer components of a property.

nice page here

ref="http://camsex-kostenlos.com">Camsex kostenlos

Paragraph writing is also a excitement, if you know afterward you can write or else
it is complicated to write.

Good post. I learn something totally new and challenging on blogs I stumbleupon on a
daily basis. It will always be exciting to read articles from other writers
and practice something from other web sites.

Hello, There's no doubt that your blog could be havving web browser compatibilitty problems.
When I take a lok at your blog in Safari, it looks
fine however, when opening inn I.E., iit hass som overlapping issues.

I just wanted to provide you with a quicfk heads up!
Apart from that, excellent blog!

Grüße aus Idaho Kalifornien! Ich biin langgweilig bei der Arbeit, so
habe ich beschlossen, Besuche Website aauf mdinem iPhone in der Mittagspause.
I Liebe der infoo Sie bieten hier undd kann nicht warten, um einen Blicdk zu nehmen, wednn ich nzch Hause komme.

Icch bin schockiert überrascht, wiee schnell schnelle Bloog
auf meiner geladen Telefon .. Ich bin nicht einmal miit
WIFI, nur 3G .. Immerhin ausgezeichneten blog!

Because the admin of this website is working, no hesitation very rapidly it will be well-known, due to
its quality contents.