Ceci est une ancienne révision du document !
Table des matières
Linux
25 ans d'existence
https://antoine-solnichkin.developpez.com/monitorer-activite-disque-linux/
https://www.microlinux.fr/letsencrypt-script/
https://korben.info/commande-kill-linux-tuer-processus.html
https://www.thirtythreeforty.net/posts/2019/12/my-business-card-runs-linux/
Distributions
Sites internet
http://www.linuxfromscratch.org/
Mine of Informations
The Linux Documentation Project - How to - Software Building
https://www.linuxquestions.org/
https://tutox.fr/
IP settings
Add temporary secondary IP address
Using ifconfig
If you want to add a secondary IP address to a NIC already in use in Linux, and have that change only temporary. Enter this command:
ifconfig [nic]:0 [IP-Address] netmask [mask] up
An example is shown below:
ifconfig eth0:0 192.168.1.2 netmask 255.255.255.0 up
You need to be root in order to execute that command.
Using ip command
If you prefer to use the ip command instead of ifconfig
ip address add [ip]/[mask-digits] dev [nic]
Here is an example:
ip address add 192.168.99.37/24 dev eth0
With this command you can add more ip address to the same dev NIC, the second is considered as secondary.
Add a permanent secondary IP address
Ubuntu
For Ubuntu systems, edit the /etc/network/interfaces file
vim /etc/network/interfaces
Add this for one extra IP:
auto [NIC]:[n]
iface [NIC]:[n] inet static
address [ip.add.rr.ss]
gateway [gw.ip.ad.rs]
netmask [ne.tm.as.kk]
Here an example:
auto eth0:1
iface eth0:1 inet static
address 192.168.0.1
gateway 192.168.0.254
netmask 255.255.255.0
You can add as many blocks as you want. Just change eth0:1 for eth0:2, eth0:3 and so on.
If you are adding additional IPs to eth1, or eth2 also modify that on the example.
Sources: https://www.garron.me/en/linux/
Tips
Restart network interface
/etc/init.d/networking restart
Packet capture
tcpdump -i ens224 host [IP] or host [IP] -w [file_name].pcap
How to use useradd to create and administer users (à tester)
useradd, creates a new user or update default new user information.
Syntax:
useradd [options] LOGIN
Some of its options are:
- d home directory
- s starting program (shell)
- p password
- g (primary group assigned to the users)
- G (Other groups the user belongs to)
- m (Create the user's home directory
Example:
useradd -g primary_grp -G admin -s /bin/shell -p xxxx -d /home/user -m user
Migrate MySQL database (à tester)
If you are moving to another hosting provider, or for any other reason you need to move or migrate your MySQL database you can use these instructions.
Make the backup of the database:
mysqldump -u root -p –opt [database_name] > /tmp/[database_name].sql
Where database_name is the database you want to move.
Copy the database to the new server
You can use rsync, scp or ftp, I will show you how to do it with scp:
scp /tmp/[database_name].sql user@newserver.com:/tmp/
Create the database in the new server:
mysql -u root -p
create database [database_name];
grant all privileges on [database_name].* to “some-user”@“hostname” identified by “some-strong-password”;
flush privileges;
exit
Import the backup
mysql -u root -p [database_name] < /tmp/[database_name].sql
Source: https://www.garron.me/en/bits/
Raspberry - Raspbian
Upgrade du firmware:
rpi-update
Connaître le model:
cat /proc/cpuinfo
https://fr.wikipedia.org/wiki/Raspberry_Pi#Identification_logicielle_des_diff%C3%A9rents_mod%C3%A8les
OpenWRT
Tips
Upgrade all package at once
opkg list-upgradable | cut -f 1 -d ' ' | xargs opkg upgrade
Raspberry
Build spécifique pour 3 B+:
https://downloads.openwrt.org/snapshots/targets/brcm2708/bcm2710/
https://forum.openwrt.org/t/18-06-on-raspberry-pi-3-b/18670/45
Firewall
https://openwrt.org/docs/guide-user/firewall/fw3_network
https://blog.christophersmart.com/2015/01/17/creating-a-dmz-in-openwrt/
OpenVPN
https://forums.lecrabeinfo.net/topic/7372-tuto-installer-un-serveur-openvpn-sur-votre-routeur-openwrt-lede/
https://freedom-ip.com/forum/viewtopic.php?id=4064
Sécurisation: https://blog.cavebeat.org/2018/02/openvpn-server-hardening-openwrt-tun-device/
Serveur web
reverse proxy
nginx ou lighttpd ou uhttpd à étudier
https://www.linuxquestions.org/questions/linux-newbie-8/multiple-webservers-on-port-80-behind-1-external-ip-possible-930167/
https://forum.openwrt.org/t/forward-various-domains-to-specific-internal-hosts-with-single-public-ip/9492/10
http://www.mnott.de/forward-external-request-ip-behind-reverse-proxy-behind-openwrt/
https://openwrt.org/docs/guide-user/advanced/cache.steam
https://superuser.com/questions/1266826/openwrt-redirect-incoming-wan-traffic-based-on-domain-name
Multi WAN
DDNS
ddns
