04 สิงหาคม 2558

Resolve : Could not connect to internet because DNS do not responding

เนื่องจากวันนี้ได้เอา Laptop ของตัวเอง ไปต่อ Home Network ของทางบ้าน แต่ไม่สามารถ เชื่อมต่อ Internet ได้ แต่สามารถ Access เข้า Router ตัวที่เป็น DHCP Server ได้ ลอง Access Modem ที่เป็นตัวเชื่อมต่อ Internet ก็สามารถทำได้ หรือจะเอา Router ตัวที่เป็น DHCP Server  ping ไปหา google ก็ทำได้ ลอง ใช้ Ipad ต่อ internet ก็ทำได้ ก็เลยสรุปว่า Laptop เราเองนี่แหละที่เป็นปัญหา ก็เลย ลองหาสาเหตุดู ก็ได้รับคำตอบว่า DNS Server isn't responding ก็เลยลอง Reset tcp/ip ดู โดยใช้ Utility ของ Microsoft เองนี้แหละ
วิธีทำก็เปิด Command line ขึ้นมา โดยเข้าไปที่ run หรือจะใช้ shortcut windows + r ก็ได้ไม่ว่ากัน หลังจากนั้นก็พิมพ์ cmd แล้วก็กด OK หรือปุ่ม enter ถึง step นี้  command line ก็จะพร้อมให้ใช้งานแล้ว ต่อจากนั้น พิมพ์
 netsh int ip reset
ก็เป็นอันเสร็จพิธี รีเซ็ต tcp/ip หลังจาก reset tcp/ip แล้วก็จำเป็นที่จะต้อง restart เครื่อง 1 รอบ เพื่อให้ windows ทำการ ค้นหา network ใหม่ แต่หลังจาก restart เครื่องกลับมาก็สามารถ ใช้งาน internet ได้

reference site [english] : https://support.microsoft.com/en-us/kb/299357
reference site [thai] : https://support.microsoft.com/th-th/kb/299357


23 กรกฎาคม 2558

Mikrotik Script update ddns for No-IP

กับบทความที่แล้วที่ทำให้กับ DYNDNS host กันมาแล้วในบทความนี้ก็ขอเอาใจคนใช้ No-IPหน่่อย เนื่องจาก script ที่ได้จาก wiki ของ mikrotik นั้น พอใช้กับ ADSL ของ true แล้วดันไม่อัพเดทเป็น ip ของ router แต่ไป update public ip เลยกลายเป็นว่า ไม่สามารถ ใช้งานได้

environment ที่ใช้ในการ config 
mikrotik routerboard model : RB951G-2HnD
software version : 6.30
ddns : no-ip host

ISP : true internet ADSL

script ที่ใช้ ก็ตามนี้นะครับ

# Define User account&Host ddns Variables
:global ddnsuser "username"
:global ddnspass "password"
:global ddnshost "***.no-ip.**"
# Define Global Variables
:global ddnsip
:global ddnslastip
:if ([ :typeof $ddnslastip ] = nil ) do={ :global ddnslastip "0" }
:global ddnssystem ("mt-" . [/system package get system version] )
# Grab the current IP address on pppoe-out1 interface.
:global ddnsip [ /ip address get [/ip address find interface="pppoe-out1" ] address ]
:global ddnsip [:pick $ddnsip 0 [:find $ddnsip "/"]]
# Did we get an IP address to compare?
:if ([ :typeof $ddnsip ] = nil ) do={
   :log info ("DynDNS: No ip address present on pppoe-out1 interface , please check.")
} else={
# NORMAL ROUTINE FOR RUN WHEN CHANGE IP
  :if ($ddnsip != $ddnslastip) do={
    :log info ("No-IP: Sending UPDATE! IP:".$ddnsip)
    :local str "http://$ddnsuser:$ddnspass@dynupdate.no-ip.com/nic/update\?hostname=$ddnshost&myip=$ddnsip"
    /tool fetch url=$str
    :delay 1
    :local str [/file find name="No-IP.$ddnshost"];
    /file remove $str
    :global ddnslastip $ddnsip
    }
  }
เวลาใช้ก็ปรับแก้ส่วน ddnsuser, ddnspass แล้วก็ ddnshost ได้เลยครับ
ส่วน ใครที่ปรับแก้ interface pppoe-out1 ไป ก็ต้องไปแก้ชื่อให้ตรงด้วยนะครับ ไม่อย่างนั้นมันจะหยิบ ip ไป update no-ip ผิดนะครับ
หลังจากที่เราสร้าง script เสร็จเรียบร้อยเราก็ไปสร้าง scheduler มาเพื่อเรียก script ที่เราสร้างก็เป็นอันจบ ขั้นตอน เท่านี้ ก็จะสามารถ update ddns ไปให้ no-ipได้เรียบร้อยครับ

