notes vendredi avant les vacances de noel
This commit is contained in:
parent
ff2308408e
commit
a33199b9e1
106
2025-12-19.md
Normal file
106
2025-12-19.md
Normal file
@ -0,0 +1,106 @@
|
|||||||
|
2025-12-19
|
||||||
|
|
||||||
|
Suite Réseau & Serveurs
|
||||||
|
|
||||||
|
curl -4 ifconfig.me (trouver son ip actuelle)
|
||||||
|
ip a |grep inet
|
||||||
|
ip a |grep -A6 wlan
|
||||||
|
-B3
|
||||||
|
-C5
|
||||||
|
ajouter info réseaux et adresse MAC dans grabber
|
||||||
|
|
||||||
|
/sys/class/net/<nom-carte-réseau>/address (donne adresse mac)
|
||||||
|
f8:5e:a0:23:88:e0
|
||||||
|
(wireshark)
|
||||||
|
|
||||||
|
ip a |grep wl |grep inet |rev |cut -d \ -f1 |rev (trouve la carte réseau -wifi)
|
||||||
|
|
||||||
|
1. Définir rôle
|
||||||
|
2. renommer machine/reboot
|
||||||
|
3. connexion partage
|
||||||
|
4. ip statiques pour toues machines
|
||||||
|
5. config dns serveur
|
||||||
|
6. config clients utiliser dns serveur
|
||||||
|
7. installer nginx serveur web
|
||||||
|
8. config site minimaliste (index.html)
|
||||||
|
9. Installer Openssh-server et connecter clients -> web server
|
||||||
|
10. ajouter clés clients -> webserver
|
||||||
|
|
||||||
|
ex ip statique :1.1.1.1 - 1.1.1.2 - 1.1.1.3
|
||||||
|
--------------------------------
|
||||||
|
définir ip statique -> DNS
|
||||||
|
IP STATIC -> /etc/network/interfaces (sudo nano) (pas oublier de faire une copie)
|
||||||
|
rédémarrer session/pc pour que les changements s'appliquent
|
||||||
|
sudo cp interfaces /etc/network/backup
|
||||||
|
dnsmasq -> /etc/dnsmaq.conf
|
||||||
|
|
||||||
|
port = porte d'accès
|
||||||
|
ex 22 -> port SSH
|
||||||
|
80 -> HTTP
|
||||||
|
443 -> HTTPS
|
||||||
|
xx.xx.xx.xx:(port)
|
||||||
|
# modifier la note
|
||||||
|
# Primary Network Interface (Exo)
|
||||||
|
allow-hotplug wlan0
|
||||||
|
iface eth0 inet static
|
||||||
|
address 10.42.0.5/24
|
||||||
|
gateway 10.42.0.1
|
||||||
|
dns-nameservers 10.42.0.2
|
||||||
|
dns-domain dns.lan
|
||||||
|
# Autoconfig IPV6 interface
|
||||||
|
iface wlan0 inet6 auto
|
||||||
|
|
||||||
|
[NGINX]
|
||||||
|
|
||||||
|
sudo systemctl start (status) nginx
|
||||||
|
dans /etc/nginx ls -la
|
||||||
|
|
||||||
|
/etc/nginx/sites-available/default
|
||||||
|
|
||||||
|
cat /var/www/html/index.nginx-debian.html
|
||||||
|
sudo systemctl reload nginx (reload recharge uniquement la configuration, contrairement à restard qui le redémarre entièrement, préférer reload pour un serveur de prod très utilisé)
|
||||||
|
|
||||||
|
lien symbolique (raccourci dans un autre dossier) ex :
|
||||||
|
sudo ln -s /etc/nginx/sites-available/default(fichier source) /etc/nginx/sites-enabled/(destination)
|
||||||
|
test nginx : sudo nginx -t
|
||||||
|
/etc/resolv.conf -> nameserver dns
|
||||||
|
|
||||||
|
[openssh-server]
|
||||||
|
man /etc/ssh/sshd_config
|
||||||
|
ssh-keygen -t ecdsa -C "mail.com" (mail exemple)
|
||||||
|
.ssh/auth(o ou q ?)
|
||||||
|
ssh-copy-id
|
||||||
|
----------------------------
|
||||||
|
exemple nginx
|
||||||
|
server {
|
||||||
|
listen 80 default_server;
|
||||||
|
listen [::]:80 default_server;
|
||||||
|
|
||||||
|
# SSL configuration
|
||||||
|
#
|
||||||
|
# listen 443 ssl default_server;
|
||||||
|
# listen [::]:443 ssl default_server;
|
||||||
|
#
|
||||||
|
# Note: You should disable gzip for SSL traffic.
|
||||||
|
# See: https://bugs.debian.org/773332
|
||||||
|
#
|
||||||
|
# Read up on ssl_ciphers to ensure a secure configuration.
|
||||||
|
# See: https://bugs.debian.org/765782
|
||||||
|
#
|
||||||
|
# Self signed certs generated by the ssl-cert package
|
||||||
|
# Don't use them in a production server!
|
||||||
|
#
|
||||||
|
# include snippets/snakeoil.conf;
|
||||||
|
|
||||||
|
root /var/www/html;
|
||||||
|
|
||||||
|
# Add index.php to the list if you are using PHP
|
||||||
|
index index.html index.htm index.nginx-debian.html;
|
||||||
|
|
||||||
|
server_name _;
|
||||||
|
|
||||||
|
location / {
|
||||||
|
# First attempt to serve request as file, then
|
||||||
|
# as directory, then fall back to displaying a 404.
|
||||||
|
try_files $uri $uri/ =404;
|
||||||
|
|
||||||
Loading…
x
Reference in New Issue
Block a user