Linux
HOGENT toegepaste informatica
Thomas Parmentier, Andy Van Maele, Bert Van Vreckem, Jan Willem
2025-2026
In vagrant-hosts.yml:
In provisioning/ script srv.sh
toevoegen
web.sh, toegevoegde code voor installatie
LAMP verwijderenvagrant up srv
en toch blijkt…
Hosts-bestand: /etc/hosts
# IP-address hostname aliases
127.0.0.1 localhost localhost.localdomain
::1 localhost6 localhost6.localdomain6
172.22.255.254 router4038 gw gw.netlab.hogent.be
172.22.0.2 server4038 server4038.netlab.hogent.be
172.22.0.3 printer4038 printer4038.netlab.hogent.be
c:\Windows\System32\Drivers\etc\hostsEen typische AD DC overtreedt beide regels!
Stuur vraag naar de DNS-server in /etc/resolv.conf
nslookup www.hogent.be
Stuur vraag naar specifieke DNS-server
nslookup www.hogent.be 193.190.172.1
$ dig www.hogent.be
[...]
$ dig www.hogent.be @ens1.hogent.be +short
hogent.be.
193.190.173.132
$ dig -x 193.190.173.132 @ens1.hogent.be +short
net-173-node-133.hogent.be.
$ dig AAAA www.google.com +short
2a00:1450:400e:806::2004
$ dig NS hogent.be
$ dig MX hogent.be
$ dig SOA hogent.be
$ dig ANY hogent.be @ens1.hogent.be
$ dig AXFR zonetransfer.me @nsztm1.digi.ninja
Lees DNS for rocket scientists!
bind/etc/named*/var/named//etc/named.conf
options {
listen-on port 53 { any; }; //aanpassen!
listen-on-v6 port 53 { any; }; //aanpassen!
directory "/var/named";
// ...
allow-query { any; }; //aanpassen!
recursion yes;
// ...
};
listen-on: port number + network interfaces
any;127.0.0.0/8; 192.168.76.0/24allow-query: welke hosts mogen queries sturen?recursion: recursieve queries toelaten
no moeten zijn op een authoritative name
server!Als je de service nu opstart, heb je een forwarding name server
Controleer dit!
| Host | Alias | IP | Functie |
|---|---|---|---|
| ns1 | 192.0.2.1 | Primaire DNS-server | |
| ns2 | 192.0.2.2 | Secundaire DNS-server | |
| web | www | 192.0.2.10 | Webserver |
| smtp, imap | 192.0.2.20 | Mailserver |
Forward lookup zone voor example.com
zone "example.com" IN {
type primary;
file "example.com";
notify yes;
allow-update { none; };
};
/var/named/example.com
$ORIGIN example.com.
$TTL 1W
@ IN SOA n1.example.com. hostmaster.example.com. (
21120117 1D 1H 1W 1D )
IN NS ns1
IN NS ns2
IN MX 10 mail
ns1 IN A 192.0.2.1
ns2 IN A 192.0.2.2
web IN A 192.0.2.10
www IN CNAME web
mail IN A 192.0.2.20
smtp IN CNAME mail
imap IN CNAME mail
web IN A 192.0.2.10
www IN CNAME web
A: hostnaam → IPAAAA: hostnaam → IPv6PTR: IP → hostnaamCNAME: aliasSOA: start of authorityNS: authoritative name server(s)MX: mail serverSRV: serviceTXT: text record@ IN SOA ns1.example.com. hostmaster.example.com. (
21120117 1D 1H 1W 1D )
ns1.example.com.: primaire DNS-serverhostmaster.example.com.: email adres v/d sysadmin
hostmaster@example.com21120120: serial
@ IN SOA ns1.example.com. hostmaster.example.com. (
21120117 1D 1H 1W 1D )
1D: waneer zal secundaire ns proberen de zone te
synchroniseren1H: tijd tussen update-pogingen1W: wanneer zijn zonegegevens niet langer
“authoritative” (enkel op secondaire)1D: hoe lang kan een NAME ERROR resultaat gecached
worden$ORIGIN: domeinnaam
.@: wordt vervangen door waarde van
$ORIGIN$TTL: time to live (in seconden)
$ORIGIN toegevoegd aan het eindeOok combinaties, bv. 2H30M
zone "2.0.192.in-addr.arpa" IN {
type primary;
file "2.0.192.in-addr.arpa";
notify yes;
allow-update { none; };
};
192.0.2.0/24192.0.22.0.192in-addr.arpa. toeResutaat: 2.0.192.in-addr.arpa.
/var/named/2.0.192.in-addr.arpa
$TTL 1W
$ORIGIN 2.0.192.in-addr.arpa.
@ IN SOA ns1.example.com. hostmaster.example.com. (
21120117 1D 1H 1W 1D )
IN NS ns1.example.com.
IN NS ns2.example.com.
1 IN PTR ns1.example.com.
2 IN PTR ns2.example.com.
10 IN PTR web.example.com.
20 IN PTR mail.example.com.
Elke (forwarding) name server moet een lijst bijhouden van de root name servers
dig @a.root-servers.net
. 518400 IN NS a.root-servers.net.
. 518400 IN NS b.root-servers.net.
[...]
a.root-servers.net. 518400 IN A 198.41.0.4
b.root-servers.net. 518400 IN A 199.9.14.201
[...]
a.root-servers.net. 518400 IN AAAA 2001:503:ba3e::2:30
b.root-servers.net. 518400 IN AAAA 2001:500:200::b
[...]
Authoritative name server voor het domein linux.lan
| Host | Alias | IP |
|---|---|---|
| web | www | 192.168.76.4 |
| db | 192.168.76.3 | |
| srv | 192.168.76.254 |
journalctl -f -l -u namednamed-checkconfnamed-checkzone ZONE FILE$ sudo named-checkconf
$ sudo named-checkzone linux.lan /var/named/linux.lan
$ sudo named-checkzone 76.168.192.in-addr.arpa \
/var/named/76.168.192.in-addr.arpa
Query log aanzetten:
[vagrant@srv ~]$ sudo rndc querylog
BIND logs tonen:
[vagrant@srv ~]$ journalctl -f -u named.service
[vagrant@srv ~]$ sudo tcpdump -i eth1 -vvnnttt
[vagrant@srv ~]$ sudo tcpdump -i any -U -w - port 53 | tee /vagrant/dns.pcap | tcpdump -vv -nn -ttttt -r -
Bestand dns.pcap kan je openen met Wireshark!
Werk de huidige opstelling af tot een volledig werkend LAN