11 กรกฎาคม 2558

Script Mikrotik update DDNS

ไม่ได้เข้ามา update blog ซะนาน ก็ขอเขียน script เอาใจคนที่หันมาเล่นกับ routerboard ซะหน่อย เนื่องจากทาง เจ้าของ blog เองก็ได้ ให้ความสนใจกับตัวนี้แล้วก็มีปัญหา จากการ update ddns ของ dyndns ผ่าน เจ้า mikrotik เหมือนกัน เนื่องจาก script ที่ได้จาก wiki ของ mikrotik นั้น พอใช้กับ ADSL ของ true แล้วดันไม่อัพเดทเป็น ip ของ router แต่ไป update public ip เลยกลายเป็นว่า ไม่สามารถ ใช้งานได้

environment ที่ใช้ในการ config 
mikrotik routerboard model : RB951G-2HnD
software version : 6.30
ddns : dyndns host

ISP : true internet ADSL

script ที่ใช้ ก็ตามนี้นะครับ

# Define User account&Host ddns Variables
:global ddnsuser "username"
:global ddnspass "password"
:global ddnshost "***.dyndns.**"
# Define Global Variables
:global ddnsip
:global ddnslastip
:if ([ :typeof $ddnslastip ] = nil ) do={ :global ddnslastip "0" }
:global ddnssystem ("mt-" . [/system package get system version] )
# Grab the current IP address on pppoe-out1 interface.
:global ddnsip [ /ip address get [/ip address find interface="pppoe-out1" ] address ]
:global ddnsip [:pick $ddnsip 0 [:find $ddnsip "/"]]
# Did we get an IP address to compare?
:if ([ :typeof $ddnsip ] = nil ) do={
   :log info ("DynDNS: No ip address present on pppoe-out1 interface , please check.")
} else={
# NORMAL ROUTINE FOR RUN WHEN CHANGE IP
  :if ($ddnsip != $ddnslastip) do={
    :log info ("DynDNS: Sending UPDATE! IP:".$ddnsip)
    :local str "/nic/update\?hostname=$ddnshost&myip=$ddnsip&wildcard=NOCHG&mx=NOCHG&backmx=NOCHG"
    /tool fetch address=members.dyndns.org src-path=$str mode=http user=$ddnsuser \
        password=$ddnspass dst-path=("/DynDNS.".$ddnshost)
    :local str "http://$ddnsuser:$ddnspass@members.dyndns.org/nic/update\?hostname=$ddnshost&myip=$ddnsip&wildcard=NOCHG&mx=NOCHG&backmx=NOCHG"
    /tool fetch url=$str
    :delay 1
    :local str [/file find name="DynDNS.$ddnshost"];
    /file remove $str
    :global ddnslastip $ddnsip
    }
  }
เวลาใช้ก็ปรับแก้ส่วน username, password แล้วก็ dyndns host ได้เลยครับ
ส่วน ใครที่ปรับแก้ interface pppoe-out1 ไป ก็ต้องไปแก้ชื่อให้ตรงด้วยนะครับ ไม่อย่างนั้นมันจะหยิบ ip ไป update dyndns ผิดนะครับ
หลังจากที่เราสร้าง script เสร็จเรียบร้อยเราก็ไปสร้าง scheduler มาเพื่อเรียก script ที่เราสร้างก็เป็นอันจบ ขั้นตอน เท่านี้ ก็จะสามารถ update ddns ไปให้ dyndns ได้เรียบร้อยครับ

26 กรกฎาคม 2555

ขั้นตอนการ save spool file จาก AS/400 to PC


1. สร้าง Physical files ก่อนโดยใช้ Command CRTPF โดยกำหนด ชื่อ File และ Library ที่ต้องการจะลง และเปลี่ยน Record Length ให้เป็น 150

                          Create Physical File (CRTPF)                        
                                                                               
 Type choices, press Enter.                                                    
                                                                               
 File . . . . . . . . . . . . . . > SPOOLFILE     Name                        
   Library  . . . . . . . . . . .     *CURLIB     Name, *CURLIB                
 Source file  . . . . . . . . . .   QDDSSRC       Name                        
   Library  . . . . . . . . . . .     *LIBL       Name, *LIBL, *CURLIB        
 Source member  . . . . . . . . .   *FILE         Name, *FILE                  
 Record length, if no DDS . . . . > 150           Number                      
 Generation severity level  . . .   20            0-30                        
 Flagging severity level  . . . .   0             0-30                        
 File type  . . . . . . . . . . .   *DATA         *DATA, *SRC                  
 Member, if desired . . . . . . .   *FILE         Name, *FILE, *NONE          
 Text 'description' . . . . . . .   *SRCMBRTXT                                
                                                                               
                                                                               
                                                                               
                                                                               
                                                                               
                                                                        More...
 F3=Exit   F4=Prompt   F5=Refresh   F12=Cancel   F13=How to use this display  
 F24=More keys              
                                                                                                 

           
หลังจาก นั้นกด F10 เพื่อใส่ Additional data  
                                                                               
                        Additional Parameters                              
                                                                               
 Source listing options . . . . .                 *SRC, *NOSRC, *SOURCE...    
                + for more values                                              
 System . . . . . . . . . . . . .   *LCL          *LCL, *RMT, *FILETYPE        
 Expiration date for member . . .   *NONE         Date, *NONE                  
 Maximum members  . . . . . . . .   *NOMAX        Number, *NOMAX              

 Access path size . . . . . . . .   *MAX1TB       *MAX1TB, *MAX4GB            

 Access path logical page size  .   *KEYLEN       *KEYLEN, 8, 16, 32, 64...    
 Access path maintenance  . . . .   *IMMED        *IMMED, *DLY, *REBLD        

 Access path recovery . . . . . .                 *NO, *AFTIPL, *IPL          

 Force keyed access path  . . . .   *NO           *NO, *YES                    
                                                                               
                                                                               
                                                                               
                                                                        More...
 F3=Exit   F4=Prompt   F5=Refresh   F12=Cancel   F13=How to use this display  
 F24=More keys
                                                               
                              Create Physical File (CRTPF)                                                                                                          Type choices, press Enter.                                                  
 

 Member size:                                                                      Initial number of records  . . > *NOMAX        1-2147483646                     Increment number of records  .                 Number                      
 

   Maximum increments . . . . . .                 Number                      
 

 Allocate storage . . . . . . . .   *NO           *NO, *YES                      Contiguous storage . . . . . . .   *NO           *NO, *YES                      Preferred storage unit . . . . .   *ANY          1-255, *ANY, *SSD              Records to force a write . . . .   *NONE         Number, *NONE                  Maximum file wait time . . . . .   30            Seconds, *IMMED, *CLS          Maximum record wait time . . . .   60            Seconds, *NOMAX, *IMMED        Share open data path . . . . . .   *NO           *NO, *YES                      Max % deleted records allowed  .   *NONE         1-100, *NONE                   Reuse deleted records  . . . . .   *NO           *YES, *NO                      Sort sequence  . . . . . . . . .   *SRC          Name, *SRC, *JOB...              Library  . . . . . . . . . . .                 Name, *LIBL, *CURLIB          Language ID  . . . . . . . . . .   *JOB          Character value, *JOB                                                                           More...  F3=Exit   F4=Prompt   F5=Refresh   F12=Cancel   F13=How to use this display    
 F24=More keys                                                                 
                                                                                                                                                           
พอได้ Physical File เสร็จ ก็ถึงคราวที่เราจะ Copy Spool file มาลงแล้ว
2.  การ Copy spool file จะใช้ Command CPYSPLF
โดย ค่าต่างๆนั้นสามารถ ดูได้จาก Command WRKSPLF
เมื่อเรากรอกค่าเสร็จก็กด Enter เป็นอันจบพิธี การ Copy spool file ลง physical file
                           Copy Spooled File (CPYSPLF)                        
                                                                               
 Type choices, press Enter.                                                    
                                                                               
 Spooled file . . . . . . . . . .                 Name                        
 To data base file  . . . . . . .   SPOOLFILE     Name                        
   Library  . . . . . . . . . . .     *LIBL       Name, *LIBL, *CURLIB        
 Job name . . . . . . . . . . . .   *             Name, *                      
   User . . . . . . . . . . . . .                 Name                        
   Number . . . . . . . . . . . .                 000000-999999                
 Spooled file number  . . . . . .   *ONLY         1-999999, *ONLY, *LAST, *ANY
 Job system name  . . . . . . . .   *ONLY         Name, *ONLY, *CURRENT, *ANY  
 Spooled file created:                                                        
   Creation date  . . . . . . . .   *ONLY         Date, *ONLY, *LAST          
   Creation time  . . . . . . . .                 Time, *ONLY, *LAST          
 To member  . . . . . . . . . . .   *FIRST        Name, *FIRST                
 Replace or add records . . . . .   *REPLACE      *REPLACE, *ADD              
                                                                               
                                                                               
                                                                               
                                                                         Bottom
 F3=Exit   F4=Prompt   F5=Refresh   F10=Additional parameters   F12=Cancel    
 F13=How to use this display        F24=More keys                      
        
                                                                                                     
หลังจากได้ Physical file แล้วก็ทำการ FTP จาก AS/400 ลง PC ได้ตามปกติ