pirmdiena, 2012. gada 27. februāris

Tīkla karšu apvienošana, pieslēgšana Procurve slēdzim ar statisko LACP maģistrāli.

Angliski nosaukums varētu skanēt sekojoši:
Network interface bonding with Procurve LACP static trunk and VLAN tagging.

Ja serverim ir 2 vai vairāk tīkla kartes, tad varētu būt lietderīgi tās apvienot (NIC bonding, teaming), lai sasniegtu lielāku caurlaides spēju, kā arī nodrošinātu bojājumpiecietību.

Sekojošais tika veikts uz Ubuntu servera un Procurve tīkla slēdža.

Uz servera

Uzstādam ifenslave,  moduli un parametrus.
apt-get install ifenslave 
echo alias bond0 bonding >  /etc/modprobe.d/bonding.conf 
echo options bonding mode=4 miimon=100 >>  /etc/modprobe.d/bonding.conf
Pārbaudām, kā ielādējies bonding modulis:

===== cat /proc/net/bonding/bond0 ======
Ethernet Channel Bonding Driver: v3.2.3 (December 6, 2007)


Bonding Mode: IEEE 802.3ad Dynamic link aggregation
Transmit Hash Policy: layer2 (0)
MII Status: down
MII Polling Interval (ms): 100
Up Delay (ms): 0
Down Delay (ms): 0


802.3ad info
LACP rate: slow
bond bond0 has no active aggregator
=============================================

Konfigurējam tīkla saskarni bond0, rediģējot failu /etc/network/interfaces:


===== cat /etc/network/interfaces ======
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).


# The loopback network interface
auto lo
iface lo inet loopback


# The primary network interface
auto bond0
iface bond0 inet static
  address 10.0.0.4
netmask 255.255.0.0
gateway 10.0.0.1
post-up ifenslave bond0 eth0 eth1
pre-down ifenslave -d bond0 eth0 eth1
==============================================


Uz Procurve


Tranka izveidošana


Ja nevēlas izmantot VLAN'us, tad var vienkārši salikt visus interesējošos slēdža portus LACP active vai passive(?) modē - un piespraužot konfigurētā servera tīkla portus, autormātiski tiks izveidoti dinamiskie tranki kā Dyn1 u.t.t.. Diemžēl uz dinamiskajiem trankiem nav iespējams uzlikt VLAN marķējumus, tāpēc ir jāveido statiskie tranki:

config t 
trunk 9-10 trk5 lacp

Lai pārbaudītu izveidoto tranku:
show lacp
....

                           LACP


   PORT   LACP      TRUNK     PORT      LACP      LACP
   NUMB   ENABLED   GROUP     STATUS    PARTNER   STATUS
   ----   -------   -------   -------   -------   -------
   9      Active    Trk5      Down      No        Success
   10     Active    Trk5      Down      No        Success


VLAN'a pieslēgšana


Tos pieslēdz kā parasti, bet slēdža porta vietā jānorāda Trk5, piem.,:

vlan 8 tagged Trk5

Servera pieslēgšana trankam

Serveri pārslēgt no viena vada pieslēguma uz LACP tranku iespējams "hotswap" režīmā:

1. Pieslēdzam tīkla vadu no līdz šim neizmantotās tīkla saskarnes (piem., eth1)  Trk5 portam (piem. 10)
2. Uz servera apturam darbojošos esošo tīkla saskarni eth0 un uzreiz startējam bond0 -
 ifconfig eth0 down
 ifconfig bond0 up
3. Pēc 1-2 sekunžu pātraukuma sāk darboties bond0 tīkla saskarne
4. Pārslēdzam arī līdz šim izmantotās tīkla saskarnes (eth0)  uz jauno tranku (9. tīkla slēdža portam).

Kad serveris pieslēgts:


==== cat /proc/net/bonding/bond0  =====
Ethernet Channel Bonding Driver: v3.2.3 (December 6, 2007)


