linuxpratique
linuxpratique
linuxpratique
IP ADRESSE CONFIGURATION
########################
10.ip a / ifconfig
11.nano /etc/netplan/00-installer-config.yaml
..
network:
version: 2
ethernets:
enp0s3:
dhcp4: no
dhcp6: no
addresses: [192.168.1.1/24]
gateway4: 192.168.1.1
nameservers:
addresses: [8.8.8.8,8.8.4.4]
..
###########script1##################################################################
############################
#!/bin/bash
sed -i -e 's/true/no/g' -e '3 a\ version: 2' -e '6d' -i -e '$a \ dhcp6: no\n addresses:
[192.168.1.10/24]\n gateway4: 192.168.1.1\n nameservers:\n addresses: [8.8.8.8,8.8.4.4]
/etc/netplan/00-installer-config.yaml
netplan apply
ip a
##################################################################################
###############################
###########################################################################
#!/bin/bash
sed -i -e '1d' /etc/hostname -i -e '3a \192.168.1.1 serv.drhkat.cd serv' /etc/hosts -i -e
's/127.0.0.53/192.168.1.1/g' /etc/resolv.conf
echo 'serv.drhkat.cd' >> /etc/hostname
###########################################################################
###############
utiliser SSH
##############
DNS CONFIGURATION
#################
16.sudo apt install bind9 bind9utils bind9-doc
17.sudo nano /etc/default/named
..
OPTIONS="-u bind -4"
..
18.sudo systemctl restart bind9
19.sudo nano /etc/bind/named.conf.options
..
acl "trusted" {
192.168.1.1;
};
options {
directory "/var/cache/bind";
recursion yes;
allow-recursion { trusted; };
listen-on { 192.168.1.1; };
allow-transfer { none; };
forwarders {
8.8.8.8;
8.8.4.4;
};
..
20.sudo nano /etc/bind/named.conf.local
..
zone "drhkat.cd" {
type primary;
file "/etc/bind/zones/db.serv.drhkat.cd";
allow-transfer { 192.168.1.1; };
};
zone "1.168.192.in-addr.arpa" {
type primary;
file "/etc/bind/zones/db.1.168.192";
allow-transfer { 192.168.1.1; };
};
..
21.sudo mkdir /etc/bind/zones
22.sudo cp /etc/bind/db.local /etc/bind/zones/db.serv.drhkat.cd
23.sudo nano /etc/bind/zones/db.serv.drhkat.cd
..
$TTL 604800
@ IN SOA serv.drhkat.cd. root.serv.drhkat.cd. (
3 ; Serial
604800 ; Refresh
86400 ; Retry
2419200 ; Expire
604800 ) ; Negative Cache TTL
;
@ IN NS serv.drhkat.cd.
@ IN A 192.168.1.1
serv IN A 192.168.1.1
..
24.sudo cp /etc/bind/db.127 /etc/bind/zones/db.1.168.192
25.sudo nano /etc/bind/zones/db.1.168.192
..
$TTL 604800
@ IN SOA serv.drhkat.cd. root.serv.drhkat.cd. (
3 ; Serial
604800 ; Refresh
86400 ; Retry
2419200 ; Expire
604800 ) ; Negative Cache TTL
;
@ IN NS serv.drhkat.cd.
@ IN PTR serv.drhkat.cd.
serv IN A 192.168.1.1
1 IN PTR serv.drhkat.cd
..
26.sudo named-checkconf
27.sudo named-checkzone serv.drhkat.cd /etc/bind/zones/db.serv.drhkat.cd
28.sudo named-checkzone 1.168.192.in-addr.arpa /etc/bind/zones/db.1.168.192
29.systemctl restart bind9
30.systemctl status bind9
31.ufw allow bind
nslookup serv.drhkat.cd
sur le client
*************
windows et linux
ping serv.drhkat.cd
linux
ping serv:drhkat.cd
dig serv.drhkat.cd
CONFIGURATION DHCP
##################
32.sudo apt install isc-dhcp-server -y
##########################
/etc/default/isc-dhcp-server
INTERFACES="eth0"
##########################
authoritative;
###############################
ufw allow from any to any port 53
ufw allow proto udp from 0.0.0.0/0 to 0.0.0.0/0 port 67
ufw allow proto from ::/0 to ::/0 port 1194
deny unknown-clients
###################################
37.dhcp-lease-list
38.sudo nano /etc/dhcp/dhcpd.conf
..
host PC1 {
hardware ethernet 08:00:27:E4:77:F9;
fixed-address 192.168.1.20;
..
35.sudo systemctl restart isc-dhcp-server
CONFIGURATION SAMBA
####################
SAMBA SANS MOT DE PASSE
***********************
36.sudo apt install samba
37.sudo mkdir /document
38.sudo chmod 777 /document
39.sudo cp /etc/samba/smb.conf /etc/samba/smb.conf.backup
40.sudo nano /etc/samba/smb.conf
..
[dospart]
comment = dossier partager
path = /document
guest ok = yes
writeable = yes
browseable = yes
..
##########verifier les configurations####
testparm
#########################################
42.sudo systemctl start smbd
43.sudo systemctl status smbd
TESTER VOS CONFIGURATION
#######################
sur le client windows
W+R
\\serv.drhkat.cd\dospart
\\192.168.1.1\dospart
smbclient \\\\serv.drhkat.cd\\dospart
smbclient \\\\192.168.1.1\dospart
W+R
\\serv.drhkat.cd\info
\\192.168.1.1\info
##########script####################################################################
#########################################################
#!/bin/bash
mkdir /admincours
chmod 777 /admincours
groupadd reseaux
chgrp reseaux /admincours
chcon -t samba_share_t /admincours
useradd -G reseaux laura
useradd -G reseaux jean
smbpasswd -a laura
smbpasswd -a jean
smbpasswd -e laura
smbpasswd -e jean\
sed -i '9 a \ map to guest = bad user' /etc/samba/smb.conf
sed -i '$a \[tmp]\ncomment= dossier tmp\npath= \/tmp\nbrowseable=yes\nwriteable=yes\nguest
ok= yes' /etc/samba/smb.conf
sed -i '$a \[admincours]\ncomment= dossier admin\npath= \/admincours\nbrowseable=
yes\nwriteable= yes\nvalid users= @reseaux\nread list= jean' /etc/samba/smb.conf
firewall-cmd --add-service=samba --zone=public --permanent
firewall-cmd --reload
systemctl start smb
systemctl enable smb
systemctl status smb
##################################################################################
#############################################################
W+R
\\serv.drhkat.cd\info
sur le client linux
ligne de commande