slitaz-doc-wiki-data diff pages/fr/guides/network-script.txt @ rev 4

Add pages/fr folder.
author Christopher Rogers <slaxemulator@gmail.com>
date Sat Feb 26 12:13:35 2011 +0000 (2011-02-26)
parents
children b8e0b134ba24
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/pages/fr/guides/network-script.txt	Sat Feb 26 12:13:35 2011 +0000
     1.3 @@ -0,0 +1,149 @@
     1.4 +====== Les secrets du script /etc/init.d/network.sh ======
     1.5 +
     1.6 +===== Introduction =====
     1.7 +
     1.8 +Au démarrage du système SliTaz exécute le fichier ///etc/init.d/network.sh // pour initialiser le réseau.
     1.9 +Ce script configure le nom d'ôte, l'interface de boclage (loopback) et la connexion Internet.
    1.10 +
    1.11 +Il est également possible de lancer ce script pendant l'éxecution du système pour ouvrir ou fermer les connexions  réseaux.
    1.12 +Par exemple **netbox** et les scripts get-wifi-firmware (get-ipw2100-firmware, get-b43-firmware...) l'utilise.
    1.13 +
    1.14 +
    1.15 +===== Utilisation =====
    1.16 +
    1.17 +Par défaut le script ///etc/init.d/network.sh// utilise ///etc/network.conf// comme fichier de configuration.
    1.18 +Les informations contenu dans ce fichier, sont utilisées comme valeurs initiales pour la connexion réseau.
    1.19 +
    1.20 +Pour démarrer la connexion réseau entrez:
    1.21 +
    1.22 +<code>
    1.23 +# /etc/init.d/network.sh start
    1.24 +</code>
    1.25 +
    1.26 +The start arg should be used only at boot. Pour arrêter la connexion:
    1.27 +
    1.28 +<code>
    1.29 +# /etc/init.d/network.sh stop
    1.30 +</code>
    1.31 +
    1.32 +Pour arrêter et redémarrer:
    1.33 +
    1.34 +<code>
    1.35 +# /etc/init.d/network.sh restart
    1.36 +</code>
    1.37 +
    1.38 +Mais le plus intéressant est que  ///etc/init.d/network.sh// peut utiliser plusieurs fichiers de configuration.
    1.39 +C'est très pratique si vous utilisez un PC portable avec plusieurs connections.
    1.40 +
    1.41 +For example, we can create a directory /etc/network, containing some config files, named:
    1.42 +
    1.43 +    * Home, for home, using an ethernet connection and a static ip.
    1.44 +    * Desktop, for the desktop, with a wep encryption, and a static ip.
    1.45 +    * Univ, wifi without encryption, and with dhcp.
    1.46 +
    1.47 +Now to get connected at Home, later at a Desktop and finally at Univ, before stopping connection, we only have to:
    1.48 +
    1.49 +<code>
    1.50 +# /etc/init.d/network.sh restart /etc/network/Home
    1.51 +# /etc/init.d/network.sh restart /etc/network/Desktop
    1.52 +# /etc/init.d/network.sh restart /etc/network/Univ
    1.53 +# /etc/init.d/network.sh stop
    1.54 +</code>
    1.55 +
    1.56 +===== Sudo =====
    1.57 +
    1.58 +Since /etc/init.d/network.sh/ can only be used by root, if you want a normal user to use it, you should install sudo:
    1.59 +
    1.60 +<code>
    1.61 +# tazpkg get-install sudo
    1.62 +</code>
    1.63 +
    1.64 +And then configure it:
    1.65 +
    1.66 +<code>
    1.67 +# visudo
    1.68 +</code>
    1.69 +
    1.70 +For user tux, which must use network.sh from every host; without a password you should add:
    1.71 +
    1.72 +<code bash>
    1.73 +tux  ALL=NOPASSWD: /etc/init.d/network.sh,
    1.74 +</code>
    1.75 +
    1.76 +For user tortux, which may only get connected from localhost, and which should use a password each time, you should add:
    1.77 +
    1.78 +<code bash>
    1.79 +tortux my_hostname=PASSWD: /etc/init.d/network.sh,
    1.80 +</code>
    1.81 +
    1.82 +If you forgot your hostname, just run:
    1.83 +
    1.84 +<code>
    1.85 +$ cat /etc/hostname
    1.86 +</code>
    1.87 +
    1.88 +Here is some help to use visudo:
    1.89 +
    1.90 +    * i insertion mode (to write).
    1.91 +    * Escape exit insertion mode.
    1.92 +    * :wq record and quit.
    1.93 +    * :q! quit without recording.
    1.94 +
    1.95 +===== With Openbox =====
    1.96 +
    1.97 +All this is not that really user friendly...
    1.98 +
    1.99 +That's why I'll give you a perfect treat: A way to integrate all this in an openbox menu! Create a script /usr/lib/openbox/network-menu.sh, and add this to it:
   1.100 +
   1.101 +<code bash>
   1.102 +#!/bin/sh
   1.103 +#
   1.104 +# openbox pipe menu to start network connections
   1.105 +# (This script is only useful if sudo is installed, and correctly configured)
   1.106 +
   1.107 +echo ''
   1.108 +
   1.109 +# for default file:
   1.110 +echo ''
   1.111 +echo ''
   1.112 +echo 'sudo /etc/init.d/network.sh restart'
   1.113 +echo ''
   1.114 +
   1.115 +# for others files:
   1.116 +for file in $(ls /etc/network/)
   1.117 +	do
   1.118 +	echo -e ""
   1.119 +	echo ''
   1.120 +	echo "sudo /etc/init.d/network.sh restart /etc/network/$file"
   1.121 +	echo ''
   1.122 +	done
   1.123 +
   1.124 +# To stop connections:
   1.125 +echo ''
   1.126 +echo ''
   1.127 +echo 'sudo /etc/init.d/network.sh stop'
   1.128 +echo ''
   1.129 +
   1.130 +echo ''
   1.131 +</code>
   1.132 +
   1.133 +Make it executable:
   1.134 +
   1.135 +<code sh>
   1.136 +# chmod +x /usr/lib/openbox/network-menu.sh
   1.137 +</code>
   1.138 +
   1.139 +And now you only have to add these lines in //~/.config/openbox/menu.xml//:
   1.140 +
   1.141 +<code bash>
   1.142 + menu id="network-menu" label="Network" 
   1.143 +	execute="/usr/lib/openbox/network-menu.sh" />
   1.144 +</code>
   1.145 +
   1.146 +Then reconfigure openbox:
   1.147 + 
   1.148 +<code>
   1.149 +$ openbox --reconfigure
   1.150 +</code>
   1.151 +
   1.152 +Enjoy!