Архив

Архив раздела ‘Администрирование’

Восстановление прошивки Cisco Catalyst

При неудачной прошивке свитча или сбоя флэш памяти, коммутатор не может найти образ IOS.
И при загрузке ругается:
Base ethernet MAC Address: 00:0b:be:54:1c:00
Xmodem file system is available.
The password-recovery mechanism is enabled.
Initializing Flash…
flashfs[0]: 8 files, 1 directories
flashfs[0]: 0 orphaned files, 0 orphaned directories
flashfs[0]: Total bytes: 15998976
flashfs[0]: Bytes used: 11776
flashfs[0]: Bytes available: 15987200
flashfs[0]: flashfs fsck took 18 seconds.
…done Initializing Flash.
Boot Sector Filesystem (bs:) installed, fsid: 3
Loading «c3560-advipservicesk9-mz.122-25.SEE4.bin»…c3560-advipservicesk9-mz.1d

Error loading «c3560-advipservicesk9-mz.122-25.SEE4.bin»

Interrupt within 5 seconds to abort boot process.
Boot process failed…

The system is unable to boot automatically. The BOOT
environment variable needs to be set to a bootable
image.

И вываливает в приглашение:

switch:

Смотрим содержимое флэш памяти:

switch: dir flash:
Directory of flash:/

2 -rwx 0 env_vars
3 -rwx 5 config.text.renamed
4 -rwx 5 private-config.text.renamed
5 -rwx 2072 multiple-fs
6 -rwx 676 vlan.dat
7 -rwx 46 system_env_vars
9 -rwx 1938 private-config.text
11 -rwx 2614 config.text

15987200 bytes available (11776 bytes used)

В данном случае образ IOS отсутсвует.
Значит будем загружать по протоколу xmodem.
В случае с Linux устанавливаем терминал minicom и набор програм для передачи по протоколам xmodem/ymodem пакет называется – lrzsz.

Скачиваем нужную нам прошивку в моем случае: c3550-ipservicesk9-mz.122-46.SE.bin

Даем команду: copy xmodem: flash:c3550-ipservicesk9-mz.122-46.SE.bin

в minicom нажимаем Ctrl + A + S выбираем тип протокола xmodem и ждем… ждем долго т.к. размер прошивки ~7мб, а скорость у нас 9600 бод.

switch: copy xmodem: flash:c3550-ipservicesk9-mz.122-46.SE.bin
Begin the Xmodem or Xmodem-1K transfer now…
C +———–[xmodem upload - Press CTRL-C to quit]————+
|Sending c3550-ipservicesk9-mz.122-46.SE.bin, 75099 blocks: Gi|
|ve your local XMODEM receive command now. |
|Xmodem sectors/kbytes sent: 0/ 0kRetry 0: NAK on sector |
|Retry 0: NAK on sector |
|Retry 0: NAK on sector |
|Xmodem sectors/kbytes sent: 1/ 0kRetry 0: NAK on sector |
|Xmodem sectors/kbytes sent: 63/ 7k |
+————————————————————-+

admin Администрирование , , ,

Решение проблем с нарушением отображения букв «ш» и «И» в резултате неудачной перекодировки mysql

8 Декабрь 2009

Если в mysql принудительно указать кодировку cp1251, а потом выполнить смену кодировки базы на UTF-8, то вместо букв «ш» и «И» будут стоять вопросики.
Типичное проявление – бекап баз в кодировке UTF-8 с последующим их восстановлением или просто апдейт CMS, для которых родная кодировка – юникод. Например – Wordpress, Drupal

Изучив Google, было найдено масса подобных проблем но все решение сводилось к удалению базы и заливки их резервной копии, что конечно не может быть решением.

Изучав особенности кодировки, я обратил внимание на то, что в mysql дампе буквы ш и И имели неверный код:
ш – 0xD13F
И – 0xD03F

В то время как верные коды для этих букв:
ш – 0xD188
И – 0xD098

Для интереса я проверил как отрабатывает на коды символов Perl в юникодной консоле:

perl -e ‘printf «%#x\n», ord(«И»);’
0xd0
perl -e ‘printf «%#x\n», ord(«ш»);’
0xd1

Таким образом данный сбой происходит из-за каких то нарушений в таблицах кодировок.

Исправить проблему очень просто, достаточно сделать дамп и выполнить две замены через Perl:

LC_ALL=C perl -pi -e «s|\xD1\x3F|\xD1\x88|g» dump.sql
LC_ALL=C perl -pi -e «s|\xD0\x3F|\xD0\x98|g» dump.sql

После чего залить исправленный дамп обратно в базу

Надеюсь, это сбережет многим массу времени и нервов.

admin Администрирование

