openbsd-config BACK .. OpenBSD - Konfiguration ======================= Eine einfache Konfigurationsanleitung (auch RAID). OpenBSD ist dem NetBSD so aehnlich, das man in vielen Fragen auch das NetBSD-Handbuch zu Rate ziehen kann. Siehe zuerst "man afterboot" Bei Fragen ist "http://groups.google.com/" sehr gut! ############################################################################### # Eine Installationsanleitung zur speziellen Version steht auf dem FTP-Server: ftp://ftp.openbsd.org/pub/OpenBSD/[Version]/i386/INSTALL.i386 ############################################################################### # Als Standart-SHELL die "/bin/ksh" einstellen, da diese in der Basisinstallation schon vorhanden ist und diese SHELL als einzige SHELL aus der Basisinstallation sowohl History als auch Komandozeilenvervollstaendigung (per doppel-[Tab] oder [Strg]+[D]) hat! Allerdings wird die History nicht gespeichert (wie bei der BASH zum Beispiel) so das die History nur fuer die entsprechende Session ist und nach dem auslogge n "vergessen" wird. Tastatureinstellungen: ---------------------- kbd -q de # bis zum Neustart aktiv (kbd -l | less) echo "-q de" >> /etc/kbdtype # dauerhaft aktiv vi /etc/wsconsctl.conf # optional / dauerhaft aktiv SSHD: ----- vi /etc/sshd_config # folgende Zeilen anpassen: >Protocol 2 # ",1" loeschen >ServerKeyBits 2048 # oder hoeher >PermitRootLogin no # >PermitEmptyPasswords no # >ChallengeResponseAuthentication no >CheckMail no # >X11Forwarding yes # Nur bei Bedarf! ALLOW: ------ vi /etc/hosts.allow # folgende Zeilen anpassen: # Diese Zeile auskommentieren! #ALL : ALL : allow # Unter dem folgenden Beispiel die erlaubten Rechner/Netzwerke eintragen. #sshd : .evil.cracker.example.com : deny # sshd : 127.0.0.1/255.255.255.255 : allow # loopback (ich) WICHTIG!!! # sshd : 192.168.0.0/255.255.255.0 : allow # z.B. das lokale Netz sshd : .mynet.de : allow # das Netz als Namen # sshd : 192.168.0.7/255.255.255.255 : allow # oder nur einen Freund sshd : rudi.mynet.de : allow # der Freund mit Namen FTP: ---- vi /etc/login.conf # die folgende Zeile suchen: # Default authentication methods for ftp (krb4-or-pwd by default) In die darunter stehende Kommandozeile den Parameter "ftp-chroot" mit eintragen. Damit nicht jeder in jedem Verzeichnis rumstoebern kann! MAIL: ----- vi /etc/mail/aliases # schickt alle Systemmeldungen per E-Mail z.B. "root: admin@domain.de" # Und mit "newaliases" aktivieren! # Mailserver: "host -t mx domain.de" ############################################################################### # Hinzufuegen einer Festplatte unter OpenBSD: fdisk sd2 # So listet man die Partitionen auf. fdisk -i sd2 # Schreibt den MBR neu und dann ist die GANZE Platte fuer OpenBSD ! y fdisk sd2 # So listet man die Partitionen auf. fdisk -e sd2 # Oeffnet den MBR im Editmode zum Partitionen aendern! p fdisk: 1> edit 3 Starting Ending #: id cyl hd sec - cyl hd sec [ start - size] ------------------------------------------------------------------------ *3: A6 0 1 1 - 529 254 63 [ 63 - 8514387] OpenBSD # using MBR partition 3: type A6 off 63 (0x3f) size 8514387 (0x81eb53) q disklabel /dev/sd2 # Zeigt die Label der BSD-Partitionen und andere Partitionen! disklabel -E /dev/sd2 # Oeffnet die BSD-Partition um Labels zu aendern! D p # size offset fstype [fsize bsize cpg] ä 8514387 63 unused 0 0 # (Cyl. 0*- 5722*) c: 8515173 0 unused 0 0 # (Cyl. 0 - 5722*) a a (alle Fragen einfach durch ENTER'n) q # size offset fstype [fsize bsize cpg] ä 8515110 63 4.2BSD 1024 8192 16 # (Cyl. 0*- 5722*) c: 8515173 0 unused 0 0 # (Cyl. 0 - 5722*) newfs sd2a # Dieser Befehl legt ein "ffs" auf dem Label "a" # der OpenBSD-Prtition auf Platte "sd2" an! mkdir /DATA echo "/dev/sd2a /DATA ffs rw,softdep 1 2" >> /etc/fstab mount /DATA mount df -h ############################################################################### # Eventuell das "/tmp"-Verzeichnis fuer alle beschreibbar machen: su - chmod 777 /tmp exit ############################################################################### # saugen des Ports-Tree um auch die portierten Programme einfach uebers Internet installieren zu koennen (z.B.: die BASH): cd /tmp # ftp ftp.openbsd.org # ftp:ftp ftp> cd /pub/OpenBSD/[3.0] ftp> bin ftp> get ports.tar.gz ftp> by # su - # cd /usr # tar xvf /tmp/ports.tar.gz exit ############################################################################### # saugen der Kernel-Sourcen um einen leistungsfaehigeren Kernel zu bauen: cd /tmp # ftp ftp.openbsd.org # ftp:ftp ftp> cd /pub/OpenBSD/[3.0] ftp> bin ftp> get srcsys.tar.gz ftp> by # su - # cd /usr/src # tar xvf /tmp/srcsys.tar.gz Kernel bauen wie bei NetBSD. cp /bsd /bsd.GENERIC # Install-Kernel sichern! (wenn moeglich/noetig) cd /usr/src/sys/arch/i386/conf/ cp GENERIC MYKERNEL vi MYKERNEL # Kernelkonfiguration anpassen... cd ../compile/MYKERNEL/ make depend && make -j4 && make install && make clean SOUND: You will also have to edit /etc/rc.securelevel and change securelevel=1 to securelevel=-1. This is required so that the OSS kernel modules can load. Without this change the kernel will NOT load any modules. ############################################################################### # RAID1: ====== #--------------------------------------------------------------------------- The first step to using the raid driver is to ensure that it is suitably configured in the kernel. This is done by adding a line similar tö pseudo-device raid 4 # RAIDframe disk device to the kernel configuration file. The `count' argument ( `4', in this case), specifies the number of RAIDframe drivers to configure. To turn on component auto-detection and auto-configuration of RAID sets, simply add: options RAID_AUTOCONFIG to the kernel configuration file. All component partitions must be of the type FS_BSDFFS (e.g. 4.2BSD) or FS_RAID (e.g. RAID). The use of the latter is strongly encouraged, and is required if auto-configuration of the RAID set is desired. Since RAIDframe leaves room for disklabels, RAID components can be simply raw disks, or partitions which use an entire disk. Note that some platforms (such as SUN) do not allow using the FS_RAID partition type. On these platforms, the raid driver can still auto-configure from FS_BSDFFS parti- tions. A more detailed treatment of actually using a raid device is found in raidctl(8). It is highly recommended that the steps to reconstruct, copy- back, and re-compute parity are well understood by the system administra- tor(s) before a component failure. Doing the wrong thing when a compo- nent fails may result in data loss. Additional internal consistency checking can be enabled by specifying: options RAID_DIAGNOSTIC These assertions are disabled by default in order to improve performance. Es wird auch empfohlen die SCSI-Geraete in der Kernelconfig zu "hard-coden": STANDARD: scsibus* at ahc* # bei Adaptec-Hostadaptern hard-coded: scsibus0 at ahc0 # 1. SCSI-Bus auf dem 1. Adaptec-Hostadapter Das gleiche mit den HDD's: STANDARD: sd* at scsibus* target ? lun ? hard-coded: sd0 at scsibus0 target 0 lun ? sd1 at scsibus0 target 1 lun ? sd2 at scsibus0 target 2 lun ? sd3 at scsibus0 target 3 lun ? sd4 at scsibus0 target 4 lun ? sd5 at scsibus0 target 5 lun ? sd6 at scsibus0 target 6 lun ? #--------------------------------------------------------------------------- RAID-Platten vorbereiten: Formatiere 2 Platten wie oben beschrieben: fdisk /dev/sd1 fdisk /dev/sd2 disklabel -E /dev/sd1 disklabel -E /dev/sd2 Und setze das Label auf "RAID" (fuer beide Platten): disklabel -e /dev/sd1 # Oeffnet die BSD-Partition um Labels zu aendern! # size offset fstype [fsize bsize cpg] ä 8514387 63 unused 0 0 # (Cyl. 0*- 5722*) c: 8515173 0 unused 0 0 # (Cyl. 0 - 5722*) e: 8515110 63 RAID newfs /dev/sd1a newfs /dev/sd2a schreibe folgende rconfig-Datei "/etc/raid1.conf": #--------------------------------------------------------------------------- START array # numRow numCol numSpare 1 3 0 START disks /dev/sd1a /dev/sd2a #START spare START layout # sectPerSU SUsPerParityUnit SUsPerReconUnit RAID_level 32 1 1 1 START queue fifo 100 #--------------------------------------------------------------------------- configuriere das RAID-Device "raid0": raidctl -c /etc/raid1.conf raid0 initilisiere das RAID-Device "raid0": raidctl -i raid0 CHECKING: Parity-check: raidctl -p raid0 status-check: raidctl -P raid0 RAID set's status-check: raidctl -s raid0 To check the component label of /dev/sd1a, the following is used: raidctl -g /dev/sd1a raid0 #--------------------------------------------------------------------------- FEHLERSIMULATION im RAID-System: If for some reason (perhaps to test reconstruction) it is necessary to pretend a drive has failed, the following will perform that function: raidctl -f /dev/sd2e raid0 The system will then be performing all operations in degraded mode, where missing data is re-computed from existing data and the parity. In this case, obtaining the status of raid0 will return: Components: /dev/sd1e: optimal /dev/sd2e: failed /dev/sd3e: optimal Spares: /dev/sd4e: spare The -f option may be used first, and then the -F option used later, on the same disk, if desired. Immediately after the reconstruction is started, the status will report: Components: /dev/sd1e: optimal /dev/sd2e: reconstructing /dev/sd3e: optimal Spares: /dev/sd4e: used_spare This indicates that a reconstruction is in progress. To find out how the reconstruction is progressing the -S option may be used. This will indi- cate the progress in terms of the percentage of the reconstruction that is completed. When the reconstruction is finished the -s option will show: Components: /dev/sd1e: optimal /dev/sd2e: spared /dev/sd3e: optimal Spares: /dev/sd4e: used_spare Um eine defekte Platte auszutauschen, muss erst eine "spare"-Platte eingefuehgt werden (wenn nicht schon vorhanden) um die verlohrenen Daten aufzunehmen. Diese wird dann gegen die defekte Platte ausgetauscht und zum schluss wieder eine "spare"-Platte eingefuehgt! Siehe "man raidctl" Sektion "EXAMPLES"! #--------------------------------------------------------------------------- [IMG]