rp_filter et maux de tête

Je viens de passer un certain temps à régler un problème avec une machine fraîchement migrée de CENTOS 5.7 à CENTOS 6.2

J’ai une machine dans un réseau A qui tente de contacter mon serveur qui dispose d’une interface (1) dans le réseau A et une interface (2) dans le réseau B.

Plusieurs cas de figure:

  • La machine ping l’adresse de l’interface (1) du serveur. C’est sur le même réseau, tout va bien.
  • La machine ping l’adresse de l’interface (2) du serveur. Ce n’est pas le même réseau, le routeur joue son rôle, le paquet ICMP arrive bien sur l’interface (2) comme l’atteste tcmdump, mais il n’y a jamais de ECHO REPLY… WTF ?!?

 

Ce cas de figure marchait parfaitement avec CENTOS 5.x. C’était sans compter l’arrivée du noyau 2.6.31 qui a modifié le fonctionnement du « Reverse path filtering »

Extrait Release notes Redhat 6x:

A change in the 2.6.31 Linux kernel made the net.ipv4.conf.default.rp_filter = 1 more strict in the I/O that is accepted. Consequently, in Red Hat Enterprise Linux 6, if there are multiple interfaces on the same subnet and I/O is sent to the one that is not the default route, the I/O will be dropped. Note that this applies to iSCSI iface binding when multiple interfaces are on the same subnet. To work around this, set the net.ipv4.conf.default.rp_filter parameter in /etc/sysctl.conf to 0 or 2, and reboot the machine.

Quand la machine contacte le serveur sur l’interface (2), le serveur voit un paquet provenant du réseau A, il ne va pas comme avec CENTOS 5 (en vert) répondre par la même interface en routant le paquet mais va tenter de répondre avec l’interface (1) (en rouge sur le schéma) qui est sur le réseau A. Or, c’est la qu’intervient le rp_filter qui va détruire la paquet !

Pour se sortir de cette situation il suffit d’éditer /etc/sysctl.conf  et de changer net.ipv4.conf.default.rp_filter = 1 pour net.ipv4.conf.default.rp_filter = 2 ou éventuellement net.ipv4.conf.default.rp_filter = 0

Compilation de RPM et erreur « *** ERROR: No build ID note found »

Si vous avez des erreurs « *** ERROR: No build ID note found » lors de la construction de paquets RPM ( J’utilise ici une Centos 6.2 x64 ) ça vient du script find-debuginfo.sh

+ /usr/bin/install -d /home/build/rpm/BUILDROOT/vmware-vsphere-sdk-4.0.0.161974-2.el6.x86_64/usr/local/vmware-sdk-install
+ /bin/cp -R ./FILES ./Makefile.PL ./apps ./bin ./doc ./etc ./installer ./lib ./man ./resources ./vmware-install.pl ./yes /home/build/rpm/BUILDROOT/vmware-vsphere-sdk-4.0.0.161974-2.el6.x86_64/usr/local/vmware-sdk-install
+ /usr/lib/rpm/find-debuginfo.sh --strict-build-id /home/build/rpm/BUILD/vmware-vsphere-sdk-4.0.0.161974
*** ERROR: No build ID note found in /home/build/rpm/BUILDROOT/vmware-vsphere-sdk-4.0.0.161974-2.el6.x86_64/usr/local/vmware-sdk-install/lib/XML-LibXML-1.63/lib/auto/XML/LibXML/LibXML.so
erreur: Mauvais status de sortie pour /home/build/rpm/tmp/rpm-tmp.3M3FWw (%install)
    Mauvais status de sortie pour /home/build/rpm/tmp/rpm-tmp.3M3FWw (%install)
Exécution_de(%prep): /bin/sh -e /home/build/rpm/tmp/rpm-tmp.ilG9fL

Vous pouvez passer outre en ajoutant la directive

%undefine _missing_build_ids_terminate_build

au début de votre fichier SPEC. Voici un extrait de mon fichier:

%undefine _missing_build_ids_terminate_build
Name:           vmware-vsphere-sdk
Version:        4.0.0.161974
Release:        2%{?dist}
Summary:       Vmware SDK for Perl

L’erreur précédente devient qu’un simple Warning sans incidence.

