LPIC‐202
Lab 0
Lab 0 : Setup initial de CentOS 7
Paramètres initiaux : Paramètres réseau
1. Predictable Network Interface Names
L'exemple de nom d'interface ci‐dessous est "eth0", mais si votre système est installé sur une
machine physique, le nom n'est pas "ethX" par défaut. si vous souhaitez utiliser le nom
d'interface réseau "ethX" pour la suite, configurez comme suit :
[root @ localhost ~] # vi /etc/default/grub
ligne 6: ajouter
GRUB_CMDLINE_LINUX = "net.ifnames = 0 rd.lvm.lv = fedora / swap rd.md = 0
.....
appliquer le changement
[root @ localhost ~] # grub2-mkconfig -o / boot/grub2/grub.cfg
[root @ localhost ~] # reboot
2. Définissez une adresse IP statique sur le serveur.
Remplacez le nom d'interface "eth0" par celui de votre propre environnement.
[root@localhost ~]# hostnamectl set-hostname <Nom_Hote>.example.com
display devices
[root@localhost ~]# nmcli d
DEVICE TYPE STATE CONNECTION
eth0 ethernet connected eth0
lo loopback unmanaged --
set IPv4 address ⇒ nmcli * [IP address]
[root@localhost ~]# nmcli c modify eth0 ipv4.addresses 172.20.10.X/24
Advertisement
set default gateway
[root@localhost ~]# nmcli c modify eth0 ipv4.gateway 172.20.10.2
set DNS
[root@localhost ~]# nmcli c modify eth0 ipv4.dns 172.20.10.2
set manual for static setting (it's "auto" for DHCP)
[root@localhost ~]# nmcli c modify eth0 ipv4.method manual
restart the interface and reload the settings
[root@localhost ~]# nmcli c down eth0; nmcli c up eth0
Connection successfully activated (D-Bus active path:
/org/freedesktop/NetworkManager/ActiveConnection/1)
show settings
[root@localhost ~]# nmcli d show eth0
GENERAL.DEVICE: eth0
GENERAL.TYPE: ethernet
GENERAL.HWADDR: 00:0C:29:CD:9C:2D
GENERAL.MTU: 1500
GENERAL.STATE: 100 (connected)
GENERAL.CONNECTION: eth0
GENERAL.CON-PATH:
/org/freedesktop/NetworkManager/ActiveConnection/0
WIRED-PROPERTIES.CARRIER: on
IP4.ADDRESS[1]: ip = 172.20.10.30/24, gw = 172.20.10.1
IP4.DNS[1]: 172.20.10.1
IP6.ADDRESS[1]: ip = fe80::20c:29ff:fecd:9c2d/64, gw = ::
Elies Jebri
Advertisement
Page 1 sur 3
LPIC‐202
Lab 0
show status
[root@localhost ~]# ip addr show
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state
UP qlen 1000
link/ether 00:0c:29:cd:9c:2d brd ff:ff:ff:ff:ff:ff
inet 172.20.10.130/24 brd 172.20.10.255 scope global eth0
valid_lft forever preferred_lft forever
inet6 fe80::20c:29ff:fecd:9c2d/64 scope link
valid_lft forever preferred_lft forever
3. Désactivez IPv6 si vous n'en avez pas besoin.
[root @ localhost ~] # vi /etc/default/grub
ligne 6: ajouter
GRUB_CMDLINE_LINUX = "ipv6.disable = 1 rd.lvm.lv = fedora-server / root
.....
appliquer le changement
[root @ localhost ~] # grub2-mkconfig -o / boot/grub2/grub.cfg
Advertisement
[root @ localhost ~] # reboot
Paramètres initiaux : FireWall
Il est possible d'afficher le statut de service de FireWall comme suit. (activé par défaut)
[root@localhost ~]# systemctl status firewalld
● firewalld.service - firewalld - dynamic firewall daemon
Loaded: loaded (/usr/lib/systemd/system/firewalld.service; enabled;
vendor preset: enabled)
Active: active (running) since Thu 2015-03-31 19:36:27 JST; 2s ago
Main PID: 1308 (firewalld)
CGroup: /system.slice/firewalld.service
└─1308 /usr/bin/python -Es /usr/sbin/firewalld --nofork --nopid
.....
On n’aura pas besoin dans les Labs du service FireWall, il faut l’arrêter et le désactiver
comme suit.
stop service
[root@localhost ~]# systemctl stop firewalld
disable service
[root@localhost ~]# systemctl disable firewalld
rm '/etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service'
rm '/etc/systemd/system/basic.target.wants/firewalld.service'
Paramètres initiaux : SELinux
Il est possible d'afficher le statut de SELinux (Security‐Enhanced Linux) comme suit. (activé
par défaut)
[root@localhost ~]# getenforce
Enforcing # SELinux is enabled
Advertisement
Elies Jebri
Page 2 sur 3
LPIC‐202
Lab 0
Si la fonction SELinux n’est pas nécessaire pour des raisons telles que le fait que votre serveur
s’exécute sur le réseau local ou autres, il est possible de la désactiver comme suit.
[root@localhost ~]# vi /etc/selinux/config
This file controls the state of SELinux on the system.
SELINUX= can take one of these three values:
enforcing - SELinux security policy is enforced.
permissive - SELinux prints warnings instead of enforcing.
disabled - No SELinux policy is loaded.
SELINUX=disabled # change to disabled
SELINUXTYPE= can take one of these two values:
targeted - Targeted processes are protected,
minimum - Modification of targeted policy. Only selected processes
are protected.
mls - Multi Level Security protection.
SELINUXTYPE=targeted
restart to apply new setting
[root@localhost ~]# reboot
Elies Jebri
Page 3 sur 3