OpenBSD Simple

Un article de Toulouse Sans Fil, un réseau wifi libre sur Toulouse.

Accueil | Technique | Réalisations simplifiées | OpenBSD Simple


Image:Travaux.gif Cette page est actuellement en travaux.
Merci de ne pas l'éditer pour le moment.
Sommaire

Contact dans TSF

Grompf, joignable via la mailing-list et via IRC sur freenode.net canal #tsf.

Description

Il s'agit ici de la description d'une installation et de l'adaptation d'un OpenBSD sur une machine supportée par cet OS. Tout à été testé sur un PC à base de VIA EPIA 5000, sur une SUN SPARCSTATION 20, avec OpenBSD 3.8. Seules les dénominations des interfaces réseau affectées au WIFI changent : ici seule sera décrite l'installation et la configuration d'un PC doté d'une carte PCI 802.11b avec chipset prism.

Installation

Il s'agit dans un premier temps de suivre le manuel d'installation pas à pas, chose qui ne sera pas décrite une nouvelle fois ici. Il suffit de se reporter sur le site d'OpenBSD (http://www.openbsd.org) pour obtenir tous les renseignements spécifiques à l'architecture utilisée.

Selon les machines et les architectures, vous serez certainement amenés faire quelques adaptions à la configuration de base pour obtenir un support matériel satisfaisant. Ces réglages spécifiques ne seront pas non plus détaillés ici.

Une fois la base logicielle installée, y compris les pages de manuel et les compilateurs, tout ce qui est strictement nécessaire est en fait disponible dès le premier reboot.

Voila... il n'y a rien de sorcier, juste savoir lire de façon à pouvoir accéder au manuel d'installation et surtout à la FAQ.

Il est à noter que les CDROMs ne sont pas disponibles sous forme d'ISO et que ce sont les seuls éléments de l'OS qui soient copyrightés de façon ferme : ces CDROMs ne sont pas copiables tels quels mais chacun peut accéder aux differents packages via l'internet. Si vous êtes utilisateur (utilisatrice) assidu(e) de cet OS, songez à acheter ces CDROMs qui constituent le moyen financiers majeurs du projet : les distributeurs européens sont fiables.

Adaptation

Premier utilisateur & sudo