+ /usr/bin/install -d /home/build/rpm/BUILDROOT/vmware-vsphere-sdk-4.0.0.161974-2.el6.x86_64/usr/local/vmware-sdk-install
+ /bin/cp -R ./FILES ./Makefile.PL ./apps ./bin ./doc ./etc ./installer ./lib ./man ./resources ./vmware-install.pl ./yes /home/build/rpm/BUILDROOT/vmware-vsphere-sdk-4.0.0.161974-2.el6.x86_64/usr/local/vmware-sdk-install
+ /usr/lib/rpm/find-debuginfo.sh /home/build/rpm/BUILD/vmware-vsphere-sdk-4.0.0.161974
*** WARNING: No build ID note found in /home/build/rpm/BUILDROOT/vmware-vsphere-sdk-4.0.0.161974-2.el6.x86_64/usr/local/vmware-sdk-install/lib/XML-LibXML-1.63/lib/auto/XML/LibXML/LibXML.so
*** WARNING: No build ID note found in /home/build/rpm/BUILDROOT/vmware-vsphere-sdk-4.0.0.161974-2.el6.x86_64/usr/local/vmware-sdk-install/lib/Compress-Raw-Zlib-2.005/lib/auto/Compress/Raw/Zlib/Zlib.so
*** WARNING: No build ID note found in /home/build/rpm/BUILDROOT/vmware-vsphere-sdk-4.0.0.161974-2.el6.x86_64/usr/local/vmware-sdk-install/lib/Data-Dumper-2.121/lib/auto/Data/Dumper/Dumper.so
*** WARNING: No build ID note found in /home/build/rpm/BUILDROOT/vmware-vsphere-sdk-4.0.0.161974-2.el6.x86_64/usr/local/vmware-sdk-install/lib/UUID-0.03/lib/auto/UUID/UUID.so
*** WARNING: No build ID note found in /home/build/rpm/BUILDROOT/vmware-vsphere-sdk-4.0.0.161974-2.el6.x86_64/usr/local/vmware-sdk-install/lib/bin/libcrypto.so.0.9.8
*** WARNING: No build ID note found in /home/build/rpm/BUILDROOT/vmware-vsphere-sdk-4.0.0.161974-2.el6.x86_64/usr/local/vmware-sdk-install/lib/bin/libssl.so.0.9.8
*** WARNING: No build ID note found in /home/build/rpm/BUILDROOT/vmware-vsphere-sdk-4.0.0.161974-2.el6.x86_64/usr/local/vmware-sdk-install/lib/Class-MethodMaker-2.10/lib/auto/Class/MethodMaker/MethodMaker.so
*** WARNING: No build ID note found in /home/build/rpm/BUILDROOT/vmware-vsphere-sdk-4.0.0.161974-2.el6.x86_64/usr/local/vmware-sdk-install/lib/XML-LibXML-Common-0.13/lib/auto/XML/LibXML/Common/Common.so

 

Installer le client Oracle pour PHP sur Centos 5.x

Si vous souhaitez utiliser une base de données depuis PHP sur une Centos 5.x, voilà la procédure à suivre.

On partira du principe que vous avez déjà installé PHP et apache.

Vous devez aussi installer les outils de développement afin de pouvoir compiler PECL:

yum -y groupinstall "development tools"

Sur Centos 5.4 X64, les paquets suivants sont installés:

flex-2.5.4a-41.fc6.x86_64
gcc-4.1.2-48.el5.x86_64
redhat-rpm-config-8.0.45-32.el5.centos.noarch
strace-4.5.18-5.el5_5.5.x86_64
rpm-build-4.4.2.3-20.el5_5.1.x86_64
1:make-3.81-3.el5.x86_64
1:pkgconfig-0.21-2.el5.x86_64
gettext-0.14.6-4.el5.x86_64
gettext-0.14.6-4.el5.i386
automake-1.9.6-2.3.el5.noarch
gdb-7.0.1-23.el5_5.2.x86_64
bison-2.3-2.1.x86_64
libtool-1.5.22-7.el5_4.x86_64
autoconf-2.59-12.noarch
gcc-c++-4.1.2-48.el5.x86_64
binutils-2.17.50.0.6-14.el5.x86_64
ltrace-0.5-13.45svn.el5.x86_64
diffstat-1.41-1.2.3.el5.x86_64
splint-3.1.1-16.el5.x86_64
1:valgrind-3.5.0-1.el5.x86_64
1:valgrind-3.5.0-1.el5.i386
systemtap-1.1-3.el5_5.2.x86_64
subversion-1.4.2-4.el5_3.1.x86_64
subversion-1.4.2-4.el5_3.1.i386
texinfo-4.8-14.el5.x86_64
python-ldap-2.2.0-2.1.x86_64
patchutils-0.2.31-2.2.2.x86_64
byacc-1.9-29.2.2.x86_64
gcc-gfortran-4.1.2-48.el5.x86_64
elfutils-0.137-3.el5.x86_64
rcs-5.7-30.1.x86_64
automake16-1.6.3-8.el5.1.noarch
automake17-1.7.9-7.el5.2.noarch
automake14-1.4p6-13.el5.1.noarch
automake15-1.5-16.el5.2.noarch
ctags-5.6-1.1.x86_64
dogtail-0.6.1-3.el5.noarch
swig-1.3.29-2.el5.x86_64
dev86-0.16.17-2.2.x86_64
1:doxygen-1.4.7-1.1.x86_64
indent-2.2.9-14.fc6.x86_64
cvs-1.11.22-7.el5.x86_64
pstack-1.2-7.2.2.x86_64
oprofile-0.9.4-15.el5.x86_64
cscope-15.5-15.1.el5_3.1.x86_64