Как добавить нового пользователя или БД в MySQL

5 Декабрь 2009
GRANT ALL PRIVILEGES ON БД.* TO пользователь@localhost IDENTIFIED BY 'пароль';
GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,DROP PRIVILEGES ON БД.таблица TO
пользователь@'%.domain.ru' IDENTIFIED BY 'пароль';

или

insert into user (host,user,password)
values ('localhost','пользователь',password('pas'));

insert into db
(Host,Db,User,Select_priv,Insert_priv,Update_priv,Delete_priv,Create_priv,
Drop_priv,Grant_priv,References_priv,Index_priv,Alter_priv)
values ('localhost','БД','пользователь','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y');
flush privileges;

или воспользоваться скриптом mysql_setpermission

admin Администрирование , ,

ipv6_traceroute

14 Ноябрь 2009

IPv6 traceroute sites, listed by ASN. (An IPv4 Traceroute page is also available.)

If you know of a working IPv6 traceroute site that isn’t listed below, feel free to add it. (Don’t have a wiki account yet? Sign up here.) Sites should allow traceroutes to any specified address.

Please correct any errors you find on this list. If a site is no longer responding, please change the “OK” in the Notes column to “FAILED” along with the date (mm/dd/yy). If the site becomes operational again, please change the “FAILED” message back to “OK”. If a site has been in “FAILED” status for over a month, it can be removed from the wiki.

ASN Provider Link Notes
559 SWITCH http://lg.lan.switch.ch/lg/6lg.cgi OK
680 DFN http://www.noc.dfn.de/lg/ OK
766 RedIRIS http://www.rediris.es/red/lg/ OK
1213 HEAnet http://www.hea.net/cgi-bin/lg.cgi OK
1273 Cable & Wireless https://support.cw.com/?TESTDRIVE=1&LG=1 OK
2108 Croatian Internet eXchange http://www.cix.hr/traceroute.php OK
2603 NORDUnet http://www.nordu.net/connectivity/looking-glass/lg6.cgi OK
3303 Swisscom IP-Plus https://my.ip-plus.net/nav.en.mpl/network/tools/LookingGlass/ OK
3327 Data Telecom http://lg.version6.net/ OK
3333 RIPE NCC RIS Project http://www.ris.ripe.net/cgi-bin/lg/index.cgi OK
3356 Level3 http://lg.level3.net/ OK
4787 CBN http://noc.cbn.net.id/lg.php OK
5408 Greek Research & Technology Network http://netmon.grnet.gr/lg.shtml OK
5430 freenet Cityline GmbH http://zaphods.net/trace/index.cgi OK
5511 OpenTransit http://www.ipv6.opentransit.net/cgi-bin/yalg.pl OK
5539 SpaceNet http://www.space.net/traceroute OK
5609 Tilab http://net-stats.ipv6.tilab.com/bgp/services.html OK
6435 LavaNet http://www.ipv6.lava.net/traceroute.html OK
6453 Teleglobe http://lg.teleglobe.net/ OK
6509 CA*net 4 http://dooka.canet4.net/lg/lg.php OK
6667 EUnet http://www.eunetip.net/look.shtml OK
6730 Sunrise http://debby.sunrise.ch/lg/lg.cgi.html OK
6762 Seabone http://etabeta.noc.seabone.net/cgi-bin/lg.pl OK
6802 NREN – Bulgaria http://luna.acad.bg/lg OK
6939 Hurricane Electric http://lg.he.net/cgi-bin/index.cgi OK
7521 Internet Multifeed http://www.v6.mfeed.ad.jp/ipv6/lg.html FAILED 06/20/08
7670 tumori.nu http://www.tumori.nu/IPv6/traceroute.html OK
7684 Sakura Internet http://as7684.bgp4.jp/ OK
8201 Comm. Scolaire St Benoit Habay http://www.stben.net/internet.html OK
8218 Neotelecoms/Eunetworks http://lg.as8218.eu OK
8298 SixXS GRH (Ghost Route Hunter) http://www.sixxs.net/tools/grh/ OK
8642 Wiberg http://www.wiberg.nu/iptools.php OK
8758 Dolphins Network Systems http://www.dolphins.ch/network/traceroute.en.php FAILED 06/20/08
8903 BT Spain http://vasili.bt.es/lg.html OK
9370 Sakura Internet http://as9370.bgp4.jp/ OK
9607 BroadBand Tower – Japan http://lg01.colo01.bbtower.ad.jp/ OK
11537 Abilene http://ratt.uits.iu.edu/routerproxy/abilene/ OK
12541 Cable & Wireless https://support.cw.com/?TESTDRIVE=1&LG=1 OK
12767 PragoNet http://nms1.prago.net/public-cgi-bin/lg/lg.cgi OK
12902 Luna.nl http://noc.luna.nl/lg/ FAILED 06/20/08
12931 SpeedKom http://cadiweb.speedkom.net/lookingglass.php OK
13115 Home of the Brave http://home.of.the.brave.de/Internet-Services/Looking_Glass/ FAILED 06/20/08
15685 Logix http://www.ipv6.logix.cz/ OK
15703 TrueServer http://noc.trueserver.nl/cgi-bin/lg.pl FAILED 06/20/08
16215 Genotec Internet Consulting AG http://lg.as16215.net/ OK
18566 Altair7 Communications http://www.altair7.com/cgi-bin/ntools/output.cgi OK
20640 Titan Networks Six-de.net LG http://www.six-de.net/lg/ OK
20965 GEANT http://stats.geant.net/lg/lgform.cgi FAILED 06/20/08
21142 PragoNet http://nms1.prago.net/public-cgi-bin/lg/lg.cgi OK
25137 nfsi telecom http://lg.nfsi.pt/ OK
25358 Novso http://www.as25358.net.lg/ OK
25409 AlsysNet http://lg.alsysdata.net OK
25560 rh-tec https://noc.de.rh-tec.net/nmc/ FAILED 06/20/08
25795 ARPNetworks http://4or6.com/ OK
27552 TowardEX http://www.twdx.net/ OK
28788 Unilogic Networks http://noc.unilogicnetworks.net/lg/ OK
28929 ASDASD srl (Italy) http://as28929.net/lg/ OK
29632 NetAssist http://noc.netassist.kiev.ua/lg.php OK
30781 Jaguar Network http://www.as30781.net/lg/ OK
32748 IPv6 Trace Test http://tracetest.net OK
41075 ATW Internet http://atw.co.hu/lg OK

