Lancer la connexion d'un poste client |
![]() |
![]() |
|
--------------------------------- réseau privé
|
|
PC sous
PC sous
Windows
Linux
|
internet
NOTE: J'ai essayé d'installer diald sans succès, si quelqu'un a réussi à le faire marcher, je suis preneur de la config.
rpm -ivh c-mserver-0_5_5-3_i386.rpm
Ca va vous installer un exécutable mserver dans /usr/sbin, un répertoire de doc c-mserver-0.5.5 dans /usr/doc et un fichier de config mserver.conf dans /etc. Il va de plus configurer le démarrage pour que le serveur se lance au boot. Vous allez donc retrouver un fichier mserver sous /etc/rc.d/init.d avec cette tête là:
#! /bin/sh
# Copyright (c) 1995-1998 S.u.S.E. GmbH Fuerth, Germany.
# Original Author: Mike Klinkert
# New Author: Willi Eigenmann
# Modified to suit redhat distribution 22/06/1999
# chkconfig: 345 93 36
# description: Starts and stops the mserver \
#
used to provide Internet access.
# /etc/rc.d/init.d/mserver
# Source function library.
. /etc/rc.d/init.d/functions
# Source networking configuration.
. /etc/sysconfig/network
# Check that networking is up.
[ ${NETWORKING} = "no" ] && exit 0
# Check that mserver.conf exists.
[ -f /etc/mserver.conf ] || exit 0
case "$1" in
start)
echo "Starting mserver."
/usr/sbin/mserver
;;
stop)
echo -n "Shutting down
mserver: "
killproc /usr/sbin/mserver
echo
;;
restart|reload)
$0 stop
$0 start
;;
check|status)
echo -n "Checking for
mserver, pid is: "
pidof /usr/sbin/mserver
echo
;;
*)
echo "Usage: $0 {start|stop|restart|check}"
exit 1
;;
esac
exit 0
Par ailleurs les liens symboliques suivants sur le fichier /etc/rc.d/init.d/mserver sont créés automatiquement:
/etc/rc.d/rc0.d/K36mserver
/etc/rc.d/rc1.d/K36mserver
/etc/rc.d/rc2.d/K36mserver
/etc/rc.d/rc3.d/S93mserver
/etc/rc.d/rc5.d/S93mserver
/etc/rc.d/rc6.d/K36mserver
/etc/rc.d/rc4.d/S93mserver
Pour configure masqdialer, il suffit d'éditer et de modifier /etc/mserver.conf ça fait un peu long à éditer ici dans la page, mais ça vaut le coup, car j'y ai rajouté des commentaires. Si pour certaines variables, il n'y a pas de commentaires mais seulement ceux d'origine, c'est que leur valeur par défaut marche très bien chez moi et que je n'ai pas eu à les modifier.
# c-mserver config file
# Charles P. Wright
# cpwright@villagenet.com
# en clair ici, on indique ce quelles interfaces le daemon mserver
doit écouter en attente de demande de connexion
# vous allez mettre l'adresse IP de votre serveur linux, dans
mon exemple 192.168.1.10,
# le port indiqué 224 doit être cohérent avec
celui déclaré dans /etc/services (voir plus bas)
# 127.0.0.1 ne doit pas être changé, ça correspond
à la machine linux elle même
listen_on = "192.168.1.10:224,127.0.0.1:224"
# Do we fork into the background and close stdin, stdout, and sterr?
demon = true
# How many clients can we have waiting on the incoming queue before
they get
# locked out
slimit = 10
# Should we disconnect if we are not currently serving any clients?
zeroclientdisconnect = false
# If there is more than one client is one of them allowed to hangup
the
# connection?
multiclientkill = true
# The location of the file containing the LICENSE that is returned
by the
# LICENSE command. You should have recieved a copy of the
GPL with this
# program.
# ici j'ai mis le chemin de ce fameux fichier COPYING, mais vous
pouvez mettre
# n'importe quoi, ça n'a pas d'incidence sur le fonctionnement
de masqdialer
license = /usr/doc/c-mserver-0.5.5/COPYING
# The location of the file containing the version history that is
returned by
# the HISTORY command.
# idem que la remarque précédente
history = /usr/doc/c-mserver-0.5.5/ChangeLog
# What version of getstat should we use? pppdlock, netdev,
lockonly and
# exitcode are your choices if you are using PPP then you should
really use
# pppdlock. If you have a weird method of connecting use netdev.
If you want
# to check if a file simply exists then use lockonly. Exitcode will
execute a
# program and if it returns the value in goodcode then the link
will count as
# being up. pppdpid will record the pid of pppd when it connects
and ensures
# that that process is still a pppd.
# Très important, on va définir maintenant comment
les postes clients du réseau
# sauront si on est connecté ou pas, pour cela ils disposent
de 4 possibilités qui sont
# pppdlock, netdev, lockonly et exitcode
# ici j'ai mis la ligne juste en dessous en commentaire, c'était
le moyen par défaut
#stattype = pppdlock
# Other stattype options:
# stattype = netdev
# stattype = exitcode
# j'ai choisi cela, les postes clients sauront si on est connecté
s'il existe un fichier lock (voir plus bas)
stattype = lockonly
# stattype = pppdpid
# What should pppdlock look for in /proc/net/dev?
# on se sert pas de cette variable concerne stattype=netdev
pppkey = "pppd"
# What is the name of your interface that exists when and only when
you are
# connected? This can used for the stat check and it is used
for the netload
# feature. You can set this on a device by device basis.
# on se sert pas de cette variable concerne stattype=nettdev
netdev = ppp0
# What file should we look for netdevices in?
# on se sert pas de cette variable concerne stattype=nettdev
devfile = "/proc/net/dev"
# What command should we use to check the link status? If the
link is good
# it should return 0, otherwise it should return a non-zero value.
This is used
# as the format string to snprintf, the %s will be replaced with
the checkhost
# which is defined below.
# je pense que ça sert si on utilise exitcode, on va pingeur
une machine sur internet,
# si elle répond c'est qu'on est bien connecté
linkcheck = "/bin/ping -c 1 %s"
# This is for testing non-link dependent portions of the server.
The linkhost
# is ignored for this entry.
# linkcheck = "/home/cpwright/src/mserver/fakelink/linkcheck %s"
# What host should we make sure is active when performing a linkcheck?
I
# suggest using an IP number instead of a hostname to expedite the
operation,
# this gets performed a lot and the longer it takes for it to happen
the more
# frustrated a user will get.
# voilà la machine qu'on doit pinguer si on choisit exitcode,
j'ai mis ici
# l'adresse IP du serveur DNS primaire d'un de mes FAI
checkhost = "194.149.160.9"
# What code do we want our linkcheck command to return. This
is most likely
# zero.
# variable utile si on a choisit exitcode
goodcode = 0
# What is the lockfile for your modem, dial out as normal and then
look in
# /var/lock
# Je me suis rendu compte que quand une connexion était en
cours, un fichier
# /var/lock/LCK..ttyS0 se créer ( mon modem est sur le port
/dev/ttyS0), c'est pour
# ça que j'ai choisi comme moyen de détection de la
connexion lockfile, le client va
# regarder si le fichier lock exite pour dire si on est connecté
ou pas.
# définition du fichier de lock. Chez vous faites une connexion
PPP, regardez sous /var/lock
# et mettez ici le fichier correspondant
lockfile = "/var/lock/LCK..ttyS0"
# Where do pppd and chat spit out their messages?
# fichier de log
logfile = "/var/log/messages"
# What machines are allowed to capture the modem?
# 127.0.0.1 correspond à votre machine linux (ne pas toucher
cette adresse),
# 192.168.1.* au préfixe des adresses IP de votre réseau
privé
capture_ipallow = "127.0.0.1:192.168.1.*"
# What machines are allowed to administer the server. I recommend
you make
# this a machine that only you have access to. The firewall
(localhost) is
# usually a good choice. You can disable this by setting it
to 0.0.0.0 (I am
# assuming no host will have that IP address).
# on laisse cette valeur par défaut
admin_ipallow = "127.0.0.1"
# What users are allowed to administer the server. I would
choose your account
# but not root. Having the root password being transmitted
over the network
# can be a *really* bad thing. If you are using it on only
loopback it isn't
# as bad.
# comme son nom l'indique, franchement je vois pas trop l'intérêt
d'une telle commande
# pour moi l'admin de masqdialer se réduit à un vi
sur le fichier de config en tant que root
admin_userallow = "olivier"
# What machines are allowed to lock and unlock connections?
# qui a le droit de créer un fichier de lock et à
le virer
lock_ipallow="192.168.1.*:127.0.0.1"
# What users are allowed to lock and unlock connections?
# mettez les utilisateurs de votre réseau (éventuellement
*)
lock_userallow = "olivier,veronique"
# Accept KILL requests when locked and kill connection when the last
KILL lock
# is released?
lock_pendingkill = false
# How fast is your modem, this is a hack so that it will return a
value
# for the connection speed if it can not obtain it from the chat
script.
# Sous Windows vous verrez la vitesse de connexion, s'il n'arrive
pas à la déterminer,
# par défaut il va afficher celle-ci
cspeed = 57600
# The default kill action, this must be a script that will kill your
connection
# regardless of which one is active, the default is internal and
you probably
# shouldn't change it
kill = "internal"
# The signal to use when killing PPPD for an internal shutdown method,
you
# need to preface it with a - since this is the second argument
to the kill
# command
killsig = "-TERM"
# How long will we try to look at the PPPD logfile before giving
up?
logtimeout = 120
# How long after doing something to the connection should we
wait to try a
# stat method?
statwait = 2
# What should we do to parse the logfile to give interactive output?
# Valid options are pppd, ipppd, pap, or none.
parselog = pppd
# Should we check for the speed, or just use the cspeed variable?
speedsearch = true
# What indicates a modem speed. This was originally hardcoded,
most people
# should not have a need to change it, but if your modem returns
something
# different you may need too. You should put them in descending
order.
validspeed = "128000,112000,64000,57333,56000,54666,54667,54000,53333,52000,50666,50667,50000,49333,48000,46666,46667,46000,45333,44000,42666,42667,42000,41333,40000,38000,37333,36000,34000,33333,32000,31200,28800,26400,24000,12600,19200,16800,14400,12000,9600,7200,4800,2400,1200,300,110,ARQ,V34,V90,LAPM,V42,V90,V120"
# What should we look for in the logfile to decide what a (I)PPPD
string is?
# If you have a normal modem this is most probably "pppd[", however
if you use
# IPPPD this may be "pppd[" or "ipppd[".
pppdstr = "pppd["
# What should we look for in the logfile to decide what a chat string
is?
# I don't know why you would want to change this, but put it in
for
# completeness since you can select the pppd string.
chatstr = "chat["
# What is an identifying feature of your modems connect string.
Most say
# CONNECT, but I have been told CARRIER crops up as well.
connectstr = "CONNECT"
# What file contains the username/password combinations. It
is in the format of
# /etc/passwd. You might want to choose something else as
your file since
# transmitting unix passwords over the network in the clear is a
bad thing.
# You can use the provided authgen utility to setup an authorization
file.
# si vous mettez en place une authentification par login/mot de
passe
# il faut indiquer ici le fichier qui va bien
authfile = "/etc/passwd"
# Should we use shadow passwords? This requires that you run
the daemon as
# root and that you use the account names in /etc/passwd.
This is probably
# not as good as a separate authorization file because the passwords
are being
# sent over the network, but it is convenient. If you use
this option the
# authfile will be ignored and the server will use the functions
in shadow.h!
# si vous avez mis en place les shadows passwd mettre true
shadow = false
# Should we use PAM (Pluggable Authentication Modules) to authenticate?
This
# If you use this option the authfile will be ignored and the server
will use
# the PAM system. This requires that you run the daemon as
root and provide a
# valid PAM configuration file for mserver. An example PAM
file is
# distributed with mserver, and is normally placed in /etc/pam.d/mserver.
# This option is ignored if you compiled mserver without PAM support.
# This option will take precedence over shadow, and any other authorization
# configuration!
# si vous avez mis en place PAM, mettez true ici
pamauth = false
# Should we allow only valid users to perform the who command?
This in theory
# could provide information to nasty people, but your blocking this
port to the
# outside world anyway (or you should be).
whoauth = false
# Require valid authentication to do any manipulations? (You can
achieve this
# that is * would be only validated users, not any user if set to
true,
# other wise anyone can dial!)
reqauth = false
# What script should we run just after a client connects?
# The argument is the client hostname
# ici c'est le script qui va être lancé quand le client
va se connecter
# sur le serveur linux (et non pas chez le FAI)
# j'ai laissé la valeur par défaut, à tout
hasard j'ai créé un fichier du
# même nom mais vide
clientup = "/usr/local/share/mserver/clientup"
# What script should we run just after a client disconnects?
# The argument is the client hostname
# script à appeler lors d'une déconnexion du poste
client du poste linux
# et non pas du FAI
# j'ai laissé la valeur par défaut, à tout
hasard j'ai créé un fichier du
# même nom mais vide
clientdown = "/usr/local/share/mserver/clientdown"
# What script should we run just after a user authenticates?
# The argument is the client hostname and username
#script à lancer lors de l'authentification sur le poste
linux
# j'ai laissé la valeur par défaut, à tout
hasard j'ai créé un fichier du
# même nom mais vide
authup = "/usr/local/share/mserver/authup"
# What script should we run just after a client unauthenticates?
# The argument is the cleint hostname and username
# j'ai laissé la valeur par défaut, à tout
hasard j'ai créé un fichier du
# même nom mais vide
authdown = "/usr/local/share/mserver/authdown"
# What script should we run after the link has been brought up?
# This can be specified on a per connection basis.
# The argument is the connection's name
# script à lancer quand une connexion PPP est établie,
le script
# standard est ip-up (voir page connexion PPP
à la main)
linkup = "/etc/ppp/ip-up"
# What script should we run right before the link has been intentionally
brought
# down?
# script à appeler juste avant la deconnexion,
# traditionnellement ip-down (voir page connexion
PPP à la main)
prekill = "/etc/ppp/ip-down"
# What script should we run after the link has been intentionally
brought down?
# script à appeler juste après la déconnexion
du FAI
# j'ai laissé la valeur par défaut, à tout
hasard j'ai créé un fichier du
# même nom mais vide
linkdown = "/usr/local/share/mserver/linkdown"
# how long do we allow a silent client ? (default = 0 = no timeout)
client_timeout = 0
# Which connection do you want mserver to auto-dial?
# comment this out if you don't want it to auto-dial.
#autodial "VillageNet(Balder)"
# What are the names of our connections? The order that they
are listed
# is the order that LIST will use, the first one is the default
connection
# for some clients.
# on indique ici les connexion possibles
cname = "fnac,liberty"
# Actually Define our connections
# What is the command you use to bring up the connection, this can
be a script
# or you can call pppd directly.
# script à lancer pour lancer une connexion sur la fnac (voir
page connexion PPP à la main)
fnac_script = "/etc/ppp/ppp-on fnac"
# What IP addresses are allowed to manipulate this connection.
You are allowed
# up to 10 different masks separated by colons. You must either
use the real
# numbers or a '*' to match any in each quad. You must specify
all of the quads# that is '*' wouldn't work but '*.*.*.*' would.
# adresses IP des postes réseau autorisés à
se connecter avec la fnac
fnac_ipallow = "192.168.1.*:127.0.0.1"
# What users are allowed to dial out this connection? "*" or "" will
allow any
# user to dial out, otherwise provide a comma separated list of
users.
# This is a string that is displayed when CINFO is called, it isn't
actually
# used for any dialing, but just for cosmetics. The clients
may eventually
# depend on this so I suggest setting it.
# ch'tit commentaire
fnac_info = "Connexion à la fnac"
# The internal kill method is much more reliable unless you have
something wierd# you should really use it!
# j'ai laissé ça en commentaire, visiblement c'est
pas utile
# fnac_kill = "/etc/ppp/ppp-off"
# The per connection netdev, this is only needed for the netdev stat
method
# it defaults to the value of netdev.
# nom du device ppp0 utilisé
fnac_netdev = "ppp0"
# The per connection checkhost, this is only needed for the exitcode
stat method
# it defaults to the value of checkhost.
# adresse IP d'une machine sur internet à pinguer pour voir
si on est connecté
fnac_checkhost = "194.149.160.9"
# Which method of parsing the logfile should we use for this connection?
# j'ai laissé ça par défaut
fnac_parselog = "pap"
# Another connection
# définition de la connexion liberty
liberty_script = "/etc/ppp/ppp-on liberty"
liberty_info = "Connexion à Liberty"
liberty_checkhost = "194.149.160.9"
liberty_ipallow = "127.0.0.1:192.168.1.*"
# Yet Another Connection
# vous définissez toutes les connexions que vous voulez
#VillageNet(Balder)_script = "/sbin/ifup balder"
#VillageNet(Balder)_info = "balder.villagenet.com"
#VillageNet(Balder)_checkhost = "205.136.35.149"
#VillageNet(Balder)_ipallow = "127.0.0.1:192.168.1.*"
# What users are allowed to do what?
userallow = "olivier" # This guy can do anything
userallow_connect = "*" # Anyone can connect
userallow_disconnect = "*" # Anyone can disconnect
Voilà on a fini avec la config de mserver, maintenant il faut déclarer le port que le daemon va "écouter" pour attendre les demandes de connexion/deconnexion. Voilà les lignes à rajouter ( a priori, c'est fait automatiquement à l'install mais vérifier quand même) dans le fichier /etc/services.
masqdialer 224/tcp
masqdialer # added by c-mserver
masqdialer 224/udp
masqdialer # added by c-mserver
/usr/sbin/mserver -v -c /etc/mserver.conf
La première chose à faire est de lancer une connexion puis de tapez route:
[root@tavel /root]# route
Table de routage IP du noyau
Destination Passerelle
Genmask
Indic Metric Ref Use Iface
192.168.1.10 *
255.255.255.255 UH 0
0 0 eth0
192.168.0.2 *
255.255.255.255 UH 0
0 0 sl0
194.149.178.2 *
255.255.255.255 UH 0
0 0 ppp0
192.168.1.0 *
255.255.255.0 U
0 0
0 eth0
127.0.0.0
*
255.0.0.0
U 0 0
0 lo
default
194.149.178.2 0.0.0.0
UG 0 0
0 ppp0
default
192.168.1.10 0.0.0.0
UG 0 0
0 eth0
default
*
0.0.0.0
U 1 0
0 sl0
192.168.1.10 est votre adresse IP privé, 194.149.178.2 qu'on
retrouve au niveau de la colonne passerelle est l'adresse IP de routage
de votre fai, toutes vos requêtes vont passées par cette adresse,
notez bien cette adresse dans un coin.
On crée un script connect-demand, qu'on place dans /usr/bin,
voici son contenu:
#!/bin/bash
# script contenant les paramètres de connexion
DIALER_SCRIPT=/etc/ppp/ppp-on-dialer
# nom du device ppp
DEVICE=ppp0
# port de branchement du modem, ttyS0 port série 1
MODEM=/dev/ttyS0
# options pppd voir page connexion PPP à
la main pour plus de détails
PPPOPTIONS="lock modem crtscts asyncmap 00000000 defaultroute debug"
exec /usr/sbin/pppd -detach $PPPOPTIONS $MODEM 115200 \
remotename $DEVICE ipparam $DEVICE idle 60 demand
0.0.0.0:194.149.178.2 \
connect "/usr/sbin/chat -v -f $DIALER_SCRIPT"
Pour info 115200 est la vitesse de connexion, idle 60 (chiffre en seconde) permet de stopper la connexion au bout de 60 secondes d'inactivité. Le fichier /etc/ppp/ppp-on-dialer est identique à celui décrit dans la page connexion PPP à la main. Rendez ce fichier exécutable (chmod 755 /usr/bin/connect-demand).
/usr/bin/connect-demand &
ATTENTION N'oubliez surtout pas le & (lancement en mode background) sinon ça bloque le boot !!
Ca y est c'est fini, dès qu'on voudra aller sur le net (du poste linux ou du poste client) la connexion va se lancer automatiquement.
NOTE J'ai configuré la page d'accueil de Netscape avec le nom de la machine (page d'accueil d'Apache), au lancement de Netscape, une connexion automatique est déclenchée ! Pourtant dans le fichier /etc/nsswitch.conf j'ai bien l'ordre de recherche des hosts avec d'abord /etc/hosts puis les serveurs DNS du fai (hosts: files dns).
WinMasqDialer se récupère à l'adresse
206.31.99.95/masq,
c'est un zip qui contient un exe unique et quelques fichiers de ressources
(icônes, mais pas de dll ou autres).
Voici à droite un screenshot, il suffit d'indiquer l'adresse IP (dans le champ Name/IP) ou le nom de votre serveur linux, le numéro du port (224 par défaut). Quand on se connecte au serveur linux, on a alors la liste des connexions possibles (dans mon cas fnac et liberty). Pour lancer une connexion, il suffit d'en choisir une, puis de cliquer sur Dial, on a alors le débit de connexion et une idée du trafic. Pour stopper la connexion, le bouton Dial se transforme en bouton Hangup, il suffit de cliquer dessus. A noter que lors d'une connexion, on a des petites icônes dans la barre de tâche windows en bas à droite. |
![]() |
|
![]() |
WinMClient peut se trouver à l'adresse www.buffnet.net/~millard/winclient.html,
c'est un fichier zip qui contient un exécutable unique.
A gauche un screenshot, le bouton Connect permet de se connecter au serveur linux et d'avoir la liste des connexions possibles. Dial permet de se connecter après avoir choisi son FAI et Hangup permet de raccrocher. |
|
Voilà la configuration de WinMClient quand on clique sur l'onglet Config, on doit indiquer le nom du serveur linux (ou son adresse IP) ainsi que le port, vous pouvez choisir l'authentification et éventuellement d'autres paramètres, la config peut être sauvegardée. | ![]() |
Dans le cas de pppd
Vous n'avez strictement rien à configurer, il suffit d'inscrire
une URL quelconque dans un navigateur, de taper enter et c'est parti la
connexion se lance, au bout d'un certain temps (défini dans le script
de connexion) d'inactivité la connexion est automatiquement coupée.
![]() |