Sur le site d’oracle, télécharger les paquets suivants (en RPM):

  1. oracle-instantclient11.2-basic
  2. oracle-instantclient11.2-sqlplus (optionnel)
  3. oracle-instantclient11.2-devel

Installer les paquets fraîchement téléchargés:

rpm -Uvh oracle-instantclient11.2-basic-11.2.0.2.0.x86_64.rpm oracle-instantclient11.2-devel-11.2.0.2.0.x86_64.rpm oracle-instantclient11.2-sqlplus-11.2.0.2.0.x86_64.rpm

Il est nécessaire d’indiquer au système le chemin des nouvelles librairies:

echo "/usr/lib/oracle/11.2/client64/lib/" > /etc/ld.so.conf.d/oracle_lib.conf
ldconfig

Vous pouvez tester votre installation d’oracle en lançant /usr/bin/sqlplus64.

SQL*Plus: Release 11.2.0.2.0 Production on Wed Nov 10 14:41:50 2010
Copyright (c) 1982, 2010, Oracle.  All rights reserved.
Enter user-name:


Ensuite on va installer OCI8 à l’aide de PECL:

Si vous passez par un proxy HTTP, configurez PECL comme suit:

pear config-set http_proxy http://proxy.xxx:3128

Lancez l’installation proprement dite.

pecl install oci8

L’installation se lance. A la question « Please provide the path to the ORACLE_HOME directory. Use ‘instantclient,/path/to/instant/client/lib’ if you’re compiling with Oracle Instant Client [autodetect] :« , donnez le chemin où est installé le client oracle, ici: instantclient,/usr/lib/oracle/11.2/client64/lib

downloading oci8-1.4.3.tgz ...
Starting to download oci8-1.4.3.tgz (153,515 bytes)
............done: 153,515 bytes
10 source files, building
running: phpize
Configuring for:
PHP Api Version:         20041225
Zend Module Api No:      20050922
Zend Extension Api No:   220051025
Please provide the path to the ORACLE_HOME directory. Use 'instantclient,/path/to/instant/client/lib' if you're compiling with Oracle Instant Client [autodetect] : instantclient,/usr/lib/oracle/11.2/client64/lib
building in /var/tmp/pear-build-root/oci8-1.4.3
running: /tmp/tmppNXlUK/oci8-1.4.3/configure --with-oci8=instantclient,/usr/lib/oracle/11.2/client64/lib
checking for egrep... grep -E
checking for a sed that does not truncate output... /bin/sed
checking for gcc... gcc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ANSI C... none needed
checking whether gcc and cc understand -c and -o together... yes

...
Build complete.
(It is safe to ignore warnings about tempnam and tmpnam).
running: make INSTALL_ROOT="/var/tmp/pear-build-root/install-oci8-1.4.3" install
Installing shared extensions:     /var/tmp/pear-build-root/install-oci8-1.4.3/usr/lib64/php/modules/
running: find "/var/tmp/pear-build-root/install-oci8-1.4.3" -ls
4149348    4 drwxr-xr-x   3 root     root         4096 nov 10 13:38 /var/tmp/pear-build-root/install-oci8-1.4.3
4149377    4 drwxr-xr-x   3 root     root         4096 nov 10 13:38 /var/tmp/pear-build-root/install-oci8-1.4.3/usr
4149378    4 drwxr-xr-x   3 root     root         4096 nov 10 13:38 /var/tmp/pear-build-root/install-oci8-1.4.3/usr/lib64
4149379    4 drwxr-xr-x   3 root     root         4096 nov 10 13:38 /var/tmp/pear-build-root/install-oci8-1.4.3/usr/lib64/php
4149380    4 drwxr-xr-x   2 root     root         4096 nov 10 13:38 /var/tmp/pear-build-root/install-oci8-1.4.3/usr/lib64/php/modules
4149376  476 -rwxr-xr-x   1 root     root       481338 nov 10 13:38 /var/tmp/pear-build-root/install-oci8-1.4.3/usr/lib64/php/modules/oci8.so
Build process completed successfully
Installing '/var/tmp/pear-build-root/install-oci8-1.4.3//usr/lib64/php/modules/oci8.so'
install ok: channel://pecl.php.net/oci8-1.4.3
You should add "extension=oci8.so" to php.ini

Comme indiqué, il faut maintenant configurer php pour utiliser le module OCI8.

echo "extension=oci8.so" > /etc/php.d/oci8.ini

redémarrez apache pour prendre en compte les modifications ( /etc/init.d/httpd restart ) . Vous pouvez vérifier la prise en compte d’OCI en utilisant  la fonction PHP phpinfo();

Vous pouvez maintenant profiter d’ORACLE au travers du couple PHP / APACHE.

La doc officielle d’installation d’OCI8 est ici