admin Администрирование ,

Обновлние портов OpenBSD

15 Сентябрь 2009

CVSROOT=anoncvs@anoncvs1.usa.openbsd.org:/cvs
export CVSROOT
cd /usr
cvs checkout -P ports

admin Администрирование ,

Настройка протокола BGP на оборудовании Cisco Systems

Источник: subnets.ru
bgp

AS100 – наш номер ASки

5.5.0.0/20 – анонсируемый нами префикс (наш блок адресов)

AS200 – наш апстрим, который отдает нам full-view (полную таблицу маршрутов)

AS300 – наш privat peer (приватный пир), который отдает нам маршруты в свою AS и своего клиента AS400.

С чего начать ?

С настройки интерфейсов конечно.

GigabitEthernet3/0 – AS200

GigabitEthernet3/1 – AS300

Зайдите на router телнетом и перейдите в enable режим.


cisco# conf t
cisco(config)# interface GigabitEth
cisco(config-if)# ip address 1.1.1.2 255.255.255.252
cisco(config-if)# interface GigabitEthernet3/1
cisco(config-if)# ip address 2.2.2.10 255.255.255.252
cisco(config-if)# exit

Добавим маршруты, сначала отправим туда, откуда не возвращаются :), маршруты в “серые сети”:


cisco(config)# ip route 10.0.0.0 255.0.0.0 Null0 254
cisco(config)# ip route 172.16.0.0 255.240.0.0 Null0 254
cisco(config)# ip route 192.168.0.0 255.255.0.0 Null0 254

Затем добавим маршрут на свой полный блок:


cisco(config)# ip route 5.5.0.0 255.255.240.0 Null0 254

Читать далее…

admin Администрирование , ,

Русификация FreeBSD консоли (KOI8-R и UTF-8)

15 Июнь 2009

Настройка KOI8-R:

vi /etc/rc.conf
keymap=»ru.koi8-r»
font8×8=»cp866-8×8″
font8×14=»cp866-8×14″
font8×16=»cp866b-8×16″
scrnmap=»koi8-r2cp866″
cursor=»destructive»

Заменить все cons25 на cons25r в /etc/ttys:

vi /etc/ttys
:%s/cons25/cons25r/g

kill -HUP 1

(чтобы перечитался /etc/ttys)

/etc/rc.d/syscons restart

pw usermod root -L russian
(выполнить для всех имен пользователей кому нужен русский, если вы ходите
на сервер только удаленно по ssh/telnet, то можно выполнить только этот шаг для настройки
поддержки русского языка KOI8-R в системе)

Настройка UTF-8 (для работы с удаленного терминала):

В /etc/login.conf добавляем:

russian-utf8|Russian Users Accounts:\
:charset=UTF-8:\
:lang=ru_RU.UTF-8:\
:lc_all=ru_RU.UTF-8:\
:tc=default:
Читать далее…