Il est cependant conseillé de créer au moins un utilisateur avec la commande adduser (http://www.openbsd.org/cgi-bin/man.cgi?query=adduser&apropos=0&sektion=0&manpath=OpenBSD+Current&arch=i386&format=html) et de lui donner les droits suffisants pour travailler avec sudo (http://www.openbsd.org/cgi-bin/man.cgi?query=sudo&apropos=0&sektion=0&manpath=OpenBSD+Current&arch=i386&format=html). Ici aussi tout est préconfiguré, il n'y a plus qu'a décommenter ou ajouter les lignes qui vous conviennent dans /etc/sudoers à l'aide de visudo (http://www.openbsd.org/cgi-bin/man.cgi?query=visudo&apropos=0&sektion=0&manpath=OpenBSD+Current&arch=i386&format=html).

/etc/rc.conf et /etc/rc.conf.local

La premiere chose à faire dans la reconfiguration d'un OpenBSD est de copier le fichier /etc/rc.conf (http://www.openbsd.org/cgi-bin/man.cgi?query=rc.conf&apropos=0&sektion=0&manpath=OpenBSD+Current&arch=i386&format=html) en /etc/rc.conf.local (http://www.openbsd.org/cgi-bin/man.cgi?query=rc.conf.local&apropos=0&sektion=0&manpath=OpenBSD+Current&arch=i386&format=html) dans lequel seront fait tous les changements associés aux lancement des services sur la machine. /etc/rc.conf restera dans son état initial pour plus de sécurité.

Dans le nouvel /etc/rc.conf.local (http://www.openbsd.org/cgi-bin/man.cgi?query=rc.conf.local&apropos=0&sektion=0&manpath=OpenBSD+Current&arch=i386&format=html), il faudra ensuite supprimer les lignes à la fin du fichier qui incluaient le fichier /etc/rc.conf.local sinon il se formera une boucle infinie d'inclusion du fichier qui ne s'arretera que par dépassement d'allocation de mémoire autorisée.

L'activation ou la désactivation des divers services disponibles dès la première installation est laissée à votre libre arbitre.

La lecture de man afterboot (http://www.openbsd.org/cgi-bin/man.cgi?query=afterboot&apropos=0&sektion=0&manpath=OpenBSD+Current&arch=i386&format=html) est conseillée à tous... débutants ou non.

Déclaration de la carte wifi

Pour peut que la carte WIFI soit supportée par l'OS, il n'y a juste qu'à la configurer. Ici l'accès à une carte prism se fait par le driver wi. Dans l'exemple qui suit la machine s'appelle Tyrann et a l'adresse IP 10.31.0.21, netmask 255.255.0.0. Il suffit pour mettre en place cette interface WIFI d'éditer le fichier /etc/hostname.wi0 de la façon indiquée pour configurer l'adresse mais aussi pour automatiquement executer des commande auxiliaire configurant le driver lui même (man wicontrol (http://www.openbsd.org/cgi-bin/man.cgi?query=wicontrol&apropos=0&sektion=0&manpath=OpenBSD+Current&arch=i386&format=html)).

La syntaxe a utiliser pour ecrire ce fichier est consultable dans la page man hostname.if (http://www.openbsd.org/cgi-bin/man.cgi?query=hostname.if&apropos=0&sektion=0&manpath=OpenBSD+Current&arch=i386&format=html). Les spécificités du driver sont décrites dans la page man wi  (http://www.openbsd.org/cgi-bin/man.cgi?query=wi&apropos=0&sektion=0&manpath=OpenBSD+Current&arch=i386&format=html).

/etc/hostname.wi0

inet 10.31.0.21 255.255.0.0 NONE                  # Set IP parameters
!wicontrol \$if -n toulouse-sans-fil.net        # Set Network name
!wicontrol \$if -s tyrann                       # Set Station name
!wicontrol \$if -p 4                            # Set to ad-hoc/IBSS
!wicontrol \$if -f 5                            # Set channel

OLSR.ORG

Configuration

A Faire.

  • compilation d'OLSR version 0.4.10 : ok.
  • compilation des plug-ins : ko, présence d'un probleme dans la gestion de ldconfig qui met la grouille dans les PATH des librairies. Il m'a fallu retirer l'appel de ldconfig dans le fichier Makefile.obsd.

/etc/olsrd.conf

  • Il faut voir comment faire un couplage propre avec internet pour la question des DNS. (traitement de /etc/resolv.conf, car besoin de plus de machine que ce qui m'est disponible pour traiter de la chose correctement)
  • Il faut aussi voir ce qui va se faire au niveau qualité des liens (HYST ou LQ)
  • Ce fichier est aussi disponible à l'adresse ftp://toulouse-sans-fil.net/files/olsrd.conf
#
# olsr.org OLSR daemon config file
#
# Lines starting with a # are discarded
#
# This file was shipped with olsrd 0.X.X
#

# Debug level(0-9)
# If set to 0 the daemon runs in the background

DebugLevel      0

# IP version to use (4 or 6)

IpVersion       4

# Clear the screen each time the internal state changes 

ClearScreen     yes

# HNA IPv4 routes
# syntax: netaddr netmask
# Example Internet gateway:
# 0.0.0.0 0.0.0.0

Hna4
{
#   Internet gateway:
#   0.0.0.0      0.0.0.0
#   more entries can be added:
#   192.168.1.0  255.255.255.0
}

# HNA IPv6 routes
# syntax: netaddr prefix
# Example Internet gateway:
Hna6
{
#   Internet gateway:
#   ::              0
#   more entries can be added:
#   fec0:2200:106:: 48
}


# Should olsrd keep on running even if there are
# no interfaces available? This is a good idea
# for a PCMCIA/USB hotswap environment.
# "yes" OR "no"

AllowNoInt      yes

# TOS(type of service) value for
# the IP header of control traffic.
# If not set it will default to 16

#TosValue       16

# The fixed willingness to use(0-7)
# If not set willingness will be calculated
# dynamically based on battery/power status
# if such information is available

#Willingness            4

# Allow processes like the GUI front-end
# to connect to the daemon.

IpcConnect
{
    # Determines how many simultaneously
    # IPC connections that will be allowed
    # Setting this to 0 disables IPC

    MaxConnections  0

    # By default only 127.0.0.1 is allowed
    # to connect. Here allowed hosts can
    # be added

    Host            127.0.0.1
    #Host            10.0.0.5

    # You can also specify entire net-ranges 
    # that are allowed to connect. Multiple
    # entries are allowed

    #Net             192.168.1.0 255.255.255.0     
}

# Whether to use hysteresis or not
# Hysteresis adds more robustness to the
# link sensing but delays neighbor registration.
# Used by default. 'yes' or 'no'

UseHysteresis   yes

# Hysteresis parameters
# Do not alter these unless you know 
# what you are doing!
# Set to auto by default. Allowed
# values are floating point values
# in the interval 0,1
# THR_LOW must always be lower than
# THR_HIGH.

HystScaling     0.50
HystThrHigh     0.80
HystThrLow      0.30


# Link quality level
# 0 = do not use link quality
# 1 = use link quality for MPR selection
# 2 = use link quality for MPR selection and routing
# Defaults to 0

#LinkQualityLevel       0

# Link quality window size
# Defaults to 10

#LinkQualityWinSize     10

# Polling rate in seconds(float). 
# Default value 0.05 sec

Pollrate        0.05


# TC redundancy
# Specifies how much neighbor info should
# be sent in TC messages
# Possible values are:
# 0 - only send MPR selectors
# 1 - send MPR selectors and MPRs
# 2 - send all neighbors
#
# defaults to 0

#TcRedundancy   0


#
# MPR coverage
# Specifies how many MPRs a node should
# try select to reach every 2 hop neighbor
#
# Can be set to any integer >0
#
# defaults to 1

#MprCoverage    1


# Olsrd plugins to load
# This must be the absolute path to the file
# or the loader will use the following scheme:
# - Try the paths in the LD_LIBRARY_PATH 
#   environment variable.
# - The list of libraries cached in /etc/ld.so.cache
# - /lib, followed by /usr/lib

# Example plugin entry with parameters: 

#LoadPlugin "olsrd_dyn_gw.so.0.3"
#{
   # Here parameters are set to be sent to the
   # plugin. Theese are on the form "key" "value".
   # Parameters ofcause, differs from plugin to plugin.
   # Consult the documentation of your plugin for details.

   # Example: dyn_gw params

   # how often to check for Internet connectivity
   # defaults to 5 secs
#   PlParam     "Interval"   "40"
   
   # if one or more IPv4 addresses are given, do a ping on these in
   # descending order to validate that there is not only an entry in
   # routing table, but also a real internet connection. If any of
   # these addresses could be pinged successfully, the test was
   # succesful, i.e. if the ping on the 1st address was successful,the
   # 2nd won't be pinged
#   PlParam     "Ping"       "141.1.1.1"
#   PlParam     "Ping"       "194.25.2.129"
#}

LoadPlugin "olsrd_httpinfo.so.0.1"
{
    PlParam     "port"   "42080"
    PlParam     "Net"    "10.31.0.0 255.255.0.0"
    PlParam     "Net"    "192.168.1.0 255.255.255.0"
}

LoadPlugin "olsrd_nameservice.so.0.2"
{
       PlParam "name" "Tyrann"                         # node name
       PlParam "suffix" ".olsr"                        # suffix for OLSR nodes
       PlParam "hosts-file" "/var/run/hosts_olsrd"     # read by dnsmasq
       PlParam "resolv-file" "/etc/resolv.conf"        # writen by daemon
       PlParam "dns-server" "10.31.0.21"               # announce DNS server
}


# Interfaces and their rules
# Omitted options will be set to the
# default values. Multiple interfaces
# can be specified in the same block
# and multiple blocks can be set.

# !!CHANGE THE INTERFACE LABEL(s) TO MATCH YOUR INTERFACE(s)!!
# (eg. wlan0 or eth1):

# Interface "XXX" "YYY"
Interface "wi0" 
{

   # IPv4 broadcast address to use. The
   # one usefull example would be 2 55.255.255.255
   # If not defined the broadcastaddress
   # every card is configured with is used

   # Ip4Broadcast              255.255.255.255

   # IPv6 address scope to use.
   # Must be 'site-local' or 'global'

   # Ip6AddrType               site-local

   # IPv6 multicast address to use when
   # using site-local addresses.
   # If not defined, ff05::15 is used

   # Ip6MulticastSite          ff05::11

   # IPv6 multicast address to use when
   # using global addresses
   # If not defined, ff0e::1 is used

   # Ip6MulticastGlobal        ff0e::1


   # Emission intervals.
   # If not defined, RFC proposed values will
   # be used in most cases.

   # Hello interval in seconds(float)
   # HelloInterval    2.0

   # HELLO validity time
   # HelloValidityTime 6.0

   # TC interval in seconds(float)
   # TcInterval        5.0

   # TC validity time
   # TcValidityTime    15.0

   # MID interval in seconds(float)
   # MidInterval       5.0

   # MID validity time
   # MidValidityTime   15.0

   # HNA interval in seconds(float)
   # HnaInterval       5.0

   # HNA validity time
   # HnaValidityTime   15.0

   # When multiple links exist between hosts
   # the weight of interface is used to determine
   # the link to use. Normally the weight is
   # automatically calculated by olsrd based
   # on the characteristics of the interface,
   # but here you can specify a fixed value.
   # Olsrd will choose links with the lowest value.

   # Weight 0


}

DNSmasq

Configuration

A faire.

/etc/dnsmasq.conf

# Configuration file for dnsmasq.
#
# Format is one option per line, legal options are the same
# as the long options legal on the command line. See
# "/usr/sbin/dnsmasq --help" or "man 8 dnsmasq" for details.

# The following two options make you a better netizen, since they
# tell dnsmasq to filter out queries which the public DNS cannot
# answer, and which load the servers (especially the root servers)
# uneccessarily. If you have a dial-on-demand link they also stop
# these requests from bringing up the link uneccessarily.

# Never forward plain names (without a dot or domain part)
domain-needed
# Never forward addresses in the non-routed address spaces.
bogus-priv


# Uncomment this to filter useless windows-originated DNS requests
# which can trigger dial-on-demand links needlessly.
# Note that (amongst other things) this blocks all SRV requests,
# so don't use it if you use eg Kerberos.
# This option only affects forwarding, SRV records originating for
# dnsmasq (via srv-host= lines) are not suppressed by it.
#filterwin2k

# Change this line if you want dns to get its upstream servers from
# somewhere other that /etc/resolv.conf
#resolv-file=

# By  default,  dnsmasq  will  send queries to any of the upstream
# servers it knows about and tries to favour servers to are  known
# to  be  up.  Uncommenting this forces dnsmasq to try each query
# with  each  server  strictly  in  the  order  they   appear   in
# /etc/resolv.conf
#strict-order

# If you don't want dnsmasq to read /etc/resolv.conf or any other
# file, getting its servers from this file instead (see below), then
# uncomment this
#no-resolv

# If you don't want dnsmasq to poll /etc/resolv.conf or other resolv
# files for changes and re-read them then uncomment this.
#no-poll

# Add other name servers here, with domain specs if they are for
# non-public domains.
#server=/localnet/192.168.0.1 

# Add local-only domains here, queries in these domains are answered
# from /etc/hosts or DHCP only.
#local=/localnet/ 

# Add domains which you want to force to an IP address here.
# The example below send any host in doubleclick.net to a local
# webserver.
#address=/doubleclick.net/127.0.0.1 

# If you want dnsmasq to change uid and gid to something other
# than the default, edit the following lines.
user=nobody
group=nobody 

# If you want dnsmasq to listen for DHCP and DNS requests only on
# specified interfaces (and the loopback) give the name of the
# interface (eg eth0) here.
# Repeat the line for more than one interface.
#interface=wi0
# Or you can specify which interface _not_ to listen on
#except-interface=
# Or which to listen on by address (remember to include 127.0.0.1 if
# you use this.)
listen-address=127.0.0.1
listen-address=10.31.0.21
# If you want dnsmasq to provide only DNS service on an interface,
# configure it as shown above, and then use the following line to
# disable DHCP on it.
no-dhcp-interface=wi0 

# On systems which support it, dnsmasq binds the wildcard address,
# even when it is listening on only some interfaces. It then discards
# requests that it shouldn't reply to. This has the advantage of
# working even when interfaces come and go and change address. If you
# want dnsmasq to really bind only the interfaces it is listening on,
# uncomment this option. About the only time you may need this is when
# running another nameserver on the same machine.
#bind-interfaces

# If you don't want dnsmasq to read /etc/hosts, uncomment the
# following line.
#no-hosts
# or if you want it to read another file, as well as /etc/hosts, use
# this.
addn-hosts=/var/run/hosts_olsrd

# Set this (and domain: see below) if you want to have a domain
# automatically added to simple names in a hosts-file.
#expand-hosts

# Set the domain for dnsmasq. this is optional, but if it is set, it
# does the following things.
# 1) Allows DHCP hosts to have fully qualified domain names, as long
#     as the domain part matches this setting.
# 2) Sets the "domain" DHCP option thereby potentially setting the
#    domain of all systems configured by DHCP
# 3) Provides the domain part for "expand-hosts"
domain=toulouse-sans-fil.tsf

# Uncomment this to enable the integrated DHCP server, you need
# to supply the range of addresses available for lease and optionally
# a lease time. If you have more than one network, you will need to
# repeat this for each network on which you want to supply DHCP
# service.
#dhcp-range=192.168.0.50,192.168.0.150,12h

# This is an example of a DHCP range where the netmask is given. This
# is needed for networks we reach the dnsmasq DHCP server via a relay
# agent. If you don't know what a DHCP relay agent is, you probably
# don't need to worry about this.
#dhcp-range=192.168.0.50,192.168.0.150,255.255.255.0,12h

# This is an example of a DHCP range with a network-id, so that
# some DHCP options may be set only for this network.
#dhcp-range=red,192.168.0.50,192.168.0.150

# Supply parameters for specified hosts using DHCP. There are lots
# of valid alternatives, so we will give examples of each. Note that
# IP addresses DO NOT have to be in the range given above, they just
# need to be on the same network. The order of the parameters in these
# do not matter, it's permissble to give name,adddress and MAC in any order

# Always allocate the host with ethernet address 11:22:33:44:55:66
# The IP address 192.168.0.60
#dhcp-host=11:22:33:44:55:66,192.168.0.60

# Always set the name of the host with hardware address
# 11:22:33:44:55:66 to be "fred"
#dhcp-host=11:22:33:44:55:66,fred

# Always give the host with ethernet address 11:22:33:44:55:66
# the name fred and IP address 192.168.0.60 and lease time 45 minutes
#dhcp-host=11:22:33:44:55:66,fred,192.168.0.60,45m

# Give the machine which says it's name is "bert" IP address
# 192.168.0.70 and an infinite lease
#dhcp-host=bert,192.168.0.70,infinite

# Always give the host with client identifier 01:02:02:04
# the IP address 192.168.0.60
#dhcp-host=id:01:02:02:04,192.168.0.60

# Always give the host with client identifier "marjorie"
# the IP address 192.168.0.60
#dhcp-host=id:marjorie,192.168.0.60

# Enable the address given for "judge" in /etc/hosts
# to be given to a machine presenting the name "judge" when
# it asks for a DHCP lease.
#dhcp-host=judge

# Never offer DHCP service to a machine whose ethernet
# address is 11:22:33:44:55:66
#dhcp-host=11:22:33:44:55:66,ignore

# Ignore any client-id presented by the machine with ethernet
# address 11:22:33:44:55:66. This is useful to prevent a machine
# being treated differently when running under different OS's or
# between PXE boot and OS boot.
#dhcp-host=11:22:33:44:55:66,id:*

# Send extra options which are tagged as "red" to
# the machine with ethernet address 11:22:33:44:55:66
#dhcp-host=11:22:33:44:55:66,net:red

# Send extra options which are tagged as "red" to
# any machine with ethernet address starting 11:22:33:
#dhcp-host=11:22:33:*:*:*,net:red

# Send extra options which are tagged as "red" to any machine whose
# DHCP vendorclass string includes the substring "Linux"
#dhcp-vendorclass=red,Linux

# Send extra options which are tagged as "red" to any machine one
# of whose DHCP userclass strings includes the substring "accounts"
#dhcp-userclass=red,accounts

# If this line is uncommented, dnsmasq will read /etc/ethers and act
# on the ethernet-address/IP pairs found there just as if they had
# been given as --dhcp-host options. Useful if you keep
# MAC-address/host mappings there for other purposes.
#read-ethers

# Send options to hosts which ask for a DHCP lease.
# See RFC 2132 for details of available options.
# Note that all the common settings, such as netmask and
# broadcast address, DNS server and default route, are given
# sane defaults by dnsmasq. You very likely will not need any
# any dhcp-options. If you use Windows clients and Samba, there
# are some options which are recommended, they are detailed at the
# end of this section.
# For reference, the common options are:
# subnet mask - 1
# default router - 3
# DNS server - 6
# broadcast address - 28

# Set the NTP time server addresses to 192.168.0.4 and 10.10.0.5
#dhcp-option=42,192.168.0.4,10.10.0.5

# Set the NTP time server address to be the same machine as
# is running dnsmasq
#dhcp-option=42,0.0.0.0

# Set the NIS domain name to "welly"
#dhcp-option=40,welly

# Set the default time-to-live to 50
#dhcp-option=23,50

# Set the "all subnets are local" flag
#dhcp-option=27,1

# Send the etherboot magic flag and then etherboot options (a string).
#dhcp-option=128,e4:45:74:68:00:00
#dhcp-option=129,NIC=eepro100

# Specify an option which will only be sent to the "red" network
# (see dhcp-range for the declaration of the "red" network)
#dhcp-option=red,42,192.168.1.1

# The following DHCP options set up dnsmasq in the same way as is specified
# for the ISC dhcpcd in
# http://www.samba.org/samba/ftp/docs/textdocs/DHCP-Server-Configuration.txt
# adapted for a typical dnsmasq installation where the host running
# dnsmasq is also the host running samba.
# you may want to uncomment them if you use Windows clients and Samba.
#dhcp-option=19,0           # option ip-forwarding off
#dhcp-option=44,0.0.0.0     # set netbios-over-TCP/IP nameserver(s) aka WINS server(s)
#dhcp-option=45,0.0.0.0     # netbios datagram distribution server
#dhcp-option=46,8           # netbios node type
#dhcp-option=47             # empty netbios scope.

# Send RFC-3397 DNS domain search DHCP option. WARNING: Your DHCP client
# probably doesn't support this......
#dhcp-option=119,eng.apple.com,marketing.apple.com

# Send encapsulated vendor-class specific options. The vendor-class
# is sent as DHCP option 60, and all the options marked with the
# vendor class are send encapsulated in DHCP option 43. The meaning of
# the options is defined by the vendor-class. This example sets the
# mtftp address to 0.0.0.0 for PXEClients
#dhcp-option=vendor:PXEClient,1,0.0.0.0

# Set the boot filename and tftpd server name and address
# for BOOTP. You will only need this is you want to
# boot machines over the network.
#dhcp-boot=/var/ftpd/pxelinux.0,boothost,192.168.0.3

# Set the limit on DHCP leases, the default is 150
#dhcp-lease-max=150

# The DHCP server needs somewhere on disk to keep its lease database.
# This defaults to a sane location, but if you want to change it, use
# the line below.
#dhcp-leasefile=/var/lib/misc/dnsmasq.leases

# Set the DHCP server to authoritative mode. In this mode it will barge in
# and take over the lease for any client which broadcasts on the network,
# whether it has a record of the lease or not. This avoids long timeouts
# when a machine wakes up on a new network. DO NOT enable this if there's
# the slighest chance that you might end up accidentally configuring a DHCP
# server for your campus/company accidentally. The ISC server uses the same
# the same option, and this URL provides more information:
# http://www.isc.org/index.pl?/sw/dhcp/authoritative.php
#dhcp-authoritative

# Set the cachesize here.
#cache-size=150

# If you want to disable negative caching, uncomment this.
#no-negcache

# Normally responses which come form /etc/hosts and the DHCP lease
# file have Time-To-Live set as zero, which conventionally means
# do not cache further. If you are happy to trade lower load on the
# server for potentially stale date, you can set a time-to-live (in
# seconds) here.
#local-ttl=

# If you want dnsmasq to detect attempts by Verisign to send queries
# to unregistered .com and .net hosts to its sitefinder service and
# have dnsmasq instead return the correct NXDOMAIN response, uncomment
# this line. You can add similar lines to do the same for other
# registries which have implemented wildcard A records.
#bogus-nxdomain=64.94.110.11

# If you want to fix up DNS results from upstream servers, use the
# alias option. This only works for IPv4.
# This alias makes a result of 1.2.3.4 appear as 5.6.7.8
#alias=1.2.3.4,5.6.7.8
# and this maps 1.2.3.x to 5.6.7.x
#alias=1.2.3.0,5.6.7.0,255.255.255.0


# Change these lines if you want dnsmasq to serve MX records. 

# Return an MX record named "maildomain.com" with target
# servermachine.com and preference 50
#mx-host=maildomain.com,servermachine.com,50

# Set the default target for MX records created using the localmx option.
#mx-target=servermachine.com

# Return an MX record pointing to the mx-target for all local
# machines.
#localmx

# Return an MX record pointing to itself for all local machines.
#selfmx

# Change the following lines if you want dnsmasq to serve SRV
# records.  These are useful if you want to serve ldap requests for
# Active Directory and other windows-originated DNS requests.
# See RFC 2782.
# You may add multiple srv-host lines.
# The fields are <name>,<target>,<port>,<priority>,<weight>
# If the domain part if missing from the name (so that is just has the
# service and protocol sections) then the domain given by the domain=
# config option is used. (Note that expand-hosts does not need to be
# set for this to work.)

# A SRV record sending LDAP for the example.com domain to
# ldapserver.example.com port 289
#srv-host=_ldap._tcp.example.com,ldapserver.example.com,389

# A SRV record sending LDAP for the example.com domain to
# ldapserver.example.com port 289 (using domain=)
#domain=example.com
#srv-host=_ldap._tcp,ldapserver.example.com,389

# Two SRV records for LDAP, each with different priorities
#srv-host=_ldap._tcp.example.com,ldapserver.example.com,389,1
#srv-host=_ldap._tcp.example.com,ldapserver.example.com,389,2

# A SRV record indicating that there is no LDAP server for the domain
# example.com
#srv-host=_ldap._tcp.example.com


# Change the following lines to enable dnsmasq to serve TXT records.
# These are used for things like SPF and zeroconf. (Note that the
# domain-name expansion done for SRV records _does_not
# occur for TXT records.)

#Example SPF.
#txt-record=example.com,v=spf1 a -all 

#Example zeroconf
#txt-record=_http._tcp.example.com,name=value,paper=A4


# For debugging purposes, log each DNS query as it passes through
# dnsmasq.
#log-queries

# Include a another lot of configuration options.
#conf-file=/etc/dnsmasq.more.conf

OpenVPN

Configuration

A faire.

Attention : actuellement j'ai un problème decompatibilité d'OLSR.ORG avec l'interface tun0 d'OpenBSD.

/etc/openvpn/client.conf

##############################################
# Sample client-side OpenVPN 2.0 config file #
# for connecting to multi-client server.     #
#                                            #
# This configuration can be used by multiple #
# clients, however each client should have   #
# its own cert and key files.                #
#                                            #
# On Windows, you might want to rename this  #
# file so it has a .ovpn extension           #
##############################################

# Specify that we are a client and that we
# will be pulling certain config file directives
# from the server.
client

# Use the same setting as you are using on
# the server.
# On most systems, the VPN will not function
# unless you partially or fully disable
# the firewall for the TUN/TAP interface.
;dev tap0
dev tun0
dev-type tap

# Windows needs the TAP-Win32 adapter name
# from the Network Connections panel
# if you have more than one.  On XP SP2,
# you may need to disable the firewall
# for the TAP adapter.
;dev-node MyTap

# Are we connecting to a TCP or
# UDP server?  Use the same setting as
# on the server.
;proto tcp
proto udp

# The hostname/IP and port of the server.
# You can have multiple remote entries
# to load balance between the servers.
;remote my-server-1 1194
;remote my-server-2 1194
remote 88.160.104.3 1194

# Choose a random host from the remote
# list for load-balancing.  Otherwise
# try hosts in the order specified.
;remote-random

# Keep trying indefinitely to resolve the
# host name of the OpenVPN server.  Very useful
# on machines which are not permanently connected
# to the internet such as laptops.
resolv-retry infinite 

# Most clients don't need to bind to
# a specific local port number.
nobind 

# Downgrade privileges after initialization (non-Windows only)
user nobody
group nobody 

# Try to preserve some state across restarts.
persist-key
persist-tun 

# If you are connecting through an
# HTTP proxy to reach the actual OpenVPN
# server, put the proxy server/IP and
# port number here.  See the man page
# if your proxy server requires
# authentication.
;http-proxy-retry # retry on connection failures
;http-proxy [proxy server] [proxy port #] 

# Wireless networks often produce a lot
# of duplicate packets.  Set this flag
# to silence duplicate packet warnings.
;mute-replay-warnings 

# SSL/TLS parms.
# See the server config file for more
# description.  It's best to use
# a separate .crt/.key file pair
# for each client.  A single ca
# file can be used for all clients.
ca /etc/openvpn/keys/ca.crt
cert /etc/openvpn/keys/grompf.crt
key /etc/openvpn/keys/grompf.key 

# Verify server certificate by checking
# that the certicate has the nsCertType
# field set to "server".  This is an
# important precaution to protect against
# a potential attack discussed here:
#  http://openvpn.net/howto.html#mitm
#
# To use this feature, you will need to generate
# your server certificates with the nsCertType
# field set to "server".  The build-key-server
# script in the easy-rsa folder will do this.
ns-cert-type server

# If a tls-auth key is used on the server
# then every client must also have the key.
;tls-auth ta.key 1

# Select a cryptographic cipher.
# If the cipher option is used on the server
# then you must also specify it here.
;cipher x 

# Enable compression on the VPN link.
# Don't enable this unless it is also
# enabled in the server config file.
comp-lzo 

# Set log file verbosity.
verb 3 

# Silence repeating messages
;mute 20

Automatisation

Afin de permetre un lancement correct à chaque lancement de la machine, il faut ajouter dans le fichier rc.local les trois commandes suivantes, ainsi que les variables de contrôle dans /etc/rc.conf.local.

/etc/rc.local

(script à tester)

# olsr stuff 
if [ X"$(olsrd_flags)" != X"NO"]; then
 if [ -f /usr/local/sbin/olsrd ]; then
         echo 'Starting olsrd'; /usr/local/sbin/olsrd $olsrd_flags
 fi
fi

# dnsmasq stuff
if [ X"$(dnsmasq_flags)" != X"NO"]; then
 if [ -f /usr/local/sbin/dnsmasq ]; then
         echo 'Starting dnsmasq'; /usr/local/sbin/dnsmasq $dnsmasq_flags
 fi
fi

# openvpn stuff
if [ X"$(openvpn_flags)" != X"NO"]; then
 if [ -f /usr/local/sbin/openvpn ]; then
        echo 'Starting openVPN'; /usr/local/sbin/openvpn $openvpn_flags
fi

/etc/rc.conf.local

# Set to NO if olsr shall not be launched at boot time.
olsrd_flags=""         # olsrd activation

# Set to NO if dnsmasq shall not be launched at boot time.
dnsmasq_flags=""       # dnsmasq activation

# Set to NO if OpenVPN shall no be launched at boot time.
openvpn_flags="--daemon --config /etc/openvpn/client.conf --log-append /var/log/openvpn.log" #OpenVPN Activation

Conclusion

Cela marche a peut près et sans grande difficulté majeure. Il reste deux points à éclaircir : le fonctionnement du plugin nameservice (général à toutes les configurations et tous les OS) et l'incompatibilité d'humeur d'OLSR qui rend le VPN inéfficace.