Skip to content

Instantly share code, notes, and snippets.

@bichotll
Last active May 24, 2022 20:23
Show Gist options
  • Save bichotll/88c844d6a56b1086a5560ca5abbfa546 to your computer and use it in GitHub Desktop.
Save bichotll/88c844d6a56b1086a5560ca5abbfa546 to your computer and use it in GitHub Desktop.
;
; BIND data file for local loopback interface
;
$TTL 604800
@ IN SOA ns1.thos.local. admin.thos.local. (
2 ; Serial
604800 ; Refresh
86400 ; Retry
2419200 ; Expire
604800 ) ; Negative Cache TTL
;
IN NS ns1.thos.local.
@ IN A 192.168.1.40
www IN A 192.168.1.40
* IN CNAME www
gestio IN A 100.0.0.0
secretaria IN A 100.0.0.0
mail MX 10 mail.domain.com.
ns1 IN A 192.168.1.40
servidor IN CNAME ns1
zone "thos.local" {
type master;
file "/etc/bind/db.thos.local";
}
;
bichotll@bichotll-VirtualBox:/etc/bind$ hostname -I
192.168.1.40
bichotll@bichotll-VirtualBox:/etc/bind$ sudo mkdir /var/www/web1
bichotll@bichotll-VirtualBox:/etc/bind$ sudo chrown -R $USER:$USER /var/www/web1
sudo: chrown: command not found
bichotll@bichotll-VirtualBox:/etc/bind$ sudo chown -R $USER:$USER /var/www/web1
bichotll@bichotll-VirtualBox:/etc/bind$ sudo mkdir /var/www/web2
bichotll@bichotll-VirtualBox:/etc/bind$ sudo mkdir /var/www/web-defecte
bichotll@bichotll-VirtualBox:/etc/bind$ sudo chown -R $USER:$USER /var/www/web2
bichotll@bichotll-VirtualBox:/etc/bind$ sudo chown -R $USER:$USER /var/www/web-defecte/
bichotll@bichotll-VirtualBox:/etc/bind$ sudo chown -R 755 /var/www/web1
bichotll@bichotll-VirtualBox:/etc/bind$ sudo chown -R 755 /var/www/web2
bichotll@bichotll-VirtualBox:/etc/bind$ sudo chown -R 755 /var/www/web-defecte/
bichotll@bichotll-VirtualBox:/etc/bind$
bichotll@bichotll-VirtualBox:/etc/bind$
bichotll@bichotll-VirtualBox:/etc/bind$
bichotll@bichotll-VirtualBox:/etc/bind$
bichotll@bichotll-VirtualBox:/etc/bind$ sudo vim /var/www/web1/index.html
bichotll@bichotll-VirtualBox:/etc/bind$ sudo cp /var/www/web1/index.html /var/www/web2/index.html
bichotll@bichotll-VirtualBox:/etc/bind$ sudo vim /var/www/web2/index.html
bichotll@bichotll-VirtualBox:/etc/bind$ sudo cp /var/www/web1/index.html /var/www/web-defecte/index.html
bichotll@bichotll-VirtualBox:/etc/bind$ sudo vim /var/www/web-defecte/index.html
bichotll@bichotll-VirtualBox:/etc/bind$
<VirtualHost *:80>
ServerAdmin webmaster@localhost
ServerName web-defecte.thos.local
ServerAlias www.web-defecte.thos.local
ServerAlias *.thos.local
DocumentRoot /var/www/web-defecte
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
<VirtualHost *:80>
ServerAdmin webmaster@localhost
ServerName web1.thos.local
ServerAlias www.web1.thos.local
DocumentRoot /var/www/web1
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
<VirtualHost *:80>
ServerAdmin webmaster@localhost
ServerName web2.thos.local
ServerAlias www.web2.thos.local
DocumentRoot /var/www/web2
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

Helpful stuff

check current network configuration

cat /etc/resolv.conf

start web server

sudo python3 -m http.server 80

check current ip

ip a ifconfig

Links

https://www.youtube.com/watch?v=hq8kWcpGUvw&t=14s https://www.digitalocean.com/community/tutorials/an-introduction-to-dns-terminology-components-and-concepts https://www.digitalocean.com/community/tutorials/how-to-install-the-apache-web-server-on-ubuntu-20-04

TODO

named.conf.options

  • do not change anything?

named.conf.local

  • add new zone

verify with named-checkconf named.conf.local

db.local -> db.thos.local

verify with named-checkzone thos.local db.thos.local

service bind9 restart service bind9 status

host thosi.local host servidor

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment