Pages

Thursday, March 22, 2012

Windows DNS tools и как да ги използваме.

DNS тип заявки
А - на кое IP отговаря www.google.com.
AAAA - IPv6 версията на A.
MX - кои сървъри отговарят за e-mail-ите на google.com.
NS - кой сървъри отговарят за DNS записите на google.com.
SOA - Start of Authorite - пъртият DNS сървър отговарящ за зоната google.com.
PTR - обратен запис - на кой хост отговаря 195.177.249.170
TXT - текстов запис, може да се ползва за всичко, най-използвани са SPF TXT записи за емейл SPAM защита.

Windows nslookup.exe (start->run->cmd.exe)

Nslookup е инструмент за диагностика на DNS сървър. Освен основното което всеки администратор е ползвал C:>nslookup www.dir.bg, програмката предлага и други опции които са полезни за диагностика. Без допълнително опции nslookup изпраща запитване за A запис.

Какъв е SOA записът за зоната google.com?
C:\>nslookup -type=soa google.com
Server:  UnKnown
Address:  10.1.42.1

Non-authoritative answer:
google.com
        primary name server = ns1.google.com
        responsible mail addr = dns-admin.google.com (dns-admin@google.com)
        serial  = 2012010300
        refresh = 7200 (2 hours)
        retry   = 1800 (30 mins)
        expire  = 1209600 (14 days)
        default TTL = 300 (5 mins)

Кои DNS сървъри отговарят за зоната google.com?

C:\>nslookup -type=ns google.com
Server:  UnKnown
Address:  10.1.42.1

Non-authoritative answer:
google.com      nameserver = ns3.google.com
google.com      nameserver = ns1.google.com
google.com      nameserver = ns2.google.com
google.com      nameserver = ns4.google.com
Кой сървъри отговарят за емейла @google.com?
C:\>nslookup -type=mx google.com
Server:  UnKnown
Address:  10.1.42.1

Non-authoritative answer:
google.com      MX preference = 30, mail exchanger = alt2.aspmx.l.google.com
google.com      MX preference = 50, mail exchanger = alt4.aspmx.l.google.com
google.com      MX preference = 10, mail exchanger = aspmx.l.google.com
google.com      MX preference = 40, mail exchanger = alt3.aspmx.l.google.com
google.com      MX preference = 20, mail exchanger = alt1.aspmx.l.google.com

На кой host отговаря 216.239.32.10?
C:\>nslookup -type=ptr 216.239.32.10
Server:  UnKnown
Address:  10.1.42.1

Non-authoritative answer:
10.32.239.216.in-addr.arpa      name = ns1.google.com
IPv6 запис за google.com?
C:\>nslookup -type=aaaa google.com
Server:  UnKnown
Address:  10.1.42.1

*** No IPv6 address (AAAA) records available for google.com

Както виждаме google.com нямат IPv6 запис. (Всъщност google има AAAA запис, но връща отговор за такъв само когато е достъпван през IPv6 мрежа: http://www.google.com/intl/en/ipv6/)

IPv6 за www.netbsd.org?

C:\>nslookup -type=aaaa www.netbsd.org
Server:  UnKnown
Address:  10.1.42.1

Non-authoritative answer:
Name:    www.netbsd.org
Address:  2001:4f8:3:7:2e0:81ff:fe52:9a6b
Какъв е TXT записът за google.com? (ползва се предимно за SPF)
C:\>nslookup -type=txt google.com
Server:  UnKnown
Address:  10.1.42.1

Non-authoritative answer:
google.com      text =

"v=spf1 include:_netblocks.google.com ip4:216.73.93.70/31 ip4:216.73.93.72/31 ~all"
TXT записът е всъщност SPF запис който показва кой сървъри могат да изпращат емейли ОТ @google.com.

Non-authoritative DNS answer:
Този тип отговори идват от DNS cache сървъри.
В случая 10.1.42.1 е DNS сървър въведен в мрежовите настройки (или /etc/resolv.conf).

* клиента пита своят DNS cache server: кои сървъри отговарят за e-mail-ите на google.com.
* DNS cache сървърът намира NS записите на google.com и пита authoritative сървъра кои сървъри отговарят за e-mail-ите на google.com.
* DNS cache сървърът отговаря на клиента.
* В случая огтоворът е Non-authoritative.

C:\>nslookup -type=mx google.com
Server:  UnKnown
Address:  10.1.42.1

Non-authoritative answer:
google.com      MX preference = 50, mail exchanger = alt4.aspmx.l.google.com
google.com      MX preference = 10, mail exchanger = aspmx.l.google.com
google.com      MX preference = 40, mail exchanger = alt3.aspmx.l.google.com
google.com      MX preference = 30, mail exchanger = alt2.aspmx.l.google.com
google.com      MX preference = 20, mail exchanger = alt1.aspmx.l.google.com
Тоест отговорът не е получен от DNS сървър отговарящ за зоната google.com.

Authoritative answer:
Отговорът идва от DNS сървър отговарящ за зоната google.com. За целта предварително намираме кои DNS сървъри отговарят за google.com.

* клиента пита директно сървър отговарящ за зоната google.com
* отговорът е Authoritative
C:\>nslookup -type=ns google.com
Server:  UnKnown
Address:  10.1.42.1

Non-authoritative answer:
google.com      nameserver = ns2.google.com
google.com      nameserver = ns1.google.com
google.com      nameserver = ns3.google.com
google.com      nameserver = ns4.google.com

C:\>nslookup -type=mx google.com ns1.google.com
Server:  ns1.google.com
Address:  216.239.32.10

google.com      MX preference = 30, mail exchanger = alt2.aspmx.l.google.com
google.com      MX preference = 50, mail exchanger = alt4.aspmx.l.google.com
google.com      MX preference = 20, mail exchanger = alt1.aspmx.l.google.com
google.com      MX preference = 10, mail exchanger = aspmx.l.google.com
google.com      MX preference = 40, mail exchanger = alt3.aspmx.l.google.com
alt2.aspmx.l.google.com internet address = 74.125.127.27
alt4.aspmx.l.google.com internet address = 209.85.225.27
alt1.aspmx.l.google.com internet address = 209.85.173.27
aspmx.l.google.com      internet address = 74.125.79.27
alt3.aspmx.l.google.com internet address = 74.125.81.27

DNS client service:
Windows предлага dns client service който кешира локално dns заявките. Не е много ясно точно как работи но някои неща все пак можем да видим и сами.

C:\>ipconfig/displaydns

Windows IP Configuration

         1.0.0.127.in-addr.arpa
         ----------------------------------------
         Record Name . . . . . : 1.0.0.127.in-addr.arpa.
         Record Type . . . . . : 12
         Time To Live  . . . . : 424617
         Data Length . . . . . : 4
         Section . . . . . . . : Answer
         PTR Record  . . . . . : localhost

         vbox7.com
         ----------------------------------------
         Record Name . . . . . : vbox7.com
         Record Type . . . . . : 1
         Time To Live  . . . . : 24180
         Data Length . . . . . : 4
         Section . . . . . . . : Answer
         A (Host) Record . . . : 87.121.59.2

         www.samedeutz-fahr.com
         ----------------------------------------
         Record Name . . . . . : www.samedeutz-fahr.com
         Record Type . . . . . : 1
         Time To Live  . . . . : 86375
         Data Length . . . . . : 4
         Section . . . . . . . : Answer
         A (Host) Record . . . : 84.33.3.3


         en.wikipedia.org
         ----------------------------------------
         Record Name . . . . . : en.wikipedia.org
         Record Type . . . . . : 5
         Time To Live  . . . . : 233
         Data Length . . . . . : 4
         Section . . . . . . . : Answer
         CNAME Record  . . . . : wikipedia-lb.wikimedia.org
         .......
         .......
Това са кешираните заявки от DNS Client service.

ipconfig/flushdns

Това изтрива локалният кеш на dns client service. Понякога този service прави проблеми. Ако правите някакви промени по DNS записи, най-добре е този service да бъде спрян докато правите тестовете.

При спян DNS Client service не се кешира нищо на локалния компютър а за всяко DNS запитване се пита dns cache сървъра. При пуснат service, веднъж получен отговор от DNS cache сървъра, записът се кешира локално както се вижда и по-горе (Time To Live  . . . . : 233 примерно).

Парадоксът: Нямам интернет, но имам Skype!

Когато това нещо се получи вероятността проблемът да е в DNS сървърите които ползвате е около 99%. Как можем да го тестваме? Аз използвам публчните DNS cache сървъри на google който са достъпни за всички и най-вече се помнят много лесно. Ето ги:

google public dns cache 1: 8.8.8.8
google public dns cache 2: 8.8.4.4

Ако имате Skype, но "нямате интернет" винаги може да въведете един от тези DNS сървъри и да пробвате дали вече "имате интернет".

Tuesday, January 17, 2012

String replacing in VIM.


To replace a string with vim do the following:
:%s/string/replace string/g
% - means search and replace in whole file
If you want to replace stuff in certain portion of the file you can do following:

:20,50 s/string/replace string/g
:20,50 will search and replace string in rows between 20 and 50

Escaping special chars with \. Look at following example. I need to replace /usr/src/ with /var/log/archive in one of my scripts:
:%s/\/usr\/src/\/var\/log\/archive/g

Sunday, December 4, 2011

PowerMac G4/1Ghz with Nvidia GeForce 440mx notes

Just a few notes for OpenFirmware, Xorg configuration. Sources guide-open-firmware-apple-bios-0, xorgconf-powermac-g41ghz-geforce-4-mx-apple-studio-display-17, http://sowerbutts.com/linux-mac-mini/.

OpenFirmware:
  • ls - displays contents of the current path in the device tree.
  • devalias - provides a list of short alias names for key hardware devices.
  • .properties - provides a list of properties for the selected device.
  • pwd - displays the current path within the device tree.
  • dev - selects a device (using either the alias or absolute/relative device tree path).
  • words - provides a list of forth scripts associated with the selected device.
  • source - executes a particular forth script.
  • load - loads a image from disk, cd, network or another device.
  • go - execites the currently loaded image.
  • see - displays the source code for a particular forth script.
Booting installation of Debian GNU/Linux Squeeze 6.0 on PowerMac G4/1Ghz: 
0>boot cd:,\install\yaboot
 Partition disk:
1. Don't touch the small Partition #1 at the start of the disk, that contains the partition map itself.
2. Partition #2 (16MB) is for "yaboot", the bootstrap that allows you to boot

3. Linux or MacOS. You want to tell the partitioner to use that partition as a "NewWorld boot partition", and set the bootable flag.
4. Partition #3 (2.0GB) should be used as "swap area".
5. Partition #4 (48.0GB) is your root filesystem, you want to use that as a "ReiserFS journalling file system", format it, and mount it on "/"
 Booting after installation:
0>setenv boot-file hd:3,\yaboot

Xorg.conf PowerMac G4/1GHz GeForce 4 MX:

Section "Device"
Identifier "Configured Video Device"
BusID   "PCI:0:16:0"
Driver  "nv"
EndSection

Section "Monitor"
    Identifier    "StudioDisplay17"
    Option "DPMS"
    HorizSync   30-80
    VertRefresh   50-100
EndSection

Section "Screen"
    Identifier    "Default Screen"
    Monitor        "StudioDisplay17"
    Device        "Configured Video Device"
        DefaultDepth    24
           SubSection       "Display"
             Depth            24
             Modes             "1280x1024" "1024x768" "800x600" "640x480"
           EndSubSection
           SubSection        "Display"
             Depth            16
             Modes             "1280x1024" "1024x768""800x600" "640x480"
           EndSubSection
SubSection "Display"
      Depth      15
      Modes      "1280x1024" "1024x768" "800x600" "640x480"
   EndSubSection
SubSection "Display"
      Depth      8
      Modes      "1280x1024" "1024x768" "800x600" "640x480"
   EndSubSection
SubSection "Display"
      Depth      4
      Modes      "1280x1024" "1024x768" "800x600" "640x480"
   EndSubSection
SubSection "Display"
      Depth      1
      Modes      "1280x1024" "1024x768" "800x600" "640x480"
   EndSubSection
EndSection

Section "ServerLayout"
   Identifier   "Default Layout"
   Screen      "Default Screen"
EndSection

Section "DRI"
   Mode   0666
EndSection




Monday, November 28, 2011

Изложба на Иван Христов - Грога, 15.12.2011 - галерия Аспект - Пловдив


На 15.12.2011г. габровският художник Иван Христов - Грога (всъщност това е баща ми) открива самостоятелна изложба в Пловдив - галерия "Аспект", площад "Стефан Стамболов" 1А (до общината). Откриването е между 16:00 - 20:00 часа.


За повече информация може да посетите сайта му http://groga.gabrovo.com/ а също така и на facebook страницата му: http://www.facebook.com/...

Monday, November 14, 2011

Втори и трети опит за домашна бира.

След успеха на първият опит си поръчах още 2 кита. Правих ги един след друг с разлика няколко дена. Изборът ми се спря на Multons Premium Bitter (светла) и Midland Mild Ale (тъмна).


Ферментацията става по вече описания от мен начин. Важно е просто да се спазват инструкциите.

Midland Mild Ale - до момента на мен не ми беше харесвала тъмна бира. Пробвал съм почти всички които ги има на пазара (за бутилираните говоря) но така и не повторих. Тази мога да кажа че беше супер без никакви забележки. Трябва да отблежа че не харесвам много горчиви бири а това е Ейл който по принцип трябва да е сладникав.


Premium Bitter - това трябва да е типичен английски битер и може би за това на мен не ми хареса. Прекалено ми е горчива. От друга страна родителите ми много я харесаха от което следва че всичко е до въпрос на вкус. Просто трябва да се пробва.

Следващото което ще тествам е пак на Muntons Export Pilsner.

Tuesday, October 18, 2011

Fix console font on NetBSD 5.1/macppc

One of annoying things about booting NetBSD 5.1 on PowerMAC G4 after install is console font which is too big to fit in screen. Today I found solution on port-macppc mailing list. You can see it here http://mail-index.netbsd.org/port-macppc/2011/10/18/msg001479.html.

Edit your kernel config file to look like this:

#options    FONT_GALLANT12x22
options       FONT_VT8x8
then recompile and reboot.