admin Администрирование

Mini-HOWTO for the Linux packet generator module.

1. Enable CONFIG_NET_PKTGEN to compile and build pktgen.o either in kernel
or as module. Module is preferred. insmod pktgen if needed.

2. For montoring and control pktgen creates. Inspect them!
/proc/net/pktgen/pgctrl
/proc/net/pktgen/kpktgend_X
/proc/net/pktgen/ethX

3. Extract the example script «pktgen.sh» (see below).

4. Edit script to set preferred device and destination MAC, and IP address.

5. Run in shell: «./pktgen.sh»
It does all the setup including sending. Also

«echo «start» > /proc/net/pktgen/pgctrl» Starts sends on all threads and devs

Use
«cat /proc/pktgen/eth[X]» X={1,n} to inspect an interfacee.

7. Use «pgset» change pktgen settings. See examples.

«pgset» to change generator parameters. F.e.
pgset «clone_skb 1″ sets the number of copies of the same packet
pgset «clone_skb 0″ use single SKB for all transmits
pgset «pkt_size 9014″ sets packet size to 9014
pgset «frags 5″ packet will consist of 5 fragments
pgset «count 200000″ sets number of packets to send, set to zero
for continious sends untill explicitly
stopped.
pgset «ipg 5000″ sets artificial gap inserted between packets
to 5000 nanoseconds
pgset «dst 10.0.0.1″ sets IP destination address
(BEWARE! This generator is very aggressive!)
pgset «dst_min 10.0.0.1″ Same as dst
pgset «dst_max 10.0.0.254″ Set the maximum destination IP.
pgset «src_min 10.0.0.1″ Set the minimum (or only) source IP.
pgset «src_max 10.0.0.254″ Set the maximum source IP.
pgset «dstmac 00:00:00:00:00:00″ sets MAC destination address
pgset «srcmac 00:00:00:00:00:00″ sets MAC source address
pgset «src_mac_count 1″ Sets the number of MACs we’ll range through. The
‘minimum’ MAC is what you set with srcmac.
pgset «dst_mac_count 1″ Sets the number of MACs we’ll range through. The
‘minimum’ MAC is what you set with dstmac.
pgset «flag [name]» Set a flag to determine behaviour. Current flags
are: IPSRC_RND #IP Source is random (between min/max),
IPDST_RND, UDPSRC_RND,
UDPDST_RND, MACSRC_RND, MACDST_RND
pgset «udp_src_min 9″ set UDP source port min, If < udp_src_max, then
cycle through the port range.
pgset «udp_src_max 9″ set UDP source port max.
pgset «udp_dst_min 9″ set UDP destination port min, If < udp_dst_max, then
cycle through the port range.
pgset «udp_dst_max 9″ set UDP destination port max.
pgset stop aborts injection

Also, ^C aborts generator.

Читать далее…

admin Администрирование , ,

Обновление коллекции FreeBSD портов через cvsup

Оригинал: http://f0kp.iplus.ru/proj/fb15.html

                    Обновление коллекции портов

   Вам необходимо установить cvsup. Проверьте установлена она у вас или
   нет, следующей командой:
user@host#which cvsup

   она должна выдать что-то вроде этого: '/usr/local/bin/cvsup'
   Если нет, перейдите в директорию портов и установите cvsup.

   Затем вам необходимо создать sup-файл.
   Вы можете найти пример в /usr/share/examples/cvsup/ports-supfile

   это моя версия:

*default tag=.
*default host=cvsup.nl.freebsd.org
*default prefix=/usr
*default base=/usr
*default release=cvs delete use-rel-suffix compress
ports-all

   Вставьте вышеприведенный текст в файл, названный 'supfile'.
   Теперь вы можете обновить коллекцию портов, введя (из под root):

   cvsup supfile

   Затем сидити и ждите, ждите, ждите (это может занять много времени)

admin Администрирование , ,

Understanding, Configuring, and Troubleshooting CEF

Understanding Router Pieces and Parts

Consider the following components required to switch a packet:

Some device detects packets that the router needs to receive (pick up off the wire) and process.

The packet needs to be stored (copied someplace in the router’s memory).

The packet’s header must be examined (by the local packet psychologist to see whether the packet is

crazy), various options and fields within the packet (such as the Time to Live field) must be processed,

and the Layer 2 header needs to be replaced with the correct Layer 2 header for the next hop of the

packet’s journey.

The packet must then be given to some device on the outbound interface that will transmit it onto the

correct network segment.

Each of these four steps must be performed by some piece of hardware or software within the router.

Most routers use the following fundamental pieces of hardware while switching packets:

Скачать:

book.rar

admin Администрирование ,