Bonding Mode: IEEE 802.3ad Dynamic link aggregation
Transmit Hash Policy: layer2 (0)
MII Status: up
MII Polling Interval (ms): 100
Up Delay (ms): 0
Down Delay (ms): 0


802.3ad info
LACP rate: slow
Active Aggregator Info:
Aggregator ID: 2
Number of ports: 2
Actor Key: 17
Partner Key: 289
Partner Mac Address: 00:1f:fe:1f:92:c0


Slave Interface: eth0
MII Status: up
Link Failure Count: 5
Permanent HW addr: 00:15:17:5e:d8:34
Aggregator ID: 2


Slave Interface: eth1
MII Status: up
Link Failure Count: 2
Permanent HW addr: 00:15:17:5e:d8:35
Aggregator ID: 2
========================================
 





piektdiena, 2011. gada 14. oktobris

Svītru kodi komandrindas režīmā

Ģenerājam PS failu ar svītru kodiem, kas atrodas failā kodi.txt.
barcode -i kodi.txt -e code39 -o mee.ps -t 7x18+5+18-5-10 -u mm

svētdiena, 2011. gada 31. jūlijs

How to create PDF photo album with ImageMagick


rinda=""; a=1 ; p=1 ;
for fails in ./*JPG
do
rinda=$rinda" "$fails[200x150]
a=$(($a+1))
if [ $a == 37 ]
then
echo "processing $p set"
montage -label '%f' -tile 6x $rinda -page A4 index-$p.pdf
a=1 ; p=$(($p+1)) ; rinda=""
fi
done
echo "processing last set"
montage -label '%f' $rinda -page A4 index-$p.pdf


Update
OMG. The following simple line just works and puts all thumbnails in one PDF file - 35 frames per PDF page.

montage -label "%f" -tile 5x7 -page A4 ../*JPG[200x150] index.pdf

piektdiena, 2011. gada 15. jūlijs

DHCP kļūda pie LTSP instalēšanas

Vasarā lēnām migrējam serverus uz jaunām versijām un virtuālām mašīnām.
Pēc DHCP servera pārcelšanas no Debian Etch uz Debian Squeeze vairs nestartējās LTSP mašīnas - LTSP Etherboot saņem gan IP adresi gan PXE, bet tālāk turpinot ielādi - apstājas.

Ar Wireshark tika noskaidrots, ka "vainīgais" ir atkārtots DHCP pieprasījums no LTSP klienta. Ja DHCPD3 uz Etch deva atpakaļ pieprasītos datus, tad DHCPD3 (isc-dhcp-server 4.1.1-P1-15+squeeze2) atmeta šādu atbildi:

...
Unexpected hash function at hash.c:53.
DHCPDISCOVER from 08:00:27:36:2e:d3 via eth0
DHCPOFFER on 10.0.3.41 to 08:00:27:36:2e:d3 via eth0
DHCPREQUEST for 10.0.3.41 (10.0.0.1) from 08:00:27:36:2e:d3 via eth0: lease 10.0.3.41 unavailable.
DHCPNAK on 10.0.3.41 to 08:00:27:36:2e:d3 via eth0
...


Risinājums tika atrasts te: http://www.nubae.com/logs/ltsp20110317_pg2.html

Jeb, failam /var/lib/tftpboot/ltsp/i386/pxelinux.cfg/default galā ir jāpieraksta "IPAPPEND 3" un tā saturs ir šāds:
default ltsp
label ltsp
kernel vmlinuz
append ro initrd=initrd.img quiet splash nbdport=2000
IPAPPEND 3

trešdiena, 2011. gada 18. maijs

Total traffic counter from MRTG log files

Script to count total traffic for last day for switch port from MRTG log files, and output file name, if total traffic is more than 10GB.


# period
sakums=`date -d -1day +%s`
# 1GB
ttrafic=$((1024*1024*1024))

pushd /var/www/mrtg
for fails in `find *log -mtime -1`
do tail -n +4 $fails |
awk -vsakums=$sakums -vfails=$fails -vttrafic=$ttrafic '{ if ($1 > sakums)
{intr += ($2*300); outtr += ($3*300) }}
END { if (outtr > 10000000000)
printf("%s\t%10.2f\t%10.2f\n",fails,intr/ttrafic,outtr/ttrafic) }'
done

sestdiena, 2010. gada 4. decembris

Dell PERC H700 RAID kontroliera testi

RAID kontrolieris: LSI MegaSAS 9260
Failu serveris: 8GB RAM
EXT4 Failu sistēma

Kontroliera RAID policy - write back (tāpēc "izcili" rakstīšanas ātrumi)


RAID5:
11 diski *1,5TB SATA 7200

Command line used: iozone -i0 -i1 -i2 -c -e -a -n 4g -g 16g -y 2048 -s 2048 -q 8192 -f /media/iozone

random random
KB reclen write rewrite read reread read write
4194304 2048 507265 601835 5217335 6075021 6059073 204259
4194304 4096 545864 613254 4900901 5980252 5960771 304020
4194304 8192 484461 494155 3393424 3486067 3487220 339015
8388608 2048 535145 647667 228315 230911 178499 158751
8388608 4096 522054 603106 242188 239015 262852 278510
8388608 8192 511561 547605 238473 238133 450990 325700
16777216 2048 535339 602858 169483 170419 62861 144048
16777216 4096 504894 608561 171000 168866 111390 255407
16777216 8192 547588 627476 167334 170551 177473 315782


RAID6

Command line used: iozone -i0 -i1 -i2 -c -e -a -n 4g -g 16g -y 2048 -s 2048 -q 8192 -f /media/iozone
random random
KB reclen write rewrite read reread read write
4194304 2048 485579 674330 4778832 6087938 6077705 234536
4194304 4096 516627 625204 4709220 5904143 5801122 308782
4194304 8192 577226 695833 3320708 3436157 3439575 326137
8388608 2048 597535 637466 1034064 1108340 200691 182545
8388608 4096 566840 653885 1011363 1134390 333880 298285
8388608 8192 565815 586244 880734 954526 534508 314980
16777216 2048 603074 592641 880728 932588 74480 170545
16777216 4096 589522 606359 882282 930832 135046 283768
16777216 8192 601818 634115 815697 845830 237286 307365


RAID50 (3 x (RAID5 no 4 diskiem))




Command line used: iozone -i0 -i1 -i2 -c -e -a -n 4g -g 16g -y 2048 -s 2048 -q 8192 -f /media/iozone
random random
KB reclen write rewrite read reread read write
4194304 2048 565397 622376 4765631 6042603 6073691 305175
4194304 4096 594191 692283 4799720 5840998 5833904 363215
4194304 8192 566268 641491 3323537 3471235 3468972 353852
8388608 2048 597915 682548 227525 229925 177328 263220
8388608 4096 597083 655845 236983 234054 261084 366365
8388608 8192 593327 647889 232636 227249 436282 340496
16777216 2048 602848 675974 175752 177381 68520 234357
16777216 4096 610316 695315 173770 173823 114449 367738
16777216 8192 615497 662729 172606 175156 184357 328476

piektdiena, 2010. gada 22. oktobris

DWL-2100AP klienti un pārstartēšana

DWL-2100AP klientus var skatīt ar komandu:
 snmpbulkwalk -v2c -c public IPADRESE .1.3.6.1.4.1.171.11.37.4.4.5.2.1.2.1

Vai arī varam novilkt visus mib, piem., no ftp://ftp.dlink.ru/pub/Wireless/DWL-2100AP/SNMP/ un komanda:
snmpbulkwalk -v2c -c public -m ./mibs/  IPADRESE  AP-Config::adClientMAC


AP pārstartēšanu savukārt veic ar komandu:
snmpset -v2c -c private  IPADRESE .1.3.6.1.4.1.171.11.37.4.3.2.1.0 i 1
# jeb
snmpset -v2c -c private -m ./mibs/ IPADRESE AP-Config::sysRestart.0 i 1