Home
        Moxa C Programmable RTU Controllers User`s Manual
         Contents
1.                            1 d OXA RTUAdmin  2     File System Sort Help p   g A A AE  3   68 4  die ies    Server Name Model IP Address MAC Address Subnet Mask  aa GA RIRE 1 ioPacsozo ioP    192 168 127 254 00 90 E8 32 43 14 255 255 255 0  PS Tees 2 ioPAC8020 ioP    192 168 127 254 00 90 E8 AB AB AB 255 255 255 0  E ioPACs0z0 ioP    192 168 127 254 00 90 E8 11 57 A3 255 255 255 0  4  5  6  7 0 00 22 16  1  Title 2  Menu Bar 3  Quick Link 4  Navigation Panel  5  Main Window 6  Sync  Rate Status 7  Status Bar  Title    It displays the program that is running  In this case  it is Moxa RTUAdmin     2 12    Moxa C Programmable RTU Controllers Getting Started       Menu Bar    The Menu bar has four items  File  System  Sort  and Help    File   Use the File Exit to close the RTUAdmin    System  a  Auto Search  Searches for Moxa RTU controllers on the local network   b  Network Interface  Selects a network interface to use the RTUAdmin     c  Auto Search Timeout  Selects the preferred timeout value for broadcast search     Sort  a  By Connection  Sorts by the target Moxa RTU controller   s IP address     b  By Server  Sorts by the target Moxa RTU controller   s model name     Help  Displays the software information of the RTUAdmin                    Quick Link  Icon Function  pr Auto Search  3 S Sort by Connection    Sort by Server                Navigation Panel    Lists the current search result     Main Window    Displays the detailed information about the Moxa RTU controllers th
2.               No  Pin Assignments  1 Tx   2 Rx   3 N A   4 GND             Serial Console                            Baudrate 115200 bps  Parity None   Data bits 8   Stop bits  1   Flow Control None  Terminal VT100          To connect to the RTU   s serial console  Moxa PComm Terminal Emulator is recommended to be used as the  console terminal  In the following steps  we describe how to connect the console     STEP 1  Find the Moxa PComm Lite from the Moxa website  www moxa com  or Document and Software CD   Software  utility PComm     STEP 2  Install the Moxa PComm Lite to the host Windows PC   STEP 3  Run the PComm Lite Terminal Emulator from Start Programs PComm Lite Ver 1 x Terminal Emulator     STEP 4  Click on Profile Open     2 8    Moxa C Programmable RTU Controllers Getting Started       ES PComm Terminal Emulator      Profile Port Manager Help    meles izle           STEP 5  Specify the COM port that is connecting the RTU controller  and configure the settings to 115 200  8   none  and 1     Communication Parameter   Terminal   File Transfer   Capturing         Protocol    Serial y     Serial Parameters  Bond rate  z  T User defined  Data bits  fe     Parity   None h    Sophie  E   Flow control  J  RTSICTS  T DTR DSR  T XON XOFF       RTS state     ON C OFF  DTR state     ON C OFF                STEP 6  Click on the Terminal tab  and configure the Terminal Type to VT100  Click OK to proceed     TI            xt    Communication Parameter Terminal   File Transfer   C
3.     0 1   FSR   25  C  ml      an mo  mu  sE  i  0 3   FSR O  40  C  75  C  F v D w  gt   mu      D m9 Sampling Rate    e E le     All channels  12 samples sec  252 K wG   Y KO Per channel  1 5 samples sec      K ae E N G Over Current Protection  200 mA per channel  CE BEG SG i x r 7 r  A wh   i  Isolation  I O to logic  photocoupler isolation   Seh  gt  vL   ii Channel to Channel Isolation  2 5K VDC  7  gt  il Operating Temperature   40 to 75  C  D y Power Consumption  30 mA   24 VDC  typical              I O Cable Wire  AWG 14  2 0 mm x mm  max     The 9th slot of the ioPAC 8020 9 series is reserved for future expansion  All I O modules may only be installed  in slot 1 through slot 8        4 port unmanaged Ethernet Switch Module    16 channel 24 VDC Digital Input Module  KM 2430 T  4 port unmanaged Ethernet switch module   with M12 connector  Om Standards   Ke IEEE 802 3 for 10BaseT  IEEE 802 3u for 100BaseT X      IEEE 802 3ab for 1000BaseT X   o IEEE 802 3x for Flow Control  Processing Type  Store and Forward     Interface  Front cabling  M12 connector  10 100BaseT X  auto     negotiation speed  Operating Temperature   40 to 75 C     Power Consumption  20 mA   24 VDC  typical     B 3    
4.     nameserver    command  For example  add the following line to  etc resolv conf if the DNS server s IP  address is 168 95 1 1     nameserver 168 95 1 1    107 T20  534 100  Saran iy    root Moxa  etc  cat resolv conf    T      resolv conf This file is the resolver configuration file      See resolver  5          nameserver 192 168 1 16  nameserver 168 95 1 1  nameserver 140 115 1 31  nameserver 140 115 236 10    root Moxa   etc         etc  nsswitch conf    This file defines the sequence to resolve the IP address by using  etc hosts file or  etc resolv conf     4 2    Moxa C Programmable RTU Controllers Managing Communications       Web Service   Apache    The Apache web server   s main configuration file is  etc apache conf httpd conf  with the default  homepage located at  home httpd htdocs index html  Save the customized homepage to the following  directory      home httpd htdocs   Save the customized CGI page to the following directory    home httpd cgi bin     Before modifying the homepage  use a browser from the host PC to perform a test to see if the Apache Web  Server is working  Type the LAN IP address of the target RTU controller in the browser   s address box to open  the homepage  E g   http   192 168 127 254       192 168 127 254      C    192 168 127 254    Moxa RTU controller       To open the default CGI page  type http   192 168 127 254 cgi bin test cgi in the browser   s address  box     Q 192 168 127  254 c gi bin test    e       192 168 127 254 cgi bin 
5.    dev mtdblock2 6 7M 9 3M 42      dev ram0 17 0k 457 0k 4   var   dev mtdblock3 896 0k 11 1M 7   tmp     dev mtdblock3 896 0k 11 1M 7   home   dev mtdblock3 896 0k 11 1M    etc  tmpfs 0 30 4M 0   dev shm  root Moxa   bin        Checking the  dev mtdblock3 to see if the available space is over 3 MB     Step 2  Perfrom upramdisk command to create a temporary RAM disk to download and save the package                 root Moxa  bin  upramdisk   root Moxa  bin  df  h   Filesystem Size Used Available Use  Mounted on   dev mtdblock2 16 0M 6  7M 9 3M 42      dev ram0 499 0k 18 0k 456 0k 4   var   dev mtdblock3 12 0M 896 0k 11 1M 7   tmp     dev mtdblock3 12 0M 896 0k 11 1M 7   home   dev mtdblock3 12 0M 896 0k 11 1M 7   etc    tmpfs 30 4M 0 30 4M 0   dev shm   dev raml 31 9M 1 0k 30 3M 0   var ramdisk  rootfMoxa  bin        4 4    Moxa C Programmable RTU Controllers Managing Communications       Step 3  Download the PHP package  Users can locate the package in Software and Document  CD Software php php tgz                root Moxa  bin  cd  mnt ramdisk  root Moxa  mnt ramdisk  ftp 192 168 127 130  Connected to 192 168 127 130    220  vsFTPd 2 0 1    Name  192 168 127 130 root      root 331 Please specify the password     Password    230 Login successful    Remote system type is UNIX    Using binary mode to transfer files    ftp gt  bin   200 Switching to Binary mode    ftp gt  get php tgz   local  php tgz remote  php tgz   200 PORT command successful  Consider using PASV    150 Open
6.   SYNC Rate  atar 2 14   Status     ae ee een E eee eee eee 2 14   Configuring  the Ethernet Interface ml at ad dd iaa 2 14  Modifying Network Settings via Serial Console cesses eee ee ree rere 2 14  SUAS IP   ddressSES ii A dd 2 14   Dyna Mic Tele ln ei ees 2 14   Add a DA E A E E na OE EO GEE ee eee 2 15  Adding DNS as sle TTT 2 15  Developing  ProCCAUIES aaa VRAN RORA aaa aia 2 15  Installing the Tool Chain   Linux     reee 2 16  Checking the Flash Memory Space  eee ee r e r re e K e K e K e K KK KKK 2 16  C  mpiling S     Le excesses eee dada 2 16  Uploading and Running the    Hello    PrograM oo    sneri Ennen E SREE EEEE ARENIE TR 5729753523757554 enna vv 2 17   3  Managing the RTU Controllers    ccccccccccecececeeeeeeeeveveveeaeaeaeceneneueeeeeeeeeueeeueueueuavavaeaeaeeseeeeeeeeuauauaueuuausuanags 3 1  SYSTEM  Version  Informati  n      sss aaa 3 2  Firmware Upgrade and Default Settings  seer eee ree eee eee ree re rrer 3 2   Upgrading the FiInMWare zesten er tee ctor ver epete ter sted ieted a ufeucu teense eutete tev eteteteeeteey ieee 3 2  Loading Factory Deal a eat teeta tee tect A RRR ERa se 3 3  Enabling and Disabling    Daemons iii 3 3    Setting the RU ass 3 5    AISI e SV eten T FOS a E E N a aR d e ZR aN YR ZSS 3 6    Setting  the Time  Manually Sysser tere tetadadedex eftv eter et eretyey tote t wees ten yoeesaeieuestersestes 3 6  Updating the Time with NTP CLCNt    sse ee ee ree ree rere 3 6  Updating  the  Time Automatically   a     csecieetecneranecutecet
7.   convenient to connect field serial devices  The pin assignment is shown below                          Pin  RS 232  RS 422 2W RS 485  4W RS 485   4 5 1 DCD TxD  A      2 RXD TxD  B           3 TXD RxD  B  Data  B   J 5 GND GND GND  6 9 6 DSR       7 RTS       8 CTS       9 RI                          After connecting the RTU controller to the power supply  it will take about 30 to 60 seconds for the operating  system to boot up  The green Ready LED will not turn on until the operating system is ready     ATTENTION    This product is intended to be supplied by a Listed Power Unit with output marked    LPS    and rated for 12 to 36  VDC  1 2A  minimum requirements     2 6          Moxa C Programmable RTU Controllers Getting Started       LED Indicators      OPAC 8020 C Series                                              Mark Function Description  Power Power input OFF  No system power available  Green  Power on  Serial Serial communication activity OFF  No serial communication  Green  Serial Tx Rx  I O Tool chain API control Green Red Off  Controlled by API  Ready System status Green  System ready  System status Red  System error  System status Green Flashing  System booting  Tool chain API control Green Red Off  After booting up  the API is  able to control this LED  Port1 2 Ethernet communication activity Off  Ethernet disconnected  Green Flashing  Ethernet Tx Rx         0OLogik W5348 C Series                                              Mark Function Description   PWR Powe
8.  HHHH HHH HHR HHHH HHRHH HHH  HHH HHH HHH HHH HHH Hu HHH  HHH HHHH Hu Hu Hitt   HHHH  HHHH   Hitt HHH HHH HH HH H  tit   HHR Hu HHHH H un   HHH HH Hu Hu HHHH   HHH   Hi H Hu uu Hitt HEE   HR 4 HHR HHR HHT 4 Hu   HHR HHR HHH HR HHR   HHH   HHH Hu uu Hu HHH HH Hu   HHR HH Hu H HHH   Hu   HHH    HERH HH EIEEEI PEIEE THEE    For further information check   http   www moxa com     rootBMoxa     H       You can proceed with configuring the network settings of the target RTU controller when you reach the bash  command shell  Configuration instructions are given in the next section     Users can perform the    logout    command to terminate the console     ATTENTION    Serial Console Reminder  Remember to choose VT100 as the terminal type  Use the cable CBL 4PINDB9F 100  which comes with the RTU  controller  to connect to the serial console port     Telnet Reminder  When connecting a PC to the RTU controller over a LAN  users must configure the PC s Ethernet IP address to  be on the same subnet as the RTU controller     For operating system that does not have    telnet    commands  such as Windows 7  intall the RTUAdmin utility  from the Document and Software CD to perform network access to the RTU Controller        2 10    Moxa C Programmable RTU Controllers Getting Started       SSH Console    The RTU controller supports an SSH console to provide users with better security options     Windows Users    Click on the link http   www chiark greenend org uk  sgtatham putty download html
9.  If there isn   t enough    Available    space for user s program  users must delete some existing files  To do this   connect the host PC to the RTU controller with the console cable  and then use the console utility to remove the  none using files from the flash memory  To check the amount of available space  look at the directories in the  read write directory  dev mtdblock3  Note that the directories  home and  etc are both mounted on the  directory  dev mtdblock3     NOTE If the flash memory is full  users must release some memory space before saving files to the Flash ROM     Compiling Hello c  The Software and Document CD contains an example Hello c program allowing users to run pilot tests to the  RTU controller  Type the following commands from the host PC to copy the files used for this example       cd  tmp     mkdir example    cp  r  mnt cdrom example hello    tmp example    To compile the program  go to the Hello subdirectory and issue the following commands       cd example hello    make    2 16    Moxa C Programmable RTU Controllers Getting Started       NOTE    Users should see the following response      root localhost hello   make     usr local arm linux bin arm linux gcc  o hello release hello c     usr local arm linux bin arm linux strip  s hello release     usr local arm linux bin arm linux gcc  ggdb  o hello debug hello c   root localhost hello   _       The hello release and hello debug are described as below    hello release   An ARM platform executabl
10.  NOTE    PPP  Point to Point Protocol  is used to run IP  Internet Protocol  and other network protocols over serial  connection  PPP can be used for direct serial connections  using a null modem cable  over a Telnet link  and for  links established using a modem over a telephone line     Modem and PPP access is almost identical through the RTU controller   s Ethernet port  Since PPP is a  peer to peer system  the RTU controller can also use PPP to link two networks  or a local network to the  Internet  to create a Wide Area Network  WAN      Click on the following links for more information about ppp   http   tldp org HOWTO PPP HOWTO index html  http   axion physics ubc ca ppp linux html          The pppd daemon is used to connect to a PPP server from a Linux system  For detailed information about pppd  see the man page     4 11       Moxa C Programmable RTU Controllers Managing Communications       Example 1  Connecting to a PPP Server over a Simple Dial up    Connection  The following command is used to connect to a PPP server by modem  Use this command for old ppp servers  that prompt for a login name and password  Note that debug and default route 192 1 1 17 are optional      pppd connect    chat  v         ATDT5551212 CONNECT       ogin  username word  password      dev ttyMO 115200 debug crtscts modem defaultroute    If the PPP server does not prompt for the username and password  the command should be entered as follows   Replace username with the correct username and
11.  addresses used on one network to different IP  addresses used on another network  One network is designated the inside network and the other is the outside  network  Typically  the RTU controller connects several devices on a network  maps local inside network  addresses to one or more global outside IP addresses  and un maps the global IP addresses on incoming  packets back into local IP addresses     NOTE Click on the following links for more information about iptables and NAT   http   www netfilter org documentation HOWTO NAT HOWTO html          NAT Example    The IP address of LAN1 is changed to 192 168 127 254  you will need to load the module ipt_MASQUERADE      IP Netmask  192 168 3 100 24  Gateway  192 168 3 127       PC1  Linux or Windows                 LAN1  192 168 3 127 24  Embedded Computer                LAN 2  192 168 4 127 24             PC2  Linux or Windows        IP Netmask  192 168 4 100 24  Gateway  192 168 4 127    NAT Area   Private IP     echo 1  gt   proc sys net ipv4 ip_forward    modprobe ip_tables    modprobe iptable_filter    modprobe ip_conntrack    modprobe iptable_nat    modprobe ipt_MASQUERADE    iptables  t nat  A POSTROUTING  o ethO  j SNAT   to source 192 168 127 254   iptables  t nat  A POSTROUTING  o ethO  s 192 168 127 0 24  j MASQUERADE    ee OO  Re ae SINS ES    Enabling NAT at Bootup    In most of the situations  you will want to use a simple shell script to enable NAT when the RTU controller boots  up  The following script is an ex
12.  controller with dual RJ45 Ethernet LAN ports and 5 I O  slots  C programming capability   40 to 75  C operating temperature    ioPAC 8020 9 M12 C T  ioPAC 8020 modular RTU controller with dual M12 Ethernet LAN ports and 9 I O  slots  C programming capability   40 to 75  C operating temperature    ioPAC 8020 9 RJ45 C T  ioPAC 8020 modular RTU controller with dual RJ45 Ethernet LAN ports and 9 I O  slots  C programming capability   40 to 75  C operating temperature    RM 1602 T    oPAC I O module with 16 digital inputs  24 VDC sink source type   40 to 75  C operating  temperature    RM 1050 T    oPAC I O module with 10 digital inputs  110 VDC   40 to 75  C operating temperature  RM 2600 T  ioPAC I O module with 16 digital outputs  24 VDC sink type   40 to 75  C operating temperature  RM 3802 T    oPAC I O module with 8 analog inputs  4 to 20 mA   40 to 75  C operating temperature  RM 3810 T  ioPAC I O module with 8 analog inputs  0 to 10 V   40 to 75  C operating temperature  KM 2430 T  ioPAC 4 port unmanaged Ethernet swtich module with M12 connector   40 to 75  C operating temperature  Conformal Coating  Available on request    The 9th slot of the ioPAC 8020 9 series is reserved for future expansion  All I O modules may only be installed  in slot 1 through slot 8        ioLogik W5348 C Series    ioLogik W5348 HSDPA C  HSDPA micro RTU controller with 4 AIs  8 DIOs  2 relay outs  C programming  capability   10 to 55  C operating temperature    ioLogik W5348 HSDPA C T  HSDPA mic
13.  developer axis com software jffs   http           www linux mtd infradead or    Software Package       Boot Loader Moxa Boot Loader  v1 2        Kernel Linux 2 6 9  ioLogik W5348 V1 4 supports Linux 2 6 38        Protocol Stack ARP  PPP  CHAP  PAP  IPv4  ICMP  TCP  UDP  DHCP  FTP  HTTP  NTP  NFS  SMTP  SSH    1 0 2 0  SSL  Telnet  PPPoE  OpenVPN       File System JFFS2  NFS  Ext2  Ext3  VFAT FAT       OS shell command Bash                               Busybox Linux normal command utility collection  Utilities   telnet Telnet client program   ftp FTP client program   Daemons   pppd Dial in out over serial port daemon  telnetd Telnet server daemon   inetd TCP server manager program   ftpd FTP server daemon   apache Web server daemon       1 3       Moxa C Programmable RTU Controllers Introduction                                              sshd Secure shell server  openvpn Virtual private network  openssl Open SSL   Linux Tool Chain   Gcc  V3 3 2  C C   PC Cross Compiler  GDB  V5 3  Source Level Debug Server  Glibc V2 2 5  POSIX standard C library  Linux Tool Chain  ioLogik W5348 V1 4    Gcc  V4 4 2  C C   PC Cross Compiler  GDB  V7 0 1  Source Level Debug Server  Glibc  V2 10 1  POSIX standard C library       Available Products    ioPAC 8020 C Series    NOTE    ioPAC 8020 5 M12 C T  ioPAC 8020 modular RTU controller with dual M12 Ethernet LAN ports and 5 I O  slots  C programming capability   40 to 75  C operating temperature    ioPAC 8020 5 RJ45 C T  ioPAC 8020 modular RTU
14.  from one  internal network to access users at the remote site  For this system  all data is transmitted by UDP packets on  port 5000 between OpenVPN peers     7  To shut down OpenVPN programs  type the command     killall  TERM openvpn    Setup 2  Ethernet Bridging for Private Networks on the Same Subnet    1  Set up four machines as shown in the following diagram     LANT  192 168 2 171                     local net    LANI  192 168 2 173    OpenVPN A    LAN 2  192 168 8 173    Internet    LANT  192 168 8 174  LANI  192 168 4 172    2  The configuration procedure is almost the same as for the previous example  The only difference is that you  will need to comment out the parameter    up    in     etc openvpn A tapO br conf    and      etc openvpn B tap0 br conf            LAN 2  192 168 4 174  OpenVPN B  local net             4 22       Moxa C Programmable RTU Controllers Managing Communications       Setup 3  Routed IP    1  Set up four machines as shown in the following diagram     LAN1  192 168 2 171                     local net    Open VPNA  LANI  192 168 2 173    LAN 2  192 168 8 173    Internet    LAN1  192 168 8 174  LANI  192 168 4 172    2  Create a configuration file named    A tun conf    and an executable script file named    A tun  sh            LAN 2  192 168 4 174  OpenVPN B  local net               point to the peer   remote 192 168 8 174   dev tun   secret  etc openvpn secrouter key  cipher DES EDE3 CBC   auth MD5   tun mtu 1500   tun mtu extra 64   ping 4
15.  mknod  dev net tun c 10 200  fi    load modules    tun    and    bridge     mname tun  module_up  mname bridge  module_up    create an ethernet bridge to connect tap devices  internal interface  brctl addbr bro  brctl addif brO  iface    the bridge receives data from any port and forwards it to other ports   i     expr 0   while    do    generate a tapO interface on tun    4 19    Managing Communications    Moxa C Programmable RTU Controllers       openvpn   mktun   dev tap  i     connect tap device to the bridge  brctl addif brO tap  i     null ip address of tap device  ifconfig tap  i  0 0 0 0 promisc up  i  expr  i   1     if    i  ge  maxtap    then  break  fi  done    null ip address of internal interface  ifconfig  iface 0 0 0 0 promisc up    enable bridge ip  ifconfig brO  IPADDR netmask  NETMASK broadcast  BROADCAST  ipf  proc sys net ipv4 ip_forward    enable IP forwarding  echo 1  gt   ipf  echo    ip forwarding enabled to     cat  ipf  T    stop      echo    shutdown openvpn bridge        ifcfg_vpn  i  expr 0     while    do    disconnect tap device from the bridge  brctl delif brO tap  i   openvpn   rmtun   dev tap  i   i  expr  i   1     if    i  ge  maxtap    then  break  fi  done  brctl delif brO  iface  brctl delbr brO  ifconfig br   down  ifconfig  iface  I PADDR netmask  NETMASK broadcast  BROADCAST  killall  TERM openvpn  T  case     1    in  start   start  stop   stop  i  restart   stop  start  i      echo    Usage   0  start stop restart      exit 1  esa
16.  native C compiler  whereas    arm linux gcc    is the cross C  compiler for the ARM based ioLogik W5348 C ioPAC 8020 C series     Moxa provides cross compiler tools for the following native compilers  Simply add the    arm linux     prefix                                                  ar Manages archives  static libraries    as Assembler   apap  GAPS C   compiler   cpp C preprocessor   gcc C compiler   gdb Debugger   Id Linker   nm Lists symbols from object files   objcopy Copies and translates object files   objdump Displays information about object files   ranlib Generates indexes to archives static libraries    readelf Displays information about ELF files   size Lists object file section sizes   strings Prints strings of printable characters from files  usually object files   strip Removes symbols and sections from object files  usually debugging information           On Line Debugging with GDB    The tool chain also provides an on line debugging mechanism to help you develop your program  Before  starting a debugging session  add the option  ggdb when you compile the program  A debugging session runs  on a client server architecture on which the server gdbserver is installed on the target system and the client  ddd is installed on the host computer  In the following instructions  we assume that you have uploaded a  program named hello debug to the target system and wish to debug this program     1  Log on to the target system and run the debugging server program      
17.  replace password with the correct password      pppd connect    chat  v         ATDT5551212 CONNECT        user username password  dev ttyMO  115200 crtscts modem    The pppd options are described below   connect    chat etc          This option gives the command to contact the PPP server  The    chat    program is used to dial a remote computer   The entire command is enclosed in single quotes because pppd expects a one word argument for the    connect     option  The options for    chat    are given below      V  verbose mode  log what we do to syslog    ww    Double quotes   don t wait for a prompt  but instead do      note that you must add a space after the second  quotation mark     ATDT5551212   Dial the modem  and then       CONNECT   Wait for an answer    Send a return  null text followed by the usual return    login  username word  password   Log in with the username and password    Refer to the chat man page  chat 8  for more information about the chat utility    dev    Specify the callout serial port    115200   The baudrate    debug   Log status in syslog    crtscts   Use hardware flow control between computer and modem  at 115200 this is a must    modem    Indicates that this is a modem device  pppd will hang up the phone before and after making the call     4 12    Moxa C Programmable RTU Controllers Managing Communications       defaultroute    Once the PPP link is established  make it the default route  if you have a PPP link to the Internet  this is probabl
18.  s console  perform the following commands to use the built in FTP client to retrieve  the firmware file  xxxx hfm  from the host PC to the RTU controller      mnt ramdisk  ftp  lt remote FTP Server   s IP gt   Login Name  xxxx   Login Password  xxxx   ftp gt  bin   ftp gt  get xxxx hfm    BY  COM1 115200 None 8 1   T100    fes root Moxa     upramdisk  rootfiMoxa      cd  mnt ramdisk  for rootfiMoxa   mnt ramdisk  ftp 192 168 119 201  Jars Connected to 192 168 19 201   220 TYPSoft FTP Server 1 10 ready     ame  192 168 19 201l ro0t   root  331 Password required for root   Password   230 User root logged in   Remote system type is UNIX   sing binary mode to transfer files   ftp    bin  200 Type set to I   ftp    get FWR_ioPAC80Z0_ V1 0 Buildl1072019 STD hfm       4  After the firmware file is transferred to the RAM disk  perform upgradehfm command to upgrade the  kernel and root file system    upgradehfm xxxx hfm  Press    Y    to complete the upgrade         COM1 115200 None 8 1   T100 E  loj xj    Te root Moxa   mnt ramdisk  upgradehfm FWR_ioPAC8020_V1 0_Buildl1072019_STD hfm  ioPAC 8020 C upgrade firmware utility version 1 0    To check source firmware file context    The source firmware file conext is OK    This step will destory all your firmware    Continue    Y N      Now upgrade the file  kernel     Format MTD device   dev mtdl            MTD device   dev mtdl  erase 128 Kibyte   380000    100  complete   Wait to write file       Completed 100    Now upgrade the file  
19.  sizes are hard coded into the kernel binary  The flash memory map is shown in the following table                       Total Size Contents Location Access  System Space   20 MB Boot Loader 0x80000000 to Read Only  0x80080000  Linux Kernel 0x80080000 to  0x80400000  Root File System  JFFS2  0x80400000 to  0x81400000  User Space 12 MB User directory  JFFS2  0x81400000 to Read Write  0x82000000                   If the user file system is incorrect  the kernel will change the root file system to the kernel and use the default  Moxa file system  To finish the boot process  run the init program     NOTE 1  The user file system is a complete file system  Users can create and delete directories and files  including  source code and executable files  as needed   2  Users can create the user file system on the host PC or the target platform and copy it to the ioLogik  W5348 C series or the ioPAC 8020 C series   3  Continuously writing data to flash is not recommended  since doing so will decrease the flash   s life        C Library    The ioLogik W5348 C series and ioPAC 8020 C series both support control devices with Moxa APIs  Users will  need to include libmoxa_pgm h to use the following Moxa APIs     APIs    For details on APIs  refer to Chapter 2 of  Developers Guide for Moxa RTU Controllers        6 2    7    Software Lock       Software Lock    is an innovative technology developed by Moxa  It can be adopted by a system integrator or  developer to protect his applications fro
20.  the rule or of the packet to check     s  Source address  network name  host name  network IP address  or plain IP address      sport  Source port number     d  Destination address      dport  Destination port number      j  Jump target  Specifies the target of the rules  i e   how to handle matched packets  For  example  ACCEPT the packet  DROP the packet  or LOG the packet     Examples   Example 1  Accept all packets from lo interface       iptables  A INPUT  i lo  j ACCEPT  Example 2  Accept TCP packets from 192 168 0 1      iptables  A INPUT  i ethO  p tcp  s 192 168 0 1  j ACCEPT  Example 3  Accept TCP packets from Class C network 192 168 1 0 24      iptables  A INPUT  i ethO  p tcp  s 192 168 1 0 24  j ACCEPT  Example 4  Drop TCP packets from 192 168 1 25      iptables  A INPUT  i ethO  p tcp  s 192 168 1 25  j DROP  Example 5  Drop TCP packets addressed for port 21      iptables  A INPUT  i ethO  p tcp   dport 21  j DROP  Example 6  Accept TCP packets from 192 168 0 24 to Moxa RTU   s port 137  138  139     iptables  A INPUT  i ethO  p tcp  s 192 168 0 24   dport 137 139  j ACCEPT    Example 7  Drop all packets from MAC address 01 02 03 04 05 06     4 9    Moxa C Programmable RTU Controllers Managing Communications         iptables  A INPUT  i ethO  p all  m mac      mac source 01 02 03 04 05 06  j DROP    NOTE  In Example 7  remember to issue the command  modprobe ipt_mac first to load module ipt_mac     NAT    NAT  Network Address Translation  protocol translates IP
21.  to download PuTTY   free software  to set up an SSH console for the Moxa RTU in a Windows environment  The following figure  shows a simple example of the configuration that is required          AR Pal TY Configuration xi  Category   7 Basic options for your PuTTY session  S i TE r Specify your connection by host name or IP address     i      Connection Host Name  or IP address  Port  Proxy 192 168 127 254 S  Telnet Protocol   Alogin C Raw    Telnet    Rlogn SSH      SSH  Auth Load  save or delete a stored session  Tunnels Saved Sessions       Bugs  Default Settings       Load    HE  Save  mea    Delete    Close window on exit   C Always C Never     Only on clean exit       About Cancel       Click on    Yes    to accept the security key exchange from the RTU controller   s SSH console     Linux Users    For a Linux based system  users can use the    ssh    command to access the console of the RTU controller via  SSH    ssh 192 168 127 254    Select yes to complete the connection      root bee notebook root   ssh 192 168 127 254  The authenticity of host    192 168 127 254  192 168 127 254     can   t be established   RSA key fingerprint is 8b ee ff 84 41 25 fc cd 2a f2 92 8f cb 1f 6b 2f     Are you sure you want to continue connection  yes no   yes_       NOTE SSH provides better security compared to Telnet for accessing the RTU controller   s console over the network     RTUAdmin Utility    The Moxa C programming RTU controller can be managed and configured over the Ethern
22. 0   ifconfig 192 168 2 173 192 168 4 174  up  etc openvpn A tun sh       bin sh    value after     net    is the subnet behind the remote peer  route add  net 192 168 4 0 netmask 255 255 255 0 gw  5    Create a configuration file named B tun conf and an executable script file named B tun sh on OpenVPN B     remote 192 168 8 173   dev tun   secret  etc openvpn secrouter key  cipher DES EDE3 CBC   auth MD5   tun mtu 1500   tun mtu extra 64   ping 40   ifconfig 192 168 4 174 192 168 2 173  up  etc openvpn B tun sh       bin sh      value after     net    is the subnet behind the remote peer  route add  net 192 168 2 0 netmask 255 255 255 0 gw  5    4 23    Moxa C Programmable RTU Controllers Managing Communications       Note that the parameter    ifconfig    defines the first argument as the local internal interface and the second  argument as the internal interface at the remote peer     Note that  5 is the argument that the OpenVPN program passes to the script file  Its value is the second  argument of ifconfig in the configuration file     3  Check the routing table after you run the OpenVPN programs  by typing the command                   route   Destination Gateway Genmsk Flags Metric   Ref Use Iface  192 168 4 174   255 255 255 255 UH 0 0 0 tunO  192 168 4 0 192 168 4 174 255 255 255 0 UG 0 0 0 tun0  192 168 2 0 t 255 255 255 0 U 0 0 0 etn   192 168 8 0 F 255 255 255 0 U 0 0 0 ethO                                  4 24    5    Tool Chains for Application Development    I
23. 0  UP LOOPBACK RUNNING MTU 2000 Metric 1   RX packets O errors O dropped O overrun O    pppO Link encap Point to Point Protocol   inet addr 192 76 32 3 P t P 129 67 1 165 Mask 255 255 255 0  UP POINTOPOINT RUNNING MTU 1500 Metric 1   RX packets 33 errors O dropped O overrun O   TX packets 42 errors O dropped O overrun O    Now  type   ping Z z z z  where Z z z z is the address of your name server  The response may look like     waddington   p ping 129 67 1 165   PING 129 67 1 165  129 67 1 165   56 data bytes   64 bytes from 129 67 1 165  icmp_seq 0 ttl 225 time 268 ms  64 bytes from 129 67 1 165  icmp_seq 1 ttl 225 time 247 ms  64 bytes from 129 67 1 165  icmp_seq 2 ttl 225 time 266 ms  AC       129 67 1 165 ping statistics       3 packets transmitted  3 packets received  0  packet loss  round trip min avg max   247 260 268 ms   waddington       4 13    Moxa C Programmable RTU Controllers Managing Communications       Try typing   netstat  nr    It should show three routes  similar as the following                          Kernel routing table   Destination iface Gateway Genmask Flags Metric Ref Use  129 67 1 165 pppO 0 0 0 0 255 255 255 255 UH 0 0 6  127 0 0 0 0 0 0 0 255 0 0 0 U 0 0 0 lo  0 0 0 0 pppO 129 67 1 165 0 0 0 0 UG 0 0 6298                         If your output looks similar but doesn t have the destination 0 0 0 0 line  which refers to the default route used  for connections   you may have run pppd without the    defaultroute    option  At this point you can tr
24. 1 Y 1100     ma   embedded ethernet LANL       iface ethO inet static  address 192 168 19 202  network 192 168 19 0  netmask 255 255 255 0  broadcast 192 168 19 255    gateway 192 168 19 254    After the LAN interface settings have been modified and saved  perform the following command to activate the  LAN settings immediately          etc init d networking restart    Adding DNS Settings    For details  refer to Chapter 4  Managing Communications      Developing Procedures    In general  program development involves the following seven steps     Step 1    Connect the RTU controller to a Linux PC    Step 2    Install Tool Chain  GNU Cross Compiler  amp  glibc  from the  Document and Software CD    Step 3    Set the cross compiler and glibc environment variables    Step 4    Code and compile the program    Step 5    Download the program to the target RTU controller using FTP or  NFS    Step 6    Debug the program    gt  If bugs are found  return to Step 4     gt  If no bugs are found  continue with Step 7    Step 7    Back up the user directory  distribute the program to additional  Moxa RTU controller if needed             Cross Compiler       ele    ioPAC 8020 5 9 C    oLogikW5348 C    2 15    Moxa C Programmable RTU Controllers Getting Started       Installing the Tool Chain  Linux     The Linux Operating System must be pre installed in the host PC before installing the RTU controller   s GNU Tool  Chain  Fedora Core or compatible versions are recommended  The Tool Chain req
25. 2  701 root 352  714 root 1176  726 root 436  727 BOO  1180  783 root 628  root Moxa   ect      bin sh  login    usr bin httpd  k start  d  etc apache   usr bin httpd  k start  d  etc apache   usr bin httpd  k start  d  etc apache   usr bin httpd  k start  d  etc apache   usr bin httpd  k start  d  etc apache   bin reportip    bash    bin telnetd    bash   ps  ef    u ulun uun nv Fin wv    Annan wn       To run a private daemon  users need to edit the file rc local  as follows      cd  etc rc d   vi rc local                root Moxa    cd  etc rc d    root Moxa     etc rc d  vi rc local       3 4    Moxa C Programmable RTU Controllers Managing the RTU Controllers       The following diagram shows how to edit the last line of the rc local to activate the complied example     tcps2 release     and run in the background     IA A aoe   PUTTY      bin sh  if        home autoexec sh    then   home autoexec sh  fi      Add the new daemons or programs starting from the next line     home tcps2 release  amp         The enabled daemons will be available after rebooting the RTU controller     An alternative is the autoexec sh located in the  home directory to wake up and activate those daemons and  programs  By editing and updating it to the RTU controller system  users will no longer need to modify the  rc loca file     Setting the Run Level    Perform the following commands to add or delete the settings  such as system service or programs  to the run  levels      cd  etc rc d init d  
26. 4  2 0 mm x mm  max     10 channel 110 VDC Digital Input Module    O    e  2  E  5       A                   5    Status          l  RM 1050 T   1             RM 1050 T  10 digital inputs  110 VDC  isolated   Inputs per Module  10 channels  110 VDC  channel to channel  isolated   On state Voltage  72 VDC nominal  50 VDC  min   to 175 VDC   max     Off state Voltage  0 to 15 VDC  15 VDC max    Input Impedance  120K ohms  typical    Common Type  None   Response Time  100 ms   Over Current Protection  200 mA per channel   Isolation  I O to logic  photocoupler isolation   Channel to Channel Isolation  2 5K VDC   Operating Temperature   40 to 75  C   Power Consumption  24 mA   24 VDC  typical    I O Cable Wire  AWG 14  2 0 mm x mm  max     Moxa C Programmable RTU Controllers Module Specifications and Wiring       16 channel Digital Output Module   RM 2600 T  16 digital outputs  24 VDC  sink type  0 2 A  Outputs er Module  16 channels  24 VDC  sink type  Output Impedance  120m ohms  typical         RM 2600 A       Status Status U    il Off state Resistance  500K ohms  typical          LZ i x  E     l Response Time  100 ms  aE K    Over Current Protection  200 mA per channel     be L Isolation  I O to logic  photocoupler isolation      E L Channel to Channel Isolation  2 5K VDC  SEE L Operating Temperature   40 to 75  C   E oo  LRE B 5 Power Consumption  24 mA   24 VDC  typical   mom  oo   E  5 I O Cable Wire  AWG 14  2 0 mm x mm  max   J   oo a                 ml  w  G  m  v  i  m 
27. 49     OTR Keu 1492  defaultroute  moipde fault            Type your username  the one you set in the  etc ppp pap secrets and  etc ppp chap secrets files   after the    name    option  You may add other options as desired    Set up DNS   If you are using DNS servers supplied by your ISP  edit the file    etc resolv conf by adding the following lines of code    nameserver ip_addr_of_first_dns_server   nameserver ip_addr_of_second_dns_server   For example    nameserver 168 95 1 1   nameserver 139 175 10 20   Use the following command to create a pppoe connection    pppd etho   The ethO is what is connected to the ADSL modem LAN port  The example above uses LAN1    Type ifconfig pppO to check if the connection is OK or has failed  If the connection is OK  you will see  information about the pppO setting for the IP address  Use ping to test the IP     If you want to disconnect it  use the kill command to kill the pppd process     PPP over Cellular    It is recommend to use the callular API in the RTU controller   s Toolchain  however  the pppd also supports    cellular network with following examples     Create a chat configuration    cellular cmd    at  etc ppp peers    4 15    Moxa C Programmable RTU Controllers Managing Communications       ABORT  BUSY    ABORT  ERROR    ABORT  NO ANSUER    ABORT  NO CARRIER    we  RT CPIN     OK     AT  SCFG  Radio Band  16 1  OK  AT CGDCONT 1   IP    internet    OK     ATDT 99   1     CONNECT       Create a pppd configuration    cellular co
28. A ores ae aan n aaien aoa a a Ea A ar Orea aeaa aha unak 2 3  Removing ioPAC 8020 C Series from the DIN Rall     ssssgs sss anet s ness ssent RR 2 4  COLI E IS a ea ates 2 4  Grounding th   RTU Controller aus ii 2 5  IOPACIB 020 ES AA A OA vane Yay 2 5  IOLOJIK W5348 SOS a THT 2 5  Powering on the RTU Controller sss sse ese eee ee e er re rere 2 5  Power Terminal Block for ioLOgik W5348 C Series sse e er tet rere 2 5   Power Terminal Block for ioPAC 8020 C Series  vK 54545 9 TES TT r Erene TES 0 TAT EEUNA R TER cada 2 6  Connecting to a Sera DSVi Ce CR E idad  2 6  PEDPINGIGALOLS acc 2 7  IOPAC8020 C Ss oa 2 7  IOLOGIK W53482C SOS a td 2 7  Connecting  the RIU Controller toma a 2 7  Il IE OL  Foie    pre a a Paar 2 7  Console  Port for  the ioPAC8020 C Series iia eiii i 2 8   Console Port for the   oLogik W5348 C Series sese een nett 2 8   Pin Assignment for the Serial Console Port sss ee eee errer 2 8   Serial COMSOlS sz ieee ae ak dee ee gid wale O 2 8   A    gt   ci da dae ez 2 10   SSH  esl 2 11  NINOS US E 2 11   LINUX USERS tin lontteonineccrnceutnesrtnaeieneduarsieaehearineeierehubasaceiedsiuansene A RA dada oa 2 11   RTUAd MiM UEl x Sx exe ies TVS eS a T Vede aded YR SRN YEN RN N YEN N NSN VRAS wee ce    2 11  Installing  RITUAL TO ea hole a 2 12  Broadcast Seah riri rni cs 2 12   M  in  Screen Overviews mE O 2 12   Vda A A a 2 12   MENU BA ad A AS AAA 2 13     TEA O A A 2 13   Navigation AAA ger dideldhierlnelecleetaveduedunetyeutyeuewebeiebenies 2 13    oT le  2 13 
29. If there is a program tcps2 at  home  link it to the run level      cd  etc rc d rc3 d   in  s  home tcps2 S60tcps2    SxxRUNFILE stands for   S Starts the run file while linux boots up    xx  A number between 00 99  Smaller numbers have higher priority   RUNFILE  The file name     T92  LOS  L2 taco   Pully  eee  root Moxa  ect rce d rc3 d  1s  S19nfs common S25nfs user server S99showreadyled  S20snmpd S55ssh  S24pcmcia S99rmnologin  root Moxa  ect re d rc3 d  ln  s  home tcps2 S60tcps2  root Moxa  ect re d rc3 d  ls  S19nfs common S25nfs user server S99rmnologin  S20snmpd S55ssh S99showreadyled    S24pcmcia S60tcps2  root Moxa   etc rce d rc3 d        Remove the link by performing the following command      rm  f  etc rc d rc3 d S60tcps2    Moxa C Programmable RTU Controllers Managing the RTU Controllers       Adjusting the System Time    Setting the Time Manually    The Moxa C programming RTU controller has two time settings  One is the system time  and the other is the  RTC  Real Time Clock  time kept by the RTU controller   s hardware  Use the  date command to query the  current system time or set a new system time  Use  hwclock to query the current RTC time or set a new RTC  time     Use the following command to query the system time    date   Use the following command to query the RTC time    hwclock   Use the following command to set the system time    date MMDDhhmmYYYY   MM   Month   DD   Date   hhmm   hour and minute   YYYY   Year   Use the following command to set t
30. J       mJ  o 3  m R  o       R lt                                8 channel Analog Input Module  16 bit Resolution  RM 3802 T  8 analog inputs  4 to 20 mA  16 bits  Inputs per Module  8 channels  differential    _ Input Current Range  4 to 20 mA                                     Power Consumption  30 mA   24 VDC  typical   I O Cable Wire  AWG 14  2 0 mm x mm  max      amp     Current  a    input Input Impendence  120 ohms  A   4 20 mA   l l  E    Pe   Resolution Range  16 bits  0 24 pA bit    K E Accuracy      K R  0 1   FSR   25  C    a K  0 3   FSR    40  C  75  C      E oe Sampling Rate   m   Aue K   All channels  12 samples sec    AIS  LE   a  5 Per channel  1 5 samples sec  ml   3  ma    5 Over Current Protection  200 mA per channel   R      5    an  5 Isolation  I O to logic  photocoupler isolation    E B  PE lv  gt  Channel to Channel Isolation  2 5K VDC  a E Operating Temperature   40 to 75  C       P           B 2    Moxa C Programmable RTU Controllers Module Specifications and Wiring       NOTE    8 channel Analog Input Module  16 bit Resolution  RM 3810 T  8 analog inputs  0 to 10 V  16 bits                                                    AN     KEY i Inputs per Module  8 channels  differential  ee Oe ssa   Voltage Input Current Range  0 to 10 VDC     Nns  y y Input Impendence   gt  10M ohms    o      y I Resolution Range  16 bits  0 15 pA bit  w vb L  S K ab   7 Data Format  16 bit integer  2   s complement   Ce w vk mm Accuracy   ma   sL MN tH ko   ma  gt  A
31. Moxa C Programmable RTU Controllers  User   s Manual    Third Edition  June 2012    www moxa com F    MOXA       2012 Moxa Inc  All rights reserved     Moxa C Programmable RTU Controllers  User   s Manual    The software described in this manual is furnished under a license agreement and may be used only in accordance with    the terms of that agreement     Copyright Notice    Trademarks       2012 Moxa Inc  All rights reserved     The MOXA logo is a registered trademark of Moxa Inc   All other trademarks or registered marks in this manual belong to their respective manufacturers     Disclaimer    Information in this document is subject to change without notice and does not represent a commitment on the part of    Moxa     Moxa provides this document as is  without warranty of any kind  either expressed or implied  including  but not limited  to  its particular purpose  Moxa reserves the right to make improvements and or changes to this manual  or to the    products and or the programs described in this manual  at any time     Information provided in this manual is intended to be accurate and reliable  However  Moxa assumes no responsibility for    its use  or for any infringements on the rights of third parties that may result from its use     This product might include unintentional technical or typographical errors  Changes are periodically made to the  information herein to correct such errors  and these changes are incorporated into new editions of the publication     Te
32. ample        bin bash    If you put this shell script in the  home nat sh    Remember to chmod 744  home nat sh    4 10    Moxa C Programmable RTU Controllers Managing Communications         Edit the rc local file to make this shell startup automatically      vi  etc rc d rc local     Add a line in the end of rc local  home nat sh   EXIF  eth0  A This is an external interface for setting up a valid IP address   EXNET     192 168 4 0 24     This is an internal network address      Step 1  Insert modules      Here 2 gt   dev null means the standard error messages will be dump to null device   modprobe ip_tables 2 gt   dev null   modprobe ip_conntrack 2 gt   dev null   modprobe ip_conntrack_ftp 2 gt   dev null   modprobe ip_conntrack_irc 2 gt   dev null   modprobe iptable_nat 2 gt   dev null   modprobe ip_nat_ftp 2 gt   dev null   modprobe ip_nat_irc 2 gt   dev null     Step 2  Define variables  enable routing and erase default rules   PATH  bin  sbin  usr bin  usr sbin  usr local bin  usr local sbin  export PATH   echo    1     gt   proc sys net ipv4 ip_forward    bin iptables  F    bin iptables  X    bin iptables  Z    bin iptables  F  t nat    bin iptables  X  t nat    bin iptables  Z  t nat    bin iptables  P INPUT ACCEPT    bin iptables  P OUTPUT ACCEPT    bin iptables  P FORWARD ACCEPT    bin iptables  t nat  P PREROUTING ACCEPT    bin iptables  t nat  P POSTROUTING ACCEPT    bin iptables  t nat  P OUTPUT ACCEPT     Step 3  Enable IP masquerade     Dial up Service   PPP   
33. apturing    Terminal type  TYT y     p Window Size e al  Size   80          History depth   25  unit  row   r Transmit   Local echo    Send Enter    key as  RP y   Receive  CR translation  No Changed y  LF translation  No Changed v                   IV Enable auto line wrap       STEP 7  Serial console will be displayed on the terminal screen     E COM1 115200 None 8 1 Y 1100      rootfAMoxa             Moxa C Programmable RTU Controllers Getting Started       Telnet Console    It will be easy to use the system embedded command    telnet    to connect the RTU controller via network  connection  The default IP address and Netmask are given below        Default IP Address Netmask  LAN 1 192 168 127 254 255 255 255 0                      Use a cross over Ethernet cable to connect directly from the host PC to the RTU controller  User must first  modify the host PC   s IP address and netmask to be in the same subnet as the target RTU controller  For  example  users can set the host PC   s IP address to 192 168 127 253 and netmask to 255 255 255 0 to meet  the default settings of the RTU controller     To start the telnet console  launch the Windows Command prompt and use the following command     cx CAWINDO WS system32 cmd exe    C   gt telnet 192 168 127 254       To log in  type the Login name and password as requested  The default values are both root     Login  root  Password  root    cx Telnet 192 168 127 254    Moxa login  root  Password     HHHH HHHH HHRHH TEE HHRHH HH  HHH
34. aratccataretecsteeetseengeetesenenentaretnentndagauaiaenbaenaenanamene 3 7  Executing Scheduled Commands with Cron Daemon sss sss sse ee eer ree ree ree re e e r e K rere 3 7  Managing COMMUNICATIONS   ssssssssses ses ses ses es vesse e sese sese sneg renen nenen en nenen e nenen nenen nenen en nenen enes 4 1  TLS ETP A AAA AA AAA HET 4 2  Enabling the Telnet FTP Server cs ers e e es e e es e e es e e rn e erne ereenn 4 2  Disabling the Telnet FTP Server cesse e es e es e e en e e rn e e rne ereenn 4 2   DNS wc A A AA A A RARA LRR RRR RRR RRR ARAR E 4 2  Web SErviGC    ApaGhe sata o 4 3  Installing  PHP    for Apache  Web Servet as cece oct oe ie te ie ete ne ee ee rele ne ee oe da dd 4 4  IPTABLES ia 4 6  Observe and Erase Chain Rules  eee ree eee rere rere 4 8  Define  Policy for Chain RUGS   cise ieee lada lidia ada ela Been Ei 4 8  Append or Delete Rules  rre racs ga gren ii KR RVU isaac 4 9   NA a ene Tia cated ee ee ie oe waa na EE aa 4 10  NAT Tas  pote e e dey deerteteeeParotaravarabieysbnbbisenueesdeerasebureraseset vee 4 10  ENANA ad 4 10  Dial UD Servico    PP Pa diana 4 11  Example 1  Connecting to a PPP Server over a Simple Dial Up Connection see e e e e e r e r e K teen enna 4 12   Example 2  Connecting to a PPP Server over a Hard wired LINK esse eee eee ree ree re e e e errer 4 13   How to  Check the  Connection seste etre Mics cceudes tice dtetendataaseedegt coyeberstersteretecdteeedacerebestbeuteebeeestes 4 13   Setting up a Machine for Incoming PPP Connectio
35. are named after accounts in   etc passwd     Cron wakes up every minute  and checks each command to see if it should be run in that minute  Modify the file   etc cron d crontab to set up the scheduled applications  Crontab files are in the following formats     3 7    Moxa C Programmable RTU Controllers    Managing the RTU Controllers                               The following example demonstrates how to use Cron     How to use Cron to update the system time and RTC time every day at 8 00     STEP1  Write a shell script named fixtime sh and save it to  home       bin sh  ntpdate time nist gov    STEP2     STEP3     STEP4     STEPS     hwclock   systohc    exit O    Change mode of fixtime sh     chmod 755 fixtime sh       Modify  etc cron d crontab file to run fixtime sh at 8 00 every day   Add the following line to the end of crontab       8       root homefixtime sh  Enable the cron daemon manually       etc init d cron start  Enable Cron when the system boots up    Add the following line in the file  etc init d  rc local     etc init d cron start    3 8       mm h dom mon dow user command  min hour date month week user command  0 59 0 23 1 31 1 12 0 6  0 is Sunday        4    Managing Communications    In this chapter  it explains how to configure the RTU controller s communication functions   The following topics are covered in this chapter     O Telnet FTP    gt  Enabling the Telnet FTP Server    gt  Disabling the Telnet FTP Server   DNS   Web Service   Apache   Installi
36. at are found  Click on the specific product  in the Navigation Panel  the Main Window will connects to its telnet console automatically     Z MOXA RTUAdmin    Fie System Sot Help  9 18 A E    a E Host 192 168 19 201  E E RTUAdmin                 ioPAC 8020 9 RJ45 C T    HHHH HHHHHH HHHHHHH HHHHHH     HH HHH HHHH    888 HHH          RRR    HHBHHHHH HHHHHHH HHHHHHHHHHH 888                2 13    Moxa C Programmable RTU Controllers Getting Started       Sync Rate Status    Indicates the period that RTUAdmin has been launched     Status Bar    Displays the current time     Configuring the Ethernet Interface    The network settings of the Moxa C programming RTU controller can be modified with the serial console port   or online over the network     Modifying Network Settings via Serial Console    Follow the instructions given in the previous section to access the serial console of the target RTU controller   and then type  cd  etc network to change directories     E   COM1 115200 None 8 1   T100          Type  vi interfaces to edit the network configuration file with vi editor  Users can configure the Ethernet ports  of the RTU controller for static or dynamic  DHCP  IP addresses     Static IP addresses    As shown in the table below  4 network addresses must be modified  address  network  netmask  and  broadcast  The default IP address for LAN1 is 192 168 127 254  with default netmask of 255 255 255 0        BY COM1 115200 None 8 1   T100    fe   embedded ethernet LANL       ifac
37. at is generated to the OpenVPN machine     2  Generate a script file named openvpn bridge on each OpenVPN machine  This script reconfigures  interface  eth1    as IP less  creates logical bridge s  and TAP interfaces  loads modules  enables IP  forwarding  etc     H  bin sh   iface eth1   defines the internal interface   maxtap  expr 1     defines the number of tap devices  I e     of tunnels  IPADDR    NETMASK    BROADCAST      it is not a great idea but this system doesn   t support      etc sysconfig network scripts ifcfg ethi    ifcfg_vpn       while read f1 f2 f3 f4 r3  do  if       f1         iface     a     f2          iface     a     f3         inet     a     f4         static      then  i  expr 0     while    do  if    i  gt 5    then  break  fi  i   expr  i   1     read f1 f2    case     f1    in  address   IPADDR  f2    4 18    Moxa C Programmable RTU Controllers       H  netmask   NETMASK  f2  H  broadcast   BROADCAST  f2  H  esac  done  break  fi  done  lt   etc network interfaces  T    get the ip address of the specified interface  mname   module_up       oIFS  IFS  IFS    FOUND     no     for LINE in  Ismod     do  TOK  echo  LINE   cut  d       f1     if      STOK          mname       then  FOUND  yes      break   fi  done  IFS  01FS  if      SFOUND         no       then  modprobe  mname  fi  T  start       ifcfg_vpn  if         d     dev net          then  mkdir  dev net  fi  if         r     dev net tun          then    create a device file if there is none 
38. ation software and store data directly on the RTU controller  In  addition  the cellular modem  the Ethernet switch ports  and 3 in 1 serial interfaces create the best flexibility  to communicate with field devices and with the central host  making the Moxa C programmable RTU controller  ideal for remote data acquisition and industrial control applications     The pre installed operating system  OS  provides an open operating system for your software program  development  Software that runs on desktop PCs can be easily exported to the RTU controller with a cross  compiler  The software development package also provides versatile API functions  such as I Os and  communication control  SCADA connection  alarms  and Modbus communication     Software Architecture    The operating system that is pre installed in the Moxa C programmable RTU controller follows a standard  Linux based architecture  the program porting can be done with the Tool Chain provided by Moxa     AP    API          Protocol  Stacks    Device  Driver       OS Kernel    Micro Memory Control  Schedule  Process  Kernel           Hardware    The built in Flash ROM is partitioned into Boot Loader  Kernel  Root File System  and User directory  partitions     In order to prevent user applications from crashing the Root File System  the Moxa C programmable RTU  controller uses a unique Root File System with Protected Configuration for emergency use  This Root File  System comes with serial and Ethernet communication ca
39. c    4 20    Managing Communications    Moxa C Programmable RTU Controllers Managing Communications       Run the shell command to start  stop  or restart the OpenVPN    sh  etc openvpn openvpn bridge start     sh  etc openvpn openvpn bridge stop     sh  etc openvpn openvpn bridge restart    3  Create a configuration file named A tapO br conf and an executable script file named A tapO br sh on  OpenVPN A      point to the peer   remote 192 168 8 174   dev tapO   secret  etc openvpn secrouter key   cipher DES EDE3 CBC   auth MD5   tun mtu 1500   tun mtu extra 64    ping 40   up  etc openvpn A tapO br sh   A Sart     bin sh      value after     net    is the subnet behind the remote peer  route add  net 192 168 4 0 netmask 255 255 255 0 dev brO    Create a configuration file named B tapO br conf and an executable script file named B tapO br sh on  OpenVPN B       point to the peer   remote 192 168 8 173   dev tapO   secret  etc openvpn secrouter key  cipher DES EDE3 CBC   auth MDS tun mtu 1500  tun mtu extra 64    ping 40   up  etc openvpn B tapO br sh  La Sart     bin sh      value after     net    is the subnet behind the remote peer  route add  net 192 168 2 0 netmask 255 255 255 0 dev brO    NOTE  Select cipher and authentication algorithms by specifying    cipher    and    auth     To see with algorithms  are available  type       openvpn   show ciphers    openvpn   show   auths    4  Start both of OpenVPN peers       openvpn   config A tapO br conf amp     openvpn   confi
40. chains are accepted automatically  and all connections  are accepted without being filtered      iptables  F   iptables  X     iptables  Z    Define Policy for Chain Rules    Usage     iptables   t tables    P   INPUT  OUTPUT  FORWARD  PREROUTING  OUTPUT  POSTROUTING    ACCEPT  DROP      P  Set the policy for the chain to the given target     INPUT  For packets coming into the Moxa RTU   OUTPUT  For locally generated packets     FORWARD  For packets routed out through the Moxa RTU     PREROUTING  To alter packets as soon as they come in     4 8    Moxa C Programmable RTU Controllers Managing Communications       POSTROUTING  To alter packets as they are about to be sent out     Examples    iptables  P INPUT DROP     iptables  P OUTPUT ACCEPT    iptables  P FORWARD ACCEPT    iptables  t nat  P PREROUTING ACCEPT   iptables  t nat  P OUTPUT ACCEPT   iptables  t nat  P POSTROUTING ACCEPT    In this example  the policy accepts outgoing packets and denies incoming packets     Append or Delete Rules    Usage     iptables   t table    AI   INPUT  OUTPUT  FORWARD    io interface    p tcp  udp  icmp  all    s  IP network     sport ports    d IP network     dport ports   j  ACCEPT  DROP      A  Append one or more rules to the end of the selected chain     I  Insert one or more rules in the selected chain as the given rule number     i  Name of an interface via which a packet is going to be received     o  Name of an interface via which a packet is going to be sent     p  The protocol of
41. chnical Support Contact Information    Moxa Americas   Toll free  1 888 669 2872  Tel   1 714 528 6777  Fax   1 714 528 6778    Moxa Europe  Tel   49 89 3 70 03 99 0  Fax   49 89 3 70 03 99 99    www moxa com su    ort    Moxa China  Shanghai office   Toll free  800 820 5036    Tel   86 21 5258 9955  Fax   86 21 5258 5505  Moxa Asia Pacific   Tel   886 2 8919 1230  Fax   886 2 8919 1231    Table of Contents    1  Introductio  irsini iiinaunsan aaan T 1 1  OUEN ii 1 2  Kien a Ad a E a cz 1 2   Journaling Flash File System  JFFS2  an yEyE KER K UREE KERE K UREE KERER EEE A nea TERRA KAER dE RAN 1 3  Software PACK AGC ii ee Eye a ata eee TE E Se ie ie ir ine ne le DA DOES 1 3  Avalla Dle sie Ta T TTT 1 4  IOPACG8020 CSGMOCS nas 1 4  IOLOGIK    W5349  C SOMOS E rare atciate areata attateateateateateateiaeig td e oi 1 4  PrOdUuCt SpeCifiCatiOnSiiwccscsctescseseretcieecarhedeecasedtecnetedeasarerdterareedtacareetencarncteaeeDaneb aida 1 5  OPAC 8020 a NENS a Phe states A sis ete us rls elas NNE YN ENS S NEN NVN S YES 1 5  IOLOGIK  W5348 SEAS eased eect ld ad 1 6   2  Getting Started HHHH 2 1   I O and Communication Module Installation i  srik 252525 aa3 2355592353534275 aaa 2 2  Correct Installation  module installation in steps  from right to left  sse eee eee eee cette e e r r e re rere 2 2   Incorrect Installation  in steps  from right to left  sse nnn nee 2 2   Installing the RTU Controller on a DIN Rail sss sss eee ee rere 2 3  IOPAG 802026    SONGS irra CRE NHE EAER REEERE ZE
42. ctory structure in the RAM  A log structured file system is  maintained at all times  The system is always consistent  even if it encounters crashes or improper  power downs  and does not require fsck  file system check  on boot up     JFFS2 is the newest version of JFFS  It provides improved wear leveling and garbage collection performance   improved RAM footprint and response to system memory pressure  improved concurrency and support for  suspending flash erases  marking of bad sectors with continued use of the remaining good sectors  enhancing  the write life of the devices   native data compression inside the file system design  and support for hard  links ative data compression inside the file system design  and support for hard links     The key features of JFFS2 are     e Targets the Flash ROM Directly   e Robustness   e Consistency across power failures   e No integrity scan  fsck  is required at boot time after normal or abnormal shutdown  e Explicit wear leveling    e Transparent compression    Although JFFS2 is a journaling file system  this does not preclude the loss of data  The file system will remain  in a consistent state across power failures and will always be mountable  However  if the system is powered  down during a write then the incomplete write will be rolled back on the next boot  but writes that have already  been completed will not be affected     Additional information about JFFS2 is available at   http   sources redhat com jffs2 jffs2 pdf  http  
43. d  5  free  6  date  7  env  8  clear  9  reboot  10  halt  11  du  12  gzip  gunzip  13  hostname    Moxa Special Utilities    dy  2   3     kversion  upramdisk  downramdisk    kill process  display now running process    dump kernel log message   to set serial port   dump  gz file context   make device node   display system memory usage   print or set the system date and time  run a program in a modified environment  clear the terminal screen   reboot   power off on the server   halt the server   estimate file space usage   compress or expand files   show system   s host name    show kernel version  mount ramdisk  unmount ramdisk    Module Specifications and Wiring    16 channel 24 VDC Digital Input Module    A    RM 1602   A    Status                85888  S NNNNNNNNNNNNNNNNNNNN  gt                              Source type wiring                R J  RR  RJ     mn        R     La                   dU                   m  D  Pe  E    3 o    T Lo     m     AP    Sink type wiring             RM 1602 T  16 digital inputs  24 VDC  sink source type  Inputs per Module  16 channels  sink source type  On state Voltage  24 VDC nominal  10 VDC min   OFF state Voltage  0 to 3 VDC  3 VDC max   Input Impedance  3K ohms  typical    Common Type  16 channels   2 DI_COMs  Response Time  100 ms   Over Current Protection  200 mA per channel  Isolation  I O to logic  photocoupler isolation   Operating Temperature   40 to 75  C   Power Consumption  20 mA   24 VDC  typical   I O Cable Wire  AWG 1
44. e Up to 3 6M bps upload speed    e Up to 384k bps download speed    UMTS    e Up to 384k bps upload download speed   GPRS EDGE    e Multi slot class  Class 10   e Coding schemes  CS 1 4  MCS 1 9   e Terminal device class  Class B   SMS  Point to Point Text PDU mode   SIM Control Voltage  3 V    LAN   Ethernet  1 x 10 100 Mbps  RJ45   Protection  1 5 KV magnetic isolation   Protocols  Modbus TCP  TCP IP  UDP  DHCP  Bootp  SNMP  SNTP    Serial Communication   Interface  2 x RS 232 422 485  software selectable  9 pin D Sub male   Baudrate    300  1200  2400  4800  9600  19200  38400  57600  115200 bps    Inputs and Outputs  Analog Inputs  4 channels  Configurable DIOs  8 channels    1 6    Moxa C Programmable RTU Controllers Introduction       Relay Outputs  2 channels  Isolation  3K VDC or 2K Vrms    Analog Input   Type  Differential input   Resolution  16 bits   I O Mode  Voltage   Current   Input Range  0 to 10 V   10 V    5 V  0 to 20 mA  4 to 20 mA  Accuracy    s 0 1  FSR   25  C   e 0 3  FSR    30 and 70  C   Sampling Rate    W5348    e All channels  5 samples sec   e Per channel  1 25 samples sec   Input Impedance  200K ohms  min     Built in Resistor for Current Input  102 ohms   Digital Input   Sensor Type  Wet Contact  NPN or PNP  and Dry Contact  I O Mode  DI or Event Counter   Dry Contact    e On  short to GND   e Off  open   Wet Contact  DI to GND     e On  0 to 3 VDC   e Off  10 to 30 VDC   Common Type  4 points per COM   Counter Frequency  25 Hz   Digital Filterin
45. e bottom of the switch upwards and then  remove the switch from the DIN rail           ioLogik W5348 C Series    STEP 1  Insert the top of the DIN rail into the slot just below the stiff metal spring     DIN Rail    STEP 2  The DIN rail attachment unit will snap into place as shown below     DIN Rail    To remove the ioLogik unit from the DIN rail  simply reverse Steps 1 and 2 above     2 4    Moxa C Programmable RTU Controllers Getting Started       Grounding the RTU Controller    The Moxa C programming RTU Controller is grounded to enhance EMS performance  The RTU controller comes  with a metal DIN Rail bracket for grounding the system  For optimal EMS performance  connect the chassis  ground nut on the RTU controller to the grounding point     ioPAC 8020 C Series    Grounding Nut        al                  i  i   O        Grounding Nut       Powering on the RTU Controller    Connect the 12 to 36 VDC power lines from the power supply to the Moxa C programming RTU controller s  power terminal block  and then power on the power supply attached to it  It takes about 30 to 60 seconds for  the system to boot up  Once the system is ready  the Ready LED will light up     Power Terminal Block for ioLogik W5348 C Series       Moxa C Programmable RTU Controllers    Getting Started       Power Terminal Block for ioPAC 8020 C Series       Connecting to a Serial Device    NOTE    A    The RTU controller is equipped with two 3 in 1 serial ports that support RS 232 422 485  making it more
46. e ethO inet static  address 192 168 127 254  network 192 168 127 0  netmask 255 255 255 0  broadcast 192 168 127 255    Dynamic IP addresses    By default  the RTU controller is configured for    static    IP addresses  To configure the LAN port to request an  IP address dynamically  replace static with dhcp and then delete the address  network  netmask  and  broadcast lines        Default Setting for LAN1 Dynamic Setting using DHCP       iface ethO inet static iface ethO inet dhcp  address 192 168 127 254  network  192 168 127 0  netmask 255 255 255 0  broadcast 192 168 127 255                After the LAN interface settings have been modified and saved  perform the following command to activate the  LAN settings immediately     2 14    Moxa C Programmable RTU Controllers Getting Started          etc init d networking restart    NOTE After changing the IP settings  use the networking restart command to activate the new IP address   Users must modify the  etc network interfaces to store the new settings  Using commands such as   ifconfig ethO 192 168 1 1 WILL NOT save the settings to the flash memory        Adding a Default Gateway    Follow the instructions given in a previous section to access the serial console of the target Moxa RTU Controller   and then type  cd  etc network to change directories     1  Type  vi interfaces to edit the network configuration file with vi editor     2  Add the gateway IP to the last entry of the interface settings     E  COM1 115200 None 8 
47. e file  created specifically to run on the Moxa RTU Controllers   hello debug   An ARM platform GDB debug server execution file  see Chapter 5 for details    Since the Moxa   s tool chain places a specially designed Makefile in the directory  tmp example  hello  be  sure to type the  make command from within that directory  If users type the  make command from any    other directory  the host Linux PC may use other system compilers  for example  cc or gcc  and resulting  errors     Uploading and Running the    Hello    Program    1  Use the following commands to upload hello release to the RTU controller by FTP     From the PC  type    ftp 192 168 127 254    2  Use the bin command to set the transfer mode to Binary mode  and then use the put command to initiate    the file transfer    ftp gt  bin   ftp gt  cd  home   ftp gt  put hello release    3  From the Moxa RTU  type       chmod  x hello release      hello release    The word Hello will be printed on the screen     root Moxa      hello release  Hello    To run the program automatically after system starts  modify the rc local file at  etc rc d as follows     E COM1 115200 Mone 8 1 Y1100  loj x     fes     bin sh  if    f  fhome fautoexec sh    then   ETR    fhome autoexec sh   RTS fi    Add the new daemons or programs starting from the next line    er    Modify the  home autoexec sh will also be OK     E COM1 115200 Mone 8 1 Y1100  loj x         bin sh                            ore   This script will be executed in rc l
48. each OpenVPN machine  you should generate a working directory  such as  etc openvpn  where script  files and key files reside  Once established  all operations will be performed in that directory     Network interface definition may be different in in different product lines  For ioLogik W5348 series  ethO    pppO WAN    ethi   ethO LAN        In the following examples  the OpenVPN A and B represent two Moxa RTU controllers  Note the network  interface definition may be different in different product lines  For ioLogik W5348 series     ethO    in the example  will be pppO cellular WAN   and the  eth1    in the example will be the ethO LAN     4 17    Moxa C Programmable RTU Controllers Managing Communications       Setup 1  Ethernet Bridging for Private Networks on Different Subnets    1  Set up four machines  as shown in the following diagram       mosta    LAN1  192 168 2 171                local net    LANI  192 168 2 173    LAN2  192 168 8 173    Internet    LANI  192 168 8 174  LAN1  192 168 4 172    Host A  B  represents one of the machines that belongs to OpenVPN A  B   The two remote subnets are  configured for a different range of IP addresses  When this setup is configured to a public network  the external  interfaces of the OpenVPN machines should be configured for static IPs  or connect to another device  such as  a firewall or DSL box  first     LAN 2  192 168 4 174  OpenVPN B       local net               openvpn   genkey   secret secrouter key  Copy the file th
49. et or Cellular network  with RTUAdmin  a Windows utility provided with Moxa RTU products  RTUAdmin   s graphical user interface gives  you advanced search function to find a Moxa RTU controller in the local network  and provide easy access to the  telnet console     2 11    Moxa C Programmable RTU Controllers Getting Started       Installing RTUAdmin    Insert the Document and Software CD into the host computer  In the   Software   utility  RTUAdmin RTUAdminSetup directory of the CD  locate and run SETUP EXE  The  installation program will guide you through the installation process and install the ioAdmin utility  After the  installation is finished  run ioAdmin from the Windows Start menu     Broadcast Search    Select the model and click the    Start Search    button to proceed        Auto Search for IO Servers  Exit            T Search a range of addresses    Start IP Address   192 168 1 1    EndiP Address  192 168     T Network Mask   255 2                 1 Search all support models  P 5348 JM ioPAC 8020          3  I O server s  were found            ServerName     T joPACBO20 PAC 8020 5M12C   192 168 127 254  00 90E8 324314  2  ioPAC8020 ioPAC 8020 5RJ45 C T 192 168 127 254  00 30 E8 AB AB AB  3 ioPAC8020 ioPAC BO20 9AJ45 CT 192 168 127 254 0090   8 11 5743       PETTITT 2 E Stop                    Search for RTU Servers      Main Screen Overview    The main screen displays all the results of broadcast search                                                             
50. g B tapO br conf amp     If you see the line    Peer Connection Initiated with 192 168 8 173 5000    on each machine  the connection  between OpenVPN machines has been established successfully on UDP port 5000     5  On each OpenVPN machine  check the routing table by typing the command       route    4 21    Moxa C Programmable RTU Controllers Managing Communications                   Destination Gateway Genmsk Flags Metric Ref Use Iface  192 168 4 0 t 255 255 255 0 U 0 0 0 brO  192 168 2 0   255 255 255 0 U 0 0 0 brO  192 168 8 0    255 255 255 0 U 0 0 0 ethO                            Interface eth1 is connected to the bridging interface brO  to which device tapO also connects  whereas the  virtual device tun sits on top of tapO  This ensures that all traffic from internal networks connected to interface  ethi that come to this bridge write to the TAP TUN device that the OpenVPN program monitors  Once the  OpenVPN program detects traffic on the virtual device  it sends the traffic to its peer     6  To create an indirect connection to Host B from Host A  you need to add the following routing item   route add  net 192 168 4 0 netmask 255 255 255 0 dev ethO    To create an indirect connection to Host A from Host B  you need to add the following routing item   route add  net 192 168 2 0 netmask 255 255 255 0 dev ethO   Now ping Host B from Host A by typing    ping 192 168 4 174    A successful ping indicates that you have created a VPN system that only allows authorized users
51. g Time Interval  Software selectable Programmable    Digital Output   Type  Sink   I O Mode  DO or Pulse Output   Pulse Output Frequency  50 Hz   Over voltage Protection  45 VDC   Over current Protection  2 6 A  4 channels   650 mA   Over temperature Shutdown  160  C  min     Current Rating  200 mA per channel   DIO Output Leakage Current  3 6 mA   24 VDC    Relay Output   Type  Form A  N O   power relay   Contact Current Rating    e Resistive Load  1 A   30 VDC  250 VAC  110 VAC   Initial Insulation Resistance  1000 m ohms  min     500 VDC  Mechanical endurance  5 000 000 operations   Electrical endurance  600 000 operations   1 A resistive load  Contact Resistance  100 m ohms  max     Pulse Output  0 3 Hz at rated load    Power Requirements   Power Input  24 VDC nominal  12 to 36 VDC  Power Consumption    ioLogik W5348 HSDPA C    e Always on  196 mA   24 VDC   e On demand  189 mA   24 VDC    1 7    Moxa C Programmable RTU Controllers Introduction       Physical Characteristics   Dimensions  46 8 x 135 x 105 mm  1 84 x 5 31 x 4 13 in   Weight  495 g   Mounting  DIN rail  standard   wall  optional   Environmental Limits   Operating Temperature    Standard Models   10 to 55  C  14 to 131  F    Wide Temp  Models    ioLogik W5348 HSDPA C   20 to 70  C   4 to 158  F   Storage Temperature   40 to 85  C   40 to 185  F   Ambient Relative Humidity  5 to 95   non condensing   Altitude  Up to 2000 m   Note  Please contact Moxa if you require products guaranteed to function properly at 
52. gdbserver 192 168 4 142 2000 hello debug  Process hello debug created  pid 38    This tells the debugging server to listen for connections on network port 2000 of the network interface  192 168 4 142 of the target system  The name of the program to be debugged is indicated after the  network port  Additional arguments can be added after the program name as needed    2  In the host computer  switch to the directory that contains the program source     cd  my_work_directory myfilesystem testprograms    3  Execute the client program      ddd   debugger arm linux gdb hello debug  amp     4  Enter the following command at the GDB  ddd command prompt    gt  gt  target remote 192 168 4 142 2000    The command produces a line of output on the target system console  similar to the following   Remote debugging using 192 168 4 99 2000    5 3    Moxa C Programmable RTU Controllers Tool Chains for Application Development       192 168 4 99 is the host PC   s IP address  and 2000 is the port number  You can now begin debugging in the  host environment using the interface provided by ddd     5  Seta break point in the main function by double clicking or entering b main on the command line   6  Click the cont button     5 4    6    Programmer s Guide    This chapter includes important information for programmers   The following topics are covered in this chapter     O Flash Memory  O CLibrary   gt  APIs    Moxa C Programmable RTU Controllers Programmer s Guide       Flash Memory    Partition
53. gs of the target RTU controller to make sure that  an Internet connection is available  Refer to Chapter 2 for instructions on how to configure the Ethernet  interface  and see Chapter 4 for DNS setting information        Updating the Time Automatically    In this section  it shows how to use a shell script to update the time automatically     How to update the system time periodically     bin sh   ntpdate time nist gov     You can use the time server s ip address or domain    name directly  If you use domain name  you must     enable the domain client on the system by updating     etc resolv conf file    hwclock   systohc   sleep 100     Updates every 100 seconds  The min  time is 100 seconds  Change    100 to a larger number to update RTC less often   Save the shell script using any file name  E g   fixtime     How to update the time automatically when the kernel boots up   Copy the example shell script fixtime to directory  etc init d  and then perform the command  chmod 755  fixtime to change the shell script mode  Next  use vi editor to edit the file  etc inittab  Add the following line  to the bottom of the file     ntp   2345   respawn    etc init d fixtime    Perform the command  init q to re init the kernel     Executing Scheduled Commands with Cron  Daemon    Start Cron from the directory  etc rc d rc  local  It will return immediately without adding a     amp     to run in the  background     The Cron daemon will search  etc cron d crontab for crontab files  which 
54. he RTC time    hwclock    w   Write current system time to RTC    The following figure illustrates how to update the system time and set the RTC time     LOA 168 127 2564     Pub ty   ama ge   root Moxa    date  Fri Jun 23 23 30 31 CST 2000  root Moxa    hwclock  Fri Jun 23 23 30 35 2000  0 557748 seconds  root Moxa    date 120910002010  Thu Dec 9 10 00 00 CST 2010    root Moxa    hwclock  w    root Moxa    date   hwclock  Thu Dec 9 10 01 07 CST 2010  Thu Dec 9 10 01 08 2010  0 933547 seconds    root Moxa           Updating the Time with NTP Client    The Moxa C programming RTU controller has a built in NTP  Network Time Protocol  client that is used to  initialize a time request to a remote NTP server  Use  ntpdate  lt Time Server gt  to update the system time   and save it to the RTC      ntpdate time stdtime gov tw   hwclock  w    Visit http   www ntp org for more information about NTP and NTP server addresses        3 6    Moxa C Programmable RTU Controllers Managing the RTU Controllers       NOTE    POCO SS 200   PURES    root Moxa    date   hwclock  Sat Jan 1 00 00 36 CST 2000    Sat Jan 1 00 00 37 2000  0 772941 seconds    root Moxa    ntpdate time stdtion gov tw    9 Dec 10 58 53 ntpdate 207   step time server 220 130 158 52 offset 155905087  984256  sec   root Moxa    hwclock  w   root Moxa    date   hwclock   Thu Dec 9 10 59 11 CST 2010   Thu Dec 9 10 59 12 2010  0 844076 seconds    root Moxa           Before using the NTP client utility  check the IP and DNS settin
55. he following command to load the modules  iptable_filter  iptable_mangle  iptable_nat       modprobe iptable_filter    IPTABLES plays the role of packet filtering or NAT  Be careful when setting up the IPTABLES rules  If the rules  are not correct  remote hosts that are connected via a LAN or PPP may deny access  It is strongly recommended  to use the serial console to set up the IPTABLES    Click on the following links for more information about iptables    http   www  linuxguruz com iptables   http   www netfilter org documentation HOWTO  packet filtering  HOWTO html       Since the IPTABLES command is very complex  illustrating the IPTABLES syntax is divided into three categories   Observe and erase chain rules  Define policy rules  and Append or delete rules     Observe and Erase Chain Rules    Usage      iptables   t tables    L    n     t tables  Table to manipulate  default     filter      example  nat or filter     L  chain   List List all rules in selected chains  If no chain is selected  all chains are listed    n  Numeric output of addresses and ports      iptables   t tables    FXZ     F  Flush the selected chain  all the chains in the table if none is listed      X  Delete the specified user defined chain     Z  Set the packet and byte counters in all chains to zero     Examples     iptables  L  n    In this example  since we do not use the  t parameter  the system uses the default    filter    table  Three chains  are included  INPUT  OUTPUT  and FORWARD  INPUT 
56. higher altitudes     Standards and Certifications   Safety  UL 508  EN 60950 1  NCC   EMI    EN 55022  EN 61000 3 2  EN 61000 3 3   FCC Part 15  Subpart B  Class A   EMS    EN 55024  EN 61000 4 2  EN 61000 4 3    EN 61000 4 4  EN 61000 4 5  EN 61000 4 6   EN 61000 4 8  EN 61000 4 11  EN 61000 6 2  Mobile Network  PTCRB   Shock  IEC 60068 2 27   Freefall  IEC 60068 2 32   Vibration  IEC 60068 2 6   Green Product  RoHS  CRoHS  WEEE   Note  Please check Moxa   s website for the most up to date certification status     MTBF  mean time between failure   Time    ioLogik W5348 HSDPA C  280 739 hrs  Database  Telcordia  Bellcore     Warranty   Warranty Period  2 years     Because of the limited lifetime of power relays  products that use that component are covered by a 2 year  warranty    Details  See www moxa com warranty    1 8    2    Getting Started    In this chapter  it explains how to connect the Moxa RTU C Programmable controller  and how to get started on  the programming     The following topics are covered in this chapter     O I O and Communication Module Installation  O Installing the RTU Controller on a DIN Rail   gt  ioPAC 8020 C Series   gt  ioLogik W5348 C Series  O Grounding the RTU Controller   gt  ioPAC 8020 C Series   gt  ioLogik W5348 Series   O Powering on the RTU Controller  O LED Indicators   gt  ioPAC 8020 C Series   gt  ioLogik W5348 C Series  O Connecting the RTU Controller to a PC   gt  Serial Console   gt  Telnet Console   gt  SSH Console  O RTUAdmin Uti
57. in    The tool chain requires approximately 1 GB of hard disk space  To install the tool chain  follow the steps     1  Insert the Documentation and Software CD into your PC  and then enter the following commands    mount  dev cdrom  mnt cdrom   sh  mnt cdrom Software toolchain arm linux_3 3 2_V1 X_BuildXXXXXXXX sh   ioLogik W5348 V1 4  gt  sh   mnt cdrom Software toolchain arm linux_V1 X_BuildXXXXXXXX sh     Wait for the installation process to complete  This should take a few minutes   3  Add the directory  usr local arm linux bin to your path  You can do this in the current login by issuing  the following commands      export PATH     usr local arm linux bin  PATH     4  export LD_LIBRARY_PATH    usr local arm linux tools lib   LD_LIBRARY_PATH     Alternatively  the same commands can be added to  HOME  bash_profile to make it effective for all login  sessions     5 2       Moxa C Programmable RTU Controllers Tool Chains for Application Development       Compiling Applications  To compile a simple C application  use the cross compiler instead of the regular compiler      arm linux gcc  o example  Wall  g  02 example c   arm linux strip  s example   arm linux gcc  ggdb  o example debug example c    Most of the cross compiler tools are the same as their native compiler counterparts  only with an additional  prefix that specifies the target system  The prefix is    i386 linux     for x86 environments and    arm linux     for  MOXA RTU controllers  For example     gcc    is the
58. ing BINARY mode data connection for php tgz  1789032 bytes    226 File send OK    1789032 bytes received in 0 66 secs  2 6e 03 Kbytes sec   ftp gt        Step 4  Unzip the package  Perform the command    tar xvzf php tar gz        root Moxa  mnt ramdisk  tar xvzf php tgz       envvars   envvars old   httpd conf  httpd conf old  install sh   lib  lib libmysgqlclient so 15  lib libpng so 2  lib libphp5 so  lib libmysqlclient so 15 0 0  lib libgd so  1ib libxml2 s0 2 6 22  lib libgd so 2 0 0  lib libjpeg so  lib libxml2 so 2  lib libgd so 2   php   php php ini   phpinfo php    root Moxa  mnt ramdisk        Moxa C Programmable RTU Controllers Managing Communications       Step 5  Change directory to    php     Run    install sh    and select    Install PHP Package        LOZA  LOS Lado Pur ty    root Moxa  mnt ramdisk  cd php  root Moxa  mnt ramdisk php    install sh  Press the number    1  Install PHP package   2  Uninstall PHP package   3 BLES   1   Start to install PHP  Please wait  Starting web server  apache     PHP install sucess        root Moxa   mnt ramdisk php        Step 6  Open the page with the host PC   s browser  e g  http   192 168 127 254 phpinfo php      If you want to uninstall PHP  follow step 2 to 5  and select the Uninstall option     IPTABLES    IPTABLES is an administrative tool for setting up  maintaining  and inspecting the RTU controller   s IP packet  filter rule tables  Several different tables are defined  with each table containing built in chains a
59. lity   gt  Installing RTUAdmin   gt  Broadcast Search   gt  Main Screen Overview  O Configuring the Ethernet Interface   gt  Modifying Network Settings via Serial Console   gt  Adding a Default Gateway   gt  Adding DNS Settings  O Developing Procedures   gt  Installing the Tool Chain  Linux    gt  Checking the Flash Memory Space   gt  Compiling Hello c     gt  Uploading and Running the    Hello    Program    Moxa C Programmable RTU Controllers Getting Started       I O and Communication Module Installation    The 5 I O modules and single communication module may be selected for installation on the ioPAC 8020  system  all modules may be hot swapped  allowing for convenient installation removal at anytime     Care should be taken before installing the modules     1  I O modules  RM 1050 T  RM 1602 T  RM 2600 T  RM 3802 T  and RM 3810 T  may be installed on the  ioPAC 8020 C system in any order  However  the 9th slot of the ioPAC 8020 9 series is reserved for future  expansion  so I O modules may only be installed in slots 1 through 8    2  If multiple kKM 2430 T Ethernet communication modules are to be installed on the ioPAC 8020 C system   the installation order must start from the last slot and continue consecutively     downwards     9 8 7      Here  are some examples     Correct Installation  module installation in steps  from right to left           EII uw YY  o ooo 18 0000  L g o                    0 00       E   gt        L     gt     L L U LC       Incorrect Installatio
60. lled an encryption key or install a key different from that used to encrypt your program  In any  case  the encrypted program fails immediately     This mechanism also allows the computer with an encryption key to bypass programs that are not  encrypted  Therefore  in the development phase  you can develop your programs and test them in the  target computer cleanly     A    System Commands    Linux normal command utility collection     File manager    1     PPP Pe  PNL O    DUO OT NN    cp    mkdir  rmdir    Editor    L    2    al Oh G1  22 00 N    vi  cat  zcat  grep  cut  find  more  test  sleep  echo    Network    L     A E N    ping  route  netstat  ifconfig  tracerout  tftp  telnet   ftp    copy file   list file   make symbolic link file   mount and check file system  delete file   change file owner  amp  group  amp  user  change file owner   change file group   sync file system  let system file buffer be saved to hardware  move file   display now file directly   list now file system space   make new directory   delete directory    text editor   dump file context  compress or expand files  search string on file   get string on file   find file where are there  dump file by one page  test file exist or not  sleep  seconds    echo string    ping to test network  routing table manager  display network status  set network ip address  trace route    Moxa C Programmable RTU Controllers    System Commands       Process  1  kill  2  ps  Other  1  3dmesg  2  sty  3  zcat  4  mkno
61. m being copied  An application is compiled into a binary format bound  to the embedded computer and the operating system  OS  that the application runs on  As long as one obtains  it from the computer  he she can install it into the same hardware and the same operating system  The add on    value created by the developer is thus lost     Moxa used data encryption to develop this protection mechanism for your applications  The binary file  associated with each of your applications needs to undergo an additional encryption process after you have    developed it  The process requires you to install an encryption key in the target computer     1     Choose an encryption key  e g     ABigKey     and install it in the target computer by a pre  utility program      setkey        setkey ABigKey   NOTE  set an empty string to clear the encryption key in the target computer by     setkey          Develop and compile your program in the development PC    In the development PC  run the utility program    binencryptor    to encrypt your program with an encryption  key     binencryptor yourProgram ABigKey   Upload the encrypted program file to the target computerby FTP or NFS and test the program     The encryption key is a computer wise key  That is to say  a computer has only one key installed  Running  the program    setkey    multiple times overrides the existing key     To prove the effectiveness of this software protection mechanism  prepare a target computer that has not  been insta
62. n  in steps  from right to left                        ie  B 66          B 6666             m 0     66 6 S 6 666  000 OO  L L e  gt   gt    i e e L C  gt        o          o 6  0       6  0      o  P  gt  e          N L   U    a C     gt      gt           B 66                          0 000       AT 0 0        5 00 0 66 6  o    0  i  00  00000     ollo olo e l lalolole   olol ol o o    2 2    Moxa C Programmable RTU Controllers Getting Started       Installing the RTU Controller on a DIN Rail    ioPAC 8020 C Series    The aluminum DIN rail attachment plate should already be fixed to the back panel of the ioPAC 8020 C when  you take it out of the box  If you need to reattach the DIN rail attachment plate to the ioPAC 8020 C  make sure  the spring loaded bracket is situated towards the bottom  as shown in the following figures     NOTE Users can purchase a wall mounting  WK 75  kit separately     STEP 1  If the spring loaded bracket is locked in place  push the recessed button to release it  Once it is  released  you should feel some resistance from the spring as you slide the bracket up and down a few  millimeters in each direction     Spring Icaded bracket    Recessed button          2 3    Moxa C Programmable RTU Controllers Getting Started       Removing ioPAC 8020 C Series from the DIN Rail    To remove the ioPAC 8020 C from the DIN rail  use a screwdriver to push down the spring loaded bracket until  it locks in place  as shown in the diagram to the right  Next  rotate th
63. n this chapter we describe how to install a tool chain on the host computer to develop user applications  In  addition  the process for performing cross platform development and debugging is also introduced  For clarity   the MOXA C Programming RTU controller is called a target system     The following topics are covered in this chapter     O Linux Tool Chain   gt  Installing the Linux Tool Chain   gt  Compiling Applications   gt  On Line Debugging with GDB    Moxa C Programmable RTU Controllers Tool Chains for Application Development       Linux Tool Chain    NOTE    The Linux tool chain contains a suite of cross compilers and other tools  as well as the libraries and header files  that are necessary to compile your applications  These tool chain components must be installed on a  Linux based host computer  PC   The following Linux distributions can be used to install the tool chain     ioPAC 8020 series   e Fedora Core 6  on x86    e Mandrake 8 1  on x86    e Red Hat 7 3  8 0  9 0  on x86   e SuSE 7 3  on x86    e YellowDog 2 1  on PowerPC    e Solaris 7 and 8  on Sparc    e Debian 3 1  4 0  on x86    e Ubuntu 9 04   see note     ioLogik W5348 V1 4  the version of Glibc must be greater than 2 7   e Ubuntu 9 04  see note     Ubuntu users will need to prepare their system by entering the following commands     apt get install libncurse5 dev  mkdir  mnt ramdisk    Disregard the        unexpected operator  warning when installing the tool chain     Installing the Linux Tool Cha
64. nd  user defined chains     Each chain is a list of rules that apply to a specific type of packet  Each rule specifies what to do with a matching  packet  A rule  such as a jump to a user defined chain in the same table  is called a    target        The Moxa C programming RTU controller supports 3 types of IPTABLES table  Filter tables  NAT tables  and  Mangle tables     A  Filter Table   includes three chains   INPUT chain  OUTPUT chain  FORWARD chain  B  NAT Table   includes three chains   PREROUTING chain   transfers the destination IP address  DNAT   POSTROUTING chain   works after the routing process and before the Ethernet device process to transfer  the source IP address  SNAT   OUTPUT chain   produces local packets  sub tables  Source NAT  SNAT    changes the first source packet IP address  Destination NAT  DNAT    changes the first destination packet IP address  MASQUERADE   a special form for SNAT  If one host can connect to Internet  then other computers that  connect to this host can connect to the Internet when the computer does not have an actual IP address   REDIRECT   a special form of DNAT that re sends packets to a local host independent of the destination IP  address   C  Mangle Table   includes two chains  PREROUTING chain   pre processes packets before the routing process   OUTPUT chain   processes packets after the routing process   It has three extensions   TTL  MARK  TOS     4 6    Moxa C Programmable RTU Controllers Managing Communications       The f
65. ng PHP for Apache Web Server  IPTABLES    D 09 0     gt  Observe and Erase Chain Rules   gt  Define Policy for Chain Rules   gt  Append or Delete Rules  O NAT   gt  NAT Example   gt  Enabling NAT at Bootup    O Dial up Service   PPP  O PPPoE  O PPP over Cellular  O NFS  Network File System    gt  Setting up the RTU Controller as an NFS Client  O Mail  O OpenVPN    Moxa C Programmable RTU Controllers Managing Communications       Telnet FTP    The Telnet and FTP Server service is enabled by default on the RTU controller  To enable or disable the  Telnet ftp server  users need to edit the file  etc inetd conf     Enabling the Telnet FTP Server    The following example shows the default content of the file  etc inetd conf     telnet stream tcp nowait root  bin telnetd  ftp stream tcp nowait root  bin ftpd  I    Disabling the Telnet FTP Server    Disable the daemon by typing         in front of the first character of the row to comment out the line     DNS    To set up DNS client for the RTU controller  users need to edit three configuration files   etc hosts    etc resolv conf  and  etc nsswitch conf      etc hosts    The hosts is the first file that the RTU controller system reads to resolve the host name of the remote IP  address      etc resolv conf    The resolv conf contains the remote DNS server s address in it  Ask the network administrator or service  provider which DNS server address should be configured to this file  The DNS server   s IP address is specified  with the
66. nnect    at  etc ppp peers      dev ttyACMo   115200   defaultroute   noipdefault   usepeerdns   ertscts   lock   noauth   local   debug   logfile  etc ppp cellular_temp moxa_ppp  log  lep echo failure 4   lep echo interval 65535   connect   bin fchat  V  t 10  f  etc ppp peers cellular cmda     Perform the command     pppd call cellular connect    NFS  Network File System     The Network File System  NFS  is used to mount a disk partition on a remote machine  as if it were on a local  hard drive  allowing fast  seamless sharing of files across a network  NFS allows users to develop applications  for the Moxa C programming RTU controller  without worrying about the amount of disk space that will be  available  The Moxa RTU controller supports NFS protocol for client     NOTE Click on the following links for more information about NFS   http   www tldp org HOWTO NFS HOWTO index html  http   nfs sourceforge net nfs howto client html  http   nfs sourceforge net nfs howto server html             Setting up the RTU Controller as an NFS Client    The following procedure is used to mount a remote NFS Server     1  To know the NFS Servers shared directory   2  Establish a mount point on the NFS Client site   3  Mount the remote directory to a local directory      mkdir  p  home nfs  public   mount  t nfs NFS_Server IP   directory  mount point    Example    mount  t nfs 192 168 127 100  home  public  home nfs  public    4 16       Moxa C Programmable RTU Controllers Managing Communica
67. nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn nnna B 1    1    Introduction    The Moxa C programmable RTU controller is a system with 1 or 2 10 100 Mbps Ethernet ports  an internal SD  socket  1 or 2 RS 232 422 485 serial ports  built in or user selectable modular I Os  and pre installed  operating system  depending on the specific model  The Moxa C programmable RTU controller offers  high performance communication capability  and high storage capacity in one compact and rugged box  It is  the ideal solution for stand alone  remote monitoring applications in hard to wire environments  and  applications that require a great deal of memory space  advanced processing power  integration with physical  I O channels  and other peripherals     The following topics are covered in this chapter     O Overview  O Software Architecture   gt  Journaling Flash File System  JFFS2    gt  Software Package  O Available Products   gt  ioPAC 8020 C Series   gt  ioLogik W5348 C Series  O Product Specifications   gt  ioPAC 8020 Series   gt  ioLogik W5348 Series    Moxa C Programmable RTU Controllers Introduction       Overview    The Moxa C programmable RTU controller uses the Moxa ART RISC CPU  The RISC architecture and advanced  semiconductor technology provide the RTU controller with a powerful computing engine and communication  functions without generating a lot of heat  A 32 MB NOR Flash ROM  64 MB on board SDRAM  and an SD socket  provide enough memory for you to install applic
68. ns sees eee eee e e e e e r e r e r e Ke Ke K e K KKK 4 14  PAPER suas siueuwse rns wee vere w ee etvouibusiyents 4 14  PPP  over aT  TTT 4 15  NESA NetworkiRile Systemi  sanciona rra rara ta Da e a RARA ada 4 16  Setting up the RTU Controller as an NFS Client see e e e r r r e K e Kee Ke KKK 4 16   ES  a SS RSS pe SS aS EN EEEE UO ce eer az 4 17  OpenVPN a ea 4 17  Setup 1  Ethernet Bridging for Private Networks on Different SUDNEES sese ee ee e e e r ee e re rre 4 18   Setup 2  Ethernet Bridging for Private Networks on the Same Subnet sese ee r e e e e ee K r e K ee Ke y 4 22   Set  p 3  ROUTE 1 tt A A AAA 4 23   Tool Chains for Application Development    ssssssessessess essen vesse s sese ss essen resen ennenen rse enesenn ennenen 5 1  ADA NS aY peeps pens oem eee nS ae A EA EAE OE ARE ESTES 5 2  Installing  the  Linux Tool Calin 5555555527553 555 5 553575753 TAT TEST ia 5 2  Compiling Applications oes suskese de hos hose Seen teen a de 5 3  On Line  Debugging  With    GDB  i    sz sss ey E n e er e tt 5 3  Programmer s Guide A renen ren nenen nnn nenen ennenen nenen Renean enean nananana 6 1  FlASHIMOMORY ite teeta ieee e E beret wept er e ee ated ae a tvaRdcaedeenties Seepebes ET 6 2  CU SEA E T ccc cc a E A cle asas 6 2  APU A AA AA A A ER LEE E E E nak 6 2  Software LOCK HHHH 7 1  System COMMAaNndS      ssssssssssssusnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnannnnnnnnnnn nnna nananana nnana nann A 1    Module Specifications and Wiring          sssssssssssnunnunnnnnnnn
69. ocal    RTS echo  Load user s script from  home autoexec sh         tmp hello release    2 17       3    Managing the RTU Controllers    This chapter includes information for version control  deployment  updates  and peripherals  The information in  this chapter will be useful when users need to run the same application on several Moxa RTU controllers     The following topics are covered in this chapter     O System Version Information   O Firmware Upgrade and Default Settings   gt  Upgrading the Firmware   gt  Loading Factory Defaults    O Enabling and Disabling Daemons    Q    Setting the Run Level   O Adjusting the System Time    gt  Setting the Time Manually    gt  Updating the Time with NTP Client   gt  Updating the Time Automatically    O Executing Scheduled Commands with Cron Daemon    Moxa C Programmable RTU Controllers Managing the RTU Controllers       System Version Information    NOTE    To verify the hardware capability of the target RTU controller  and the supported software  check the version  numbers of your Moxa RTU controller   s hardware  kernel  and user file system  Contact Moxa to verify the    hardware version  You will need the Production S N  Serial number   which is labeled on the RTU controller   s  bottom     To check the kernel version  type      kversion  a       ECON 1 115200 None 8 1   T100    fes rootf  Moxa     kversion  a  ioPAC 8020 C version 1 0 0 build 2011 7 20 19  GS root Moxa           The kernel version number is for factory default c
70. ollowing figure shows the IPTABLES hierarchy   Incoming  Packets  Mangle Table  PREROUTING Chain  NAT Table  PREROUTING Chain              Local Host  Packets  Mangle Table  INPUT Chain    Other Host  Packets  Mangle Table  FORWARD Chain                       Filter Table  INPUT Chain    Local  Process  Mangle Table  OUTPUT Chain    Filter Table  FORWARD Chain                 Mangle Table  POSTROUTING Chain          NAT Table  OUTPUT Chain         Filter Table  OUTPUT Chain       NAT Table  POSTROUTING Chain  Outgoing  Packets    The Moxa C programming RTU controller supports the following sub modules  Be sure to use the module that  matches the real application                                ip_conntrack ipt_MARK ipt_ah ipt_state  ip_conntrack_ftp ipt_MASQUERADE ipt_esp ipt_tcpmss  ipt_conntrack_irc ipt_MIRROT ipt_length ipt_tos  ip_nat_ftp ipt_REDIRECT ipt_limit ipt_ttl  ip_nat_irc ipt_REJECT ipt_mac ipt_unclean  ip_nat_snmp_basic ipt_TCPMSS ipt_mark   ip_queue ipt_TOS ipt_multiport   ipt_LOG ipt_ULOG ipt_owner                   NOTE The Moxa C programming RTU controller Do NOT support IPV6 and ipchains     The basic syntax to enable and load an IPTABLES module is as follows    Ilsmod   modprobe ip_tables     modprobe iptable_filter    Moxa C Programmable RTU Controllers Managing Communications       NOTE    Use the Ismod command to check if the ip_tables module has already been loaded in the Moxa RTU unit  Use  the modprobe command to insert and enable the module     Use t
71. onfiguration  You may download the latest firmware version  from Moxa   s website and then upgrade the RTU controller   s hardware        Firmware Upgrade and Default Settings    Upgrading the Firmware    The Moxa RTU controller   s kernel and root file system are combined into one firmware file  which can be found  in the Software and Document CD or be downloaded from Moxa   s website  www moxa com   The name of the  file has the form xxxx hfm  To upgrade the firmware  the firmware file should be placed in the target RTU  controller   s Ramdisu  using SD card or FTP     ATTENTION    Upgrading the firmware will erase all data on the Flash ROM  Firmware upgrade requires the RTU controller   s RAM disk  If the application data is stored in the RAM disk  back  up or remove the data before upgrading the firmware        Since different Flash disks have different sizes  it is recommended to check the size of the current Flash disk  before upgrading the firmware  You can do so by using the  df  h command to list the size of each memory  block and see how much free space is available in each block     Follow the steps to transfer the firmware file to the RTU controller   s RAM disk  and to upgrade the firmware     1  Type the following commands to enable the RAM disk    upramdisk  Hcd  mnt ramdisk    2  Activate the PC s FTP server  and put the firmware file to the FTP folder     3 2    Moxa C Programmable RTU Controllers Managing the RTU Controllers       3  In Moxa RTU Controller  
72. pability for users to load the Factory Default  Image file  User settings and applications are saved in the user directory     To improve system reliability  the Moxa C programmable RTU controller has a built in mechanism that prevents  the system from crashing  When the kernel boots up  the RTU will mount the root file system in read only mode   and then enable services and daemons  At the same time  the kernel will start searching for system  configuration parameters via rc or inittab     Normally  the kernel uses the Root File System to boot up the system  The Root File System is protected  and  cannot be changed by users  which creates a safe zone for users     For more information about the memory map and programming  refer to Chapter 6  Programmer s Guide     1 2    Moxa C Programmable RTU Controllers Introduction       Journaling Flash File System  JFFS2     The Root File System and User directory in the flash memory is formatted with the Journaling Flash File  System  JFFS2   The formatting process places a compressed file system in the flash memory  This operation  is transparent to users     The Journaling Flash File System  JFFS2   which was developed by Axis Communications in Sweden  puts a file  system directly on the flash  instead of emulating a block device  It is designed for use on flash ROM chips and  recognizes the special write requirements of a flash ROM chip  JFFS2 implements wear leveling to extend the  life of the flash disk  and stores the flash dire
73. r input OFF  No system power available  Green  Power on   LINK Tool chain API control Green Off   READY System status Green  System ready  Off  System boot up error  Green Flashing  System booting   Tool chain API control Green Off  After booting up  the API is able to   control this LED    DATA Serial communication activity OFF  No serial communication  Green  Serial Tx Rx   FAULT Tool chain API control Red Off   SIGNAL Tool chain API control Green Off    Connecting the RTU Controller to a PC    There are three ways to connect the Moxa C programming RTU controller to a PC  through the serial console     Telnet SSH console  or the RTUAdmin utility over the network     Serial Console    The serial console gives users a convenient way of connecting to the RTU controller  This method is particularly  useful when using the computer for the first time  The serial console is also effective for connecting the RTU  controller when users do not know the target network settings and IP addresses     To use the serial console  remove the cover from the front and top panel first  and attach the 4 pin serial  console cable to the console port           Moxa C Programmable RTU Controllers Getting Started       Console Port for the ioPAC 8020 C Series       EAEN s O    wO      e    rome O       SN E Serial Console Port    TE    O  7  L  C                                Serial Console Port                                                          Pin Assignment for the Serial Console Port     
74. ro RTU controller with 4AIs  8 DIOs  2 relay outs  C programming  capability   20 to 70  C operating temperature    1 4    Moxa C Programmable RTU Controllers Introduction       Product Specifications    ioPAC 8020 Series    Computer   CPU  ARM9 based CPU  32 bit 160 MHz   OS  Linux   Clock  Real time clock with battery backup   SDRAM  64 MB   Flash  32 MB   SD    Slot  Up to 32 GB  SD 2 0 compatible    Note  For units operating in extreme temperatures  industrial grade  wide temperature SD cards are required     Ethernet Interface   LAN  2 auto sensing 10 100 Mbps switch ports  M12 or RJ45   Ethernet Relay Function  Hardware Normal Close  Protection  1 5 KV magnetic isolation    Serial Interface  Serial COM1  RS 232 422 485  DB9 male   Serial Debug Port  RS 232  4 pin connector     Serial COM1 Signals   RS 232  TxD  RxD  DTR  DSR  RTS  CTS  DCD  GND  RS 422  TxD   TxD   RxD   RxD   GND  RS 485 4w  TxD   TxD   RxD   RxD   GND  RS 485 2w  Data   Data   GND    Power Requirements   Input Voltage  12 to 36 VDC   Note  Compliant with EN 50155 at 24 VDC   Power Consumption  R 25 C184 mA   24 VDC  without I O modules     Physical Characteristics   Housing  Aluminum   Dimensions    5 slot Version  190 9 x 135 x 100 mm  7 52 x 5 31 x 3 94 in   9 slot Version  292 5 x 135 x 100 mm  11 52 x 5 31 x 3 94 in   I O Module Slots  5 or 9 slots  the 9th slot is reserved   Weight    5 slot Version  2 000 g   9 slot Version  2 575 g   Mounting  DIN rail  standard   wall  with optional kit     En
75. root file system     Format MTD device   dev mtd2        MTD device   dev mtdZ  erase 128 Kibyte   1000000    100  complete   Wait to write file       Completed 828     ATTENTION    The upfirm utility will reboot your target RTU controller after the upgrade is done        Loading Factory Defaults    To load the factory default settings  press and hold the RESET button for more than 5 seconds  All files in the   home  amp  etc directory will be removed     Enabling and Disabling Daemons    The following daemons are enabled when the RTU controller is boot up     telnetd Telnet Server   Client daemon    inetd Internet Daemons  ftpd FTP Server   Client daemon  sshd Secure Shell Server daemon    3 3    Moxa C Programmable RTU Controllers Managing the RTU Controllers       httpd Apache WWW Server daemon    Perform the command    ps  ef    to list all the running processes                 root Moxa    cd  etc    root Moxa  etc  ps  ef    PID Uid VmSize Stat Command  root 532 S init  3   root SWN  ksoftirqd 0   root SW lt   events 0   root SW lt   khelper   13 root SW lt   kblockd 0   14 root SW  khubd   24 root SW  pdflush   25 root SW  pdflush   27 root  aio 0   26 root SW  kswapd0   604 root SW  mtdblockd   609 root SW   pccardd   611 root Sw   pccardad   625 root  jffs2_gcd_mtd3   673 root 500  bin inetd  679 root 3004  usr bin httpd  k start  d  etc apache  682 bin 380  bin portmap  685 root 1176  694 nobody 3012  695 nobody 3012  696 nobody 3012  697 nobody 3012  698 nobody 301
76. test cgi  CGI 1 0 test script report    argc is 0  argv is     SERVER_SOFTWARE   Apache 2 2 8  Unix  mod_ss1 2 2 8 OpenSSL 0 9 8i  SERVER_NAME   192 168 127 254   GATEWAY_INTERFACE   CGI 1 1   SERVER_PROTOCOL   HTTP 1 1   SERVER_PORT   80   REQUEST_METHOD   GET   HTTP_ACCEPT   text html  application xhtml xml  application xml q 0 9     q 0 8  PATH_INFO     PATH_TRANSLATED     SCRIPT_NAME    cgi bin test cgi   QUERY_STRING     REMOTE_HOST  REMOTE_ADDR  REMOTE_USER  AUTH_TYPE    CONTENT TYPE    CONTENT LENGTH      192 168 127 201       NOTE The CGI function is enabled by default  Modify the file  etc apache conf httpd conf t to disable it  While   developing the customized CGI application  make sure the CGI file is executable   192 168 127 254   PuTTY   root Moxa   home httpd cgi bin  ls  al    drwxr xr x 2 root root 0 Aug 24 1999       drwxr xr x 5 root root 0 Nov 5 16 16   IWXI   XI X I ropt root 757 Aug 24 1999  root Moxa  home httpd cgi bin        4 3    Moxa C Programmable RTU Controllers Managing Communications       Installing PHP for Apache Web Server    The Moxa C programming RTU controller supports the PHP option  However  since the PHP file is 3 MB  it is not  installed by default  To install it  first make sure there is enough free space  at least 3 MB  on the target RTU  controller   s flash ROM     Step 1  Check if the system contains enough free space by performing the df  h command                 root Moxa  bin  df  h   Filesystem Used Available Use  Mounted on
77. tions       Mail    NOTE    smtpclient is a minimal SMTP client that takes an email message body and passes it on to an SMTP server  It  is suitable for applications that use email to send alert messages or important logs to a specific user     Click on the following link for more information about smtpclient  http   www engelschall com sw smtpclient           To send an email message  use the    smtpclient    utility  which uses SMTP protocol  Type  smtpclient  help to  see the help message     Example   smtpclient  s test  f sender company com  S IP_address receiver company com   lt  mail body message     s  The mail subject    f  Sender   s mail address   S  SMTP server IP address    The last mail address receiver company com is the receiver   s e mail address  mail body message is the  mail content  The last line of the body of the message should contain ONLY the period       character     You will need to add your hostname to the file  etc hosts     OpenVPN    NOTE    OpenVPN provides two types of tunnels for users to implement VPNS  Routed IP Tunnels and Bridged  Ethernet Tunnels  To begin with  make sure that the system has a virtual device  dev net tun  If not  issue  the following command       mknod  dev net tun c 10 200    An Ethernet bridge is used to connect different Ethernet networks together  The Ethernets are bundled into one  bigger     logical    Ethernet  Each Ethernet corresponds to one physical interface  or port  that is connected to the  bridge     On 
78. uires approximately 150 MB  of hard disk space on your PC  The RTU controller   s Tool Chain software is located on the attached Document  and Software CD  To install the Tool Chain  insert the CD into your PC and then issue the following commands      mount dev cdrom  mnt cdrom   sh  mnt cdrom Software toolchain arm linux_3 3 2_V1 X_BuildXXXXXXXX sh     ioLogik W5348 V1 4  gt  sh  mnt cdrom Software toolchain arm linux_V1 X_BuildXXXXXXXX sh     The Tool Chain will be installed automatically on the host Linux PC within a few minutes  Before compiling the  program  be sure to set the following path first  since the Tool Chain files  including the compiler  link  and  library  are located in this directory     PATH  usr local arm linux bin  PATH    Setting the path allows you to run the compiler from any directory     Checking the Flash Memory Space    If the flash memory is full  you will not be able to save data to the Flash ROM  Use the following command to  calculate the amount of    Available    flash memory       gt df  h    E COM1 115200 None 8 1   T100 E    fe root Moxa  fetc network  df  h  Filesystem Size Used Available Uset Mounted on    dev root 16 0M 6 7m 9 3M 42               OTR     RTS   dev ram3 1003 0K 9 0K 943 0K 1   dev  7 dev   Y an   499 0K 15 0K 459 0K 3   var   dev mtdblock3 12 0M 628 0K 11 41 5   tmp   dev  mtdblock3 12 0M 628 0K 11 4M 5     home    dev mtdblock3 12 0M 628 0K 11 4M 5  fete  mp fs 30  4M 0 30 4M 0   dev shm    root Moxa   etc network    
79. vironmental Limits   Operating Temperature   40 to 75  C   40 to 167  F    Storage Temperature   40 to 85  C   40 to 185  F    Ambient Relative Humidity  5 to 95   non condensing    Altitude  Up to 2000 m   Note  Please contact Moxa if you require products guaranteed to function properly at higher altitudes     Standards and Certifications   Safety  UL 508   EMI    EN 61000 3 2  EN 61000 3 3  EN 61000 6 4   FCC Part 15  Subpart B  Class A    1 5    Moxa C Programmable RTU Controllers Introduction       EMS    EN 55024  EN 61000 4 2  EN 61000 4 3    EN 61000 4 4  EN 61000 4 5  EN 61000 4 6    EN 61000 4 8  EN 61000 4 11  EN 61000 6 2   Shock  IEC 60068 2 27   Freefall  IEC 60068 2 32   Vibration  IEC 60068 2 6   Rail Traffic  EN 50155  EN 50121 3 2  EN 50121 4   Green Product  RoHS  CRoHS  WEEE   Note  Please check Moxa   s website for the most up to date certification status     MTBF  mean time between failure   Time  690 214 hrs  Database  Telcordia  Bellcore     Warranty  Warranty Period  5 years  Details  See www moxa com warranty    ioLogik W5348 Series    Computer  CPU  ARM9 based CPU  32 bit 160 MHz  SDRAM Flash  64 MB   32 MB    Storage  Expansion Slot  Up to 32 GB SD    memory card  SD 2 0 compatible   Note  For units operating in extreme temperatures  industrial grade  wide temperature SD cards are required     Cellular   Network    ioLogik W5348 HSDPA C    e Tri band UMTS HSDPA 850 1900 2100 MHz  e Quad band GSM GPRS EDGE 850 900 1800 1900 MHz  Internet    HSDPA    
80. word for the account     4 14    Moxa C Programmable RTU Controllers Managing Communications       4     10     Edit the file  etc ppp pap secrets and add the following      username hinet net       password        EY COM1 115200 None 8 1   T100  10  xj  fes   INBOUND connections a     ore   Every regular user can use PPP and has to use passwords from  etc passwd     RTs     nn                   PPPOE user example  if you want to use it ou need to unmark it and modify it    UserIDs that cannot use PPP at all  Check your  etc passwd and add any     other accounts that should not be able to use pppd    guest hostname ida  master hostname ins  root hostname ae    support hostname aan  stats hostname iiai       username hinet net    is the username obtained from the ISP to log in to the ISP account      password    is the corresponding password for the account   Edit the file  etc ppp options and add the following line     plugin pppoe    EY  COM1 115200 None 8 1   T100  10  xj  A    Tes   This wait period only applies if the connect or pty option is used    connect delay  lt n gt    ETR     RTs   Load the pppoe plugin   Plugin  lib pppoe so    R     lt End of File gt                  Add one of the two files   etc ppp options ethO  The choice depends on which LAN is connected to the  ADSL modem  If you use LAN1 to connect to the ADSL modem  then add  etc ppp options ethoO  The file  context is shown below        E  COM1 115200 None 8 1 Y T100  el Pane usernaneGhinet net    mtu 1
81. y  what you want     192 1 1 17    This is a degenerate case of a general option of the form x x x x y y y y  Here x x x x is the local IP address and  y y y y is the IP address of the remote end of the PPP connection  If this option is not specified  or if just one  side is specified  then x x x x defaults to the IP address associated with the local machine   s hostname  located  in  etc hosts   and y y y y is determined by the remote machine     Example 2  Connecting to a PPP Server over a Hard wired Link    If a username and password are not required  use the following command  note that noipdefault is optional     pppd connect    chat  v                      noipdefault  dev ttyMO 19200 crtscts         If a username and password are required  use the following command  note that noipdefault is optional  and  both the username and password are root       pppd connect    chat  v              Y   user root password root noipdefault   dev ttyMO 19200 crtscts    How to Check the Connection    Once a PPP connection is set up  you can follow the steps to test the connection  First  type    sbin ifconfig    You should be able to see all the network interfaces that are UP  Check    pppO    interface  and you should  recognize the first IP address as your own  and the    P t P address     or point to point address  the address of  your server  Here   s what it looks like on the RTU controller     lo Link encap Local Loopback   inet addr 127 0 0 1 Bcast 127 255 255 255 Mask 255 0 0 
82. y using  Telnet  ftp  or finger  bearing in mind that you ll have to use numeric IP addresses unless you ve set up     etc resolv conf correctly     Setting up a Machine for Incoming PPP Connections    This first example applies to using a modem  and requiring authorization with a username and password   pppd dev ttyMO 115200 crtscts modem 192 168 16 1 192 168 16 2 login auth  You should also add the following line to the file  etc ppp pap secrets         uu      The first star     lets everyone login  The second star     lets every host connect  The pair of double quotation  marks      is to use the file  etc passwd to check the password  The last star     is to let any IP connect     The following example does not check the username and password     pppd dev ttyMO 115200 crtscts modem 192 168 16 1 192 168 16 2    PPPoE    1  Connect the RTU controller   s LAN port to an ADSL modem with a cross over cable  HUB  or switch    2  Log in to the RTU controller as the root user    3  Edit the file  etc ppp chap secrets and add the following      username hinet net       password        EY  COM1 115200 None 8 1   T100  lol xj      client server secret IP addresses                PPPOE example  if you want to use it  you need to unmark it and modify it   password         usernamefhinet net            following is INBOUND for every one    nu              username hinet net    is the username obtained from the ISP to log in to the ISP account     password     is the corresponding pass
    
Download Pdf Manuals
 
 
    
Related Search
    
Related Contents
  USER MANUAL - Sears PartsDirect  Appartement Maison  取扱説明書 - SoftBank SELECTION  Sun Blade X6250 Server Module Service Manual  User Manual  Fiche d`Inscription 2ème Semestre 2015 Résidants Communauté de    Copyright © All rights reserved. 
   Failed to retrieve file