Config VM
→ si on augmente la taille du disque (dynamiquement alloué) → penser à augmenter la taille partition dans la VM
NB: Bonnes pratiques VM : → taille fixe disque
-
Adresse miroir = depôts ex: http://archive.ubuntu.com/ubuntu
Password recovery (ubuntu)
1/ reboot
2/ "echap" au demarrage VM
3/ recovery mode
4/ Root
$ sudo su
5/ Verif login :
$ cd/home # ou $ cat /etc/passwd
6/ Connaitre la partition (persistance data)
$ mount | grep " / "
7/
$ mount -o remount,rw /
8/ Changer le password
$ passwd <username>
Warning
|
Si LDAP ne fonctionne pas forcément ! |
Definir une IP statique (Ubuntu)
Methode temporaire
$ sudo ifconfig enp0s3 10.8.0.200 netmask 255.255.255.0
Warning
|
(deprecated soon) |
Best Practice :
$ sudo ip addr add 10.8.0.200/24 dev enp0s3
Pour supprimer l’IP attribuée :
$ sudo ip addr del 10.8.0.200/24 dev enp0s3
Methode persistante
$ sudo nano /etc/netplan/50-cloud...
Fichier de config .yaml
Warning
|
Ne pas mettre de "tab" en yaml ! |
network: ethernets: enp0s3: dhcp4: false addresses: [10.8.0.200/24] gateway4: 10.8.0.254 nameservers: addresses: [8.8.8.8, 8.8.4.4] version: 2
$ sudo netplan apply $ netsat -rn $ sudo reboot
How to change Hostname on Ubuntu
For exemple you sometimes you clone a VM and need to change the hostname of the machine.
sudo hostnamectl set-hostname <myhostname>
Config serveur IPAM (IP adress management) (Ubuntu)
Installation DHCP
$ sudo apt install isc-dhcp-server
change the default configuration by editing /etc/dhcp/dhcpd.conf to suit your needs and particular configuration.
You also may need to edit /etc/default/isc-dhcp-server to specify the interfaces dhcpd should listen to.
Note
|
dhcpd’s messages are being sent to syslog. Look there for diagnostics messages. |
Exemple de config :
# minimal sample /etc/dhcp/dhcpd.conf default-lease-time 600; max-lease-time 7200; subnet 10.8.0.0 netmask 255.255.255.0 { range 10.8.0.51 10.8.0.100; option routers 10.8.0.254; option domain-name-servers 10.8.0.201; option domain-name "grp8.grit.lab"; }
After changing the config file you have to restart the dhcpd:
$ sudo systemctl restart isc-dhcp-server.service
On va configurer : /etc/default/isc-dhcp-server
Pour spécifier les interfaces sur lesquelle dhcpd doit ecouter :
# On what interfaces should the DHCP server (dhcpd) serve DHCP requests? # Separate multiple interfaces with spaces, e.g. "eth0 eth1". INTERFACESv4="enp0s3" INTERFACESv6="
sudo service isc-dhcp-server restart sudo service isc-dhcp-server status
Installation DNS
Installation
At a terminal prompt, enter the following command to install dns:
$ sudo apt install bind9
The DNS configuration files are stored in the /etc/bind directory. The primary configuration file is /etc/bind/named.conf.
Primary Master
In this section BIND9 will be configured as the Primary Master for the domain example.com. Simply replace example.com with your FQDN (Fully Qualified Domain Name). Forward Zone File
To add a DNS zone to BIND9, turning BIND9 into a Primary Master server, the first step is to edit /etc/bind/named.conf.local:
zone "example.com" { type master; file "/etc/bind/db.example.com"; };