Table of Contents Introduction ............................1-1 Overview ............................1-2 Software Specifications........................1-2 Software Components ......................... 1-3 Software Configuration ........................2-1 Starting from a VGA Console ........................ 2-2 Connecting from a Telnet Console ......................2-3 Connecting from an SSH Console ......................2-4 Windows Users ...........................
Introduction Thank you for purchasing the Moxa DA-710 Series of x86 ready-to-run embedded computers. This manual introduces the software configuration and management of the DA-710-LX, which runs the Linux operating system. For hardware installation, connector interfaces, setup, and upgrading the BIOS, please refer to the “DA-710 Series Hardware User’s Manual.”...
Introduction Overview The Moxa DA-710 Series of x86-based rackmount embedded computers are designed for industrial data acquisition applications. Their state-of-the-art two expansion module design gives users a versatile combination of up to 16 RS-232/422/485 serial ports, or up to 4+8 Ethernet ports. This friendly design gives users the advantage of being able to swap out modules quickly and easily.
DA-710 Series Linux Introduction Software Components The DA-710-LX pre-installed Debian Lenny 5.0 Linux distribution has the following software components: acpi-support-base 0.109-11 scripts for handling base ACPI events such as the power button acpid 1.0.8-1lenny1 Utilities for using ACPI power management adduser 3.110...
Page 7
DA-710 Series Linux Introduction findutils 4.4.0-2 utilities for finding files--find, xargs 0.17-18 The FTP client 4:4.3.2-2 The GNU C++ compiler g++-4.3 4.3.2-1.1 The GNU C++ compiler 4:4.3.2-2 The GNU C compiler gcc-4.2-base 4.2.4-6 The GNU Compiler Collection (base package) gcc-4.3 4.3.2-1.1...
Page 8
DA-710 Series Linux Introduction libgc1c2 1:6.8-1.1 conservative garbage collector for C and C++ libgcc1 1:4.3.2-1.1 GCC support library libgcrypt11 1.4.1-1 LGPL Crypto library - runtime library libgdbm3 1.8.3-3 GNU dbm database routines (runtime version) libgmp3c2 2:4.2.2+dfsg-3 Multiprecision arithmetic library libgnutls26 2.4.2-6+lenny1...
Page 9
DA-710 Series Linux Introduction libslang2 2.1.3-3 The S-Lang programming library - runtime version libsnmp-base 5.4.1~dfsg-12 SNMP (Simple Network Management Protocol) MIBs and documentati libsnmp15 5.4.1~dfsg-12 SNMP (Simple Network Management Protocol) library libsqlite3-0 3.5.9-6 SQLite 3 shared library libss2 1.41.3-1 command-line interface parsing library libssl0.9.8...
Page 10
DA-710 Series Linux Introduction threading mysql-common 5.0.51a-24+lenny2 MySQL database common files ncurses-base 5.7+20081213-1 basic terminal type definitions ncurses-bin 5.7+20081213-1 terminal-related programs and man pages ncurses-term 5.7+20081213-1 additional terminal type definitions net-tools 1.60-22 The NET-3 networking toolkit netbase 4.34 Basic TCP/IP networking system netcat-traditional 1.10-38...
Page 11
DA-710 Series Linux Introduction sysvinit-utils 2.86.ds1-61 System-V-like utilities 1.20-1 GNU version of the tar archiving utility tasksel 2.78 Tool for selecting tasks for installation on Debian systems tasksel-data 2.78 Official tasks used for installation of Debian systems tcpd 7.6.q-16 Wietse Venema's TCP wrapper utilities tcpdump 3.9.8-4...
Software Configuration In this chapter, we explain how to operate a DA-710-LX computer directly or from a PC near you. There are three ways to connect to the DA-710-LX computer: through VGA monitor, by using Telnet over the network, or by using an SSH console from a Windows or Linux machine.
DA-710 Series Linux Software Configuration Starting from a VGA Console Connect the display monitor to the DA-710-LX VGA connector, and then power it up by connecting it to the power adaptor. It takes about 30 to 60 seconds for the system to boot up. Once the system is ready, a login screen will appear on your monitor.
DA-710 Series Linux Software Configuration Connecting from a Telnet Console The DA-710-LX computer comes with four basic Gigabit Ethernet ports named LAN1 to LAN4. The default IP addresses and netmasks of the network interfaces are as follows: Default IP Address...
DA-710 Series Linux Software Configuration Connecting from an SSH Console The DA-710-LX computer supports an SSH Console to offer users with better security over the network compared to Telnet. Windows Users Click on the link http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html to download PuTTY (free software) to set up an SSH console for the DA-710-LX in a Windows environment. The following screen shows an example of the configuration that is required.
DA-710 Series Linux Software Configuration Adjusting the System Time The DA-710-LX has two time settings. One is the system time, and the other is provided by an RTC (Real Time Clock) built into the DA-710- LX’s hardware. Setting the Time Manually Use the date command to query the current system time or set a new system time.
DA-710 Series Linux Software Configuration ATTENTION Before using the NTP client utility, check your IP address and network settings to make sure an Internet connection is available. Updating the Time Automatically This section describes how to use a shell script to update the time automatically.
DA-710 Series Linux Software Configuration Enabling and Disabling Daemons The following daemons are enabled when the DA-710-LX boots up for the first time. • snmpd SNMP Agent Daemon • elnetd Telnet Server/Client Daemon • inetd Internet Daemons ftpd • FTP Server/Client Daemon sshd •...
Page 19
DA-710 Series Linux Software Configuration To run a private daemon, you can edit the file rc.local as follows: 1. Because the root file system is mounted in Read-only mode, you need to re-mount it with write permission. MOXA:~# mount -o remount,rw /dev/hda1 / 2.
DA-710 Series Linux Software Configuration Setting the Run-Level To set the Linux run-level and execution priority of a program, use the following command (because the root file system is mounted in Read-only mode, we need to re-mount it with write permission).
DA-710 Series Linux Software Configuration Cron—Daemon for Executing Scheduled Commands The Cron daemon will search /etc/crontab for crontab files, which 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. When executing commands, output is mailed to the owner of the crontab (or to the user named in the MAILTO environment variable in the crontab, if such a user exists).
DA-710 Series Linux Software Configuration Inserting a USB Storage Device into the Computer Since mounting USB storage devices manually can be difficult, a Debian package named usbmount to mount the USB drivers automatically. usbmount relies on udev to mount USB storage devices automatically at certain mount points.
ATTENTION The DA-710 Series Embedded Computer does not support the CompactFlash hot swap function. You must remove the power source first before inserting or removing the CompactFlash card. If you do not shut down the power source, you could damage your CompactFlash card.
DA-710 Series Linux Software Configuration APT—Installing and Removing Packages APT is the Debian tool used to install and remove packages. Before installing a package, you need to configure the apt source file, /etc/apt/sources.list, which is located in the read-only partition.
Managing Communications The DA-710-LX ready-to-run embedded computer is a network-centric platform designed to serve as a front-end for data acquisition and industrial control applications. This chapter describes how to configure the various communication functions supported by the Linux operating system. The following topics are covered in this chapter: ...
DA-710 Series Linux Managing Communications Changing the Network Settings The DA-710-LX computer has four basic Gigabit Ethernet ports named LAN1 to LAN4. The LAN Port Expansion Module supports an additional four 10/100 Mbps Ethernet ports named LAN5 to LAN8. The default IP addresses...
DA-710 Series Linux Managing Communications Dynamic IP Address using DHCP To configure one or both LAN ports to request an IP address dynamically, replace static with dhcp and then delete the rest of the lines. # The primary network interface...
6. You may also use the lspci command to view more information on each PCI slot. root@Moxa:~#lspci 07:0c.0 Serial controller: Moxa Technologies Co Ltd CP118U (8-port RS-232/422/485 Smart Universal PCI) 07:0d.0 PCI bridge: Tundra Semiconductor Corp. Device 8100 (rev 01) 07:0e.0 Serial controller: Moxa Technologies Co Ltd CP118U (8-port RS-232/422/485...
DA-710 Series Linux Managing Communications 7. To change the order of device nodes and module names, you can write a rule in /etc/udev/rules.d/96-moxa.rules. #CARD 0 KERNEL=="ttyM16", SYMLINK="ttyN0" KERNEL=="ttyM17", SYMLINK="ttyN1" KERNEL=="ttyM18", SYMLINK="ttyN2" KERNEL=="ttyM19", SYMLINK="ttyN3" KERNEL=="ttyM20", SYMLINK="ttyN4" KERNEL=="ttyM21", SYMLINK="ttyN5" KERNEL=="ttyM22", SYMLINK="ttyN6" KERNEL=="ttyM23", SYMLINK="ttyN7"...
DA-710 Series Linux Managing Communications For example, use the following commands to set /dev/ttyM0 to RS-422: MOXA:~# setinterface /dev/ttyM0 2 MOXA:~# setinterface /dev/ttyM0 Now setting is RS422 interface. MOXA:~# Telnet/FTP Server In addition to supporting Telnet client/server and FTP client/server, the DA-710-LX also supports SSH and sftp client/server.
DA-710 Series Linux Managing Communications DNS Client The DA-710-LX supports DNS client (but not DNS server). To set up DNS client, you need to edit three configuration files: /etc/hostname, /etc/resolv.conf, and /etc/nsswitch.conf. /etc/hostname 1. Mount the root file system with write permission.
DA-710 Series Linux Managing Communications /etc/nsswitch.conf This file defines the sequence of files, /etc/hosts or /etc/resolv.conf, to be read to resolve the IP address. The hosts line in /etc/nsswitch.conf means use /etc/host first and DNS service to resolve the address.
DA-710 Series Linux Managing Communications Disabling the CGI Function The CGI function is enabled by default. If you want to disable the function, modify the file /etc/apache2/sites-available/default. 1. Mount the root file system with write permission. MOXA:~# mount -o remount,rw /dev/hda1 / 2.
Page 36
DA-710 Series Linux Managing Communications AllowOverride None </Directory> ScriptAlias /cgi-bin/ /media/usb0/www/cgi-bin/ <Directory "/media/usb0/www/cgi-bin/"> AllowOverride None Options ExecCGI -MultiViews +SymLinksIfOwnerMatch Order allow,deny Allow from all </Directory> </VirtualHost> <VirtualHost *:443> DocumentRoot /media/usb0/www <Directory /> Options FollowSymLinks AllowOverride None </Directory> ScriptAlias /cgi-bin/ /media/usb0/www/cgi-bin/ <Directory "/media/usb0/wwwz/cgi-bin/">...
DA-710 Series Linux Managing Communications IPTABLES IPTABLES is an administrative tool for setting up, maintaining, and inspecting the Linux kernel’s IP packet filter rule tables. Several different tables are defined, with each table containing built-in chains and user-defined chains. Each chain is a list of rules that apply to a certain type of packet. Each rule specifies what to do with a matching packet.
DA-710 Series Linux Managing Communications IPTABLES Hierarchy The following figure shows the IPTABLES hierarchy. IPTABLES Modules The DA-710-LX supports the following sub-modules. Be sure to use the module that matches your application. arptable_filter.ko arp_tables.ko arpt_mangle.ko ip_conntrack_amanda.ko ip_conntrack_ftp.ko ip_conntrack_h323.ko ip_conntrack_irc.ko ip_conntrack.ko ip_conntrack_netbios_ns.ko ip_conntrack_netlink.ko...
DA-710 Series Linux Managing Communications ipt_TOS.ko ipt_ttl.ko ipt_TTL.ko ipt_ULOG.ko The basic syntax to enable and load an IPTABLES module is as follows: # lsmod # modprobe ip_tables # modprobe iptable_filter #modprobe iptable_mangle #modprobe iptable_nat Use lsmod to check if the ip_tables module has already been loaded in the DA-710-LX. Use modprobe to insert and enable the module.
DA-710 Series Linux Managing Communications 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 DA-710-I-LX.
DA-710 Series Linux Managing Communications Example 5: Drop TCP packets addressed for port 21. # iptables –A INPUT –i eth0 –p tcp --dport 21 –j DROP Example 6: Accept TCP packets from 192.168.0.24 to DA-710-I-LX’s port 137, 138, 139 # iptables –A INPUT –i eth0 –p tcp –s 192.168.0.24 --dport 137:139 –j ACCEPT Example 7: Log TCP packets that visit DA-710-I-LX’s port 25.
DA-710 Series Linux Managing Communications #ehco 1 > /proc/sys/net/ipv4/ip_forward #modprobe ipt_MASQUERADE #iptables –t nat –A POSTROUTING –o eth0 –j MASQUERADE Enabling NAT at Bootup In most real world situations, you will want to use a simple shell script to enable NAT when the DA-710-LX boots up.
DA-710 Series Linux Managing Communications PPP (Point to Point Protocol) PPP (Point to Point Protocol) is used to run IP (Internet Protocol) and other network protocols over a serial link. PPP can be used for direct serial connections (using a null-modem cable) over a Telnet link, and links established using a modem over a telephone line.
DA-710 Series Linux Managing Communications 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...
DA-710 Series Linux Managing Communications Try typing: #netstat -nr This should show three routes similar to the following: Kernel routing table Destination Gateway Genmask Flags Metric Ref Use iface 129.67.1.165 0.0.0.0 255.255.255.255 UH ppp0 127.0.0.0 0.0.0.0 255.0.0.0 0 lo 0.0.0.0 129.67.1.165...
DA-710 Series Linux Managing Communications # Keep modem up even if connection fails persist crtscts modem 192.168.16.1:192.168.16.2 debug -detach Configure the chat script /etc/ppp/ppp-ttyM0.chat 'Auto Answer ON\n' ATS0=1 Start the pppd dial-in service. # pppd call dialin ATTENTION If you hope to have auto dial-in service, you can respawn the dial-in service in /etc/inittab.
Page 47
DA-710 Series Linux Managing Communications 4. Edit the file /etc/ppp/pap-secrets and add the following: “username@hinet.net” “password” # ATTENTION: The definitions here can allow users to login without a # password if you don't use the login option of pppd! The mgetty Debian # package already provides this option;...
Page 48
DA-710 Series Linux Managing Communications 6. If you use LAN1 to connect to the ADSL modem, add file /etc/ppp/options.eth0. If you use LAN2 to connect to the ADSL modem, then add /etc/ppp/options.eth1, etc. name username@hinet.net mtu 1492 mru 1492 defaultroute noipdefault "/etc/ppp/options.eth0"...
DA-710 Series Linux Managing Communications NFS (Network File System) Client 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 DA-710-LX without worrying about the amount of disk space that will be available.
DA-710 Series Linux Managing Communications Ethernet Bridging for Private Networks on Different Subnets 1. Set up four machines, as shown in the following diagram. Host A represents the machine that belongs to OpenVPN A, and Host B represents the machine that belongs to OpenVPN B.
Page 52
DA-710 Series Linux Managing Communications And then configure the bridge interface in /etc/openvpn/bridge. #!/bin/bash # Create global variables # Define Bridge Interface br="br0" # Define list of TAP interfaces to be bridged, # for example tap="tap0 tap1 tap2". tap="tap0" # Define physical ethernet interface to be bridged # with TAP interface(s) above.
Page 53
DA-710 Series Linux Managing Communications #gw="192.168.8.173" Start the bridge script file to configure the bridge interface. # /etc/openvpn/bridge restart ATTENTION Select cipher and authentication algorithms by specifying cipher and auth. To see which algorithms are available, type: # openvpn --show-ciphers # openvpn --show-auths 8.
DA-710 Series Linux Managing Communications Ethernet Bridging for Private Networks on the Same Subnet 1. Set up four machines, as shown in the following diagram. 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/tap0-br.conf of OpenVPN A and...
Page 55
DA-710 Series Linux Managing Communications 2. On machine OpenVPN A, modify the remote address in configuration file /etc/openvpn/tun.conf. # 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 40 ifconfig 192.168.2.173 192.168.4.174 up /etc/openvpn/tun.sh...
DA-710 Series Linux Programmer Guide Device API The DA-710 supports control devices with the ioctl system API. The interface is shown as below. int ioctl(int d, int request,…); Input: <d> open device node return file handle <request> argument in or out Refer to desktop Linux’s man page for detailed documentation:...
Page 58
DA-710 Series Linux Programmer Guide Example to set the baudrate #include “moxadevice.h” #include <termios.h> struct termios term; int fd, speed; fd = open(“/dev/ttyM0”, O_RDWR); tcgetattr(fd, &term); term.c_cflag &= ~(CBAUD | CBAUDEX); term.c_cflag |= B4000000; tcsetattr(fd, TCSANOW, &term); speed = 500000;...
DA-710 Series Linux Programmer Guide IMPORTANT! If the target baudrate is not a special baudrate (e.g. 50, 75, 110, 134, 150, 200, 300, 600, 1200, 1800, 2400, 4800, 9600, 19200, 38400, 57600, 115200, 230400, 460800, 921600), the termios cflag will be set to the same flag.
Page 60
DA-710 Series Linux Programmer Guide int set_din_event(int diport, void (*func)(int diport), int mode, long int duration) Function Description Set the DIN event when the state is changed from high to low or from low to high. Input <diport> The port that will be used to detect the DIN event.
Page 61
DA-710 Series Linux Programmer Guide Example: DIO Program Source Code File Name: tdio.c Description: This program connects DO1 to DI1, changes the digital output state to high or low by manual input, then detects and counts the state changed events from DI1.
Page 62
DA-710 Series Linux Programmer Guide 8. show event and duration Choose : "); retval =0; scanf("%d", &i); if ( i == 1 ) { // set high to low event printf("Please keyin the DIN number : "); scanf("%d", &i); printf("Please input the DIN duration, this minimun value must be over %d : ",MIN_DURATION);...
Page 63
DA-710 Series Linux Programmer Guide retval=set_dout_state(i, 1); } else if ( i == 6 ) { // set low data printf("Please keyin the DOUT number : "); scanf("%d", &i); retval=set_dout_state(i, 0); } else if ( i == 7 ) { // quit break;...
Page 64
DA-710 Series Linux Programmer Guide printf("DIO error control\n"); break; case DIO_ERROR_DURATION: printf("DIO error duratoin\n"); case DIO_ERROR_DURATION_20MS: printf("DIO error! The duratoin is not a multiple of 20 ms\n"); break; return 0; DIO Program Make File Example include ../compile.mk CC=$(PREFIX)gcc STRIP=$(PREFIX)strip AR=$(PREFIX)ar...
DA-710 Series Linux Programmer Guide Programmable LEDs The DA-685 provides 8 user-programmable LED indicators on its front panel. The following section explains how to configure these LEDs. 1. The kernel module that controls the programmable LEDs is named moxa_pled.ko. Use the lsmod command to verify the module is loaded;...
System Recovery The DA-710-LX is installed with the Embedded Linux operating system, which is located in the Flash DOM (CompactFlash card) shipped with the DA-710-LX computer. Although it rarely happens, you may find on occasion that operating system files and/or the disk file system are damaged. This chapter describes how to recover the Linux operating system.
DA-710 Series Linux System Recovery Recovery Environment The recovery environment includes the DA-710-LX embedded computer and a bootable USB disk with the recovery programs and system image file. DA-710-LX Bootable USB DISK (recovery programs and USB Port system image file included)
Page 68
DA-710 Series Linux System Recovery Step 2: Create a Linux Bootable USB Disk. a. You can find the firmware directory in the Recovery CD shipped with the DA-710-LX computer. b. Configure Windows Explorer to show hidden files (including protected operating system files).
Page 69
DA-710 Series Linux System Recovery Step 3: Set up the BIOS to Boot from a USB Disk. a. Insert the USB disk. b. Power on and press DEL to enter the bios setup menu. c. Select Advanced Hard Disk Boot Priority and then press Enter.
Page 70
DA-710 Series Linux System Recovery Step 4: Recover the Linux system from a USB Disk. a. If the BIOS setup is correct, it will boot from the USB disk. Follow the steps below to set up recovery parameters. Welcome to PING (Partition Image Is Not Ghost)! This tool can be used to both backup a Ghost-like image of your hard disk and to restore your hard disk from such an image.
Page 71
DA-710 Series Linux System Recovery d. Choose restore image from Local disk partition. PING (Partition Image Is Not Ghost)! Where do you want to save/restore your image to/from? Network share Local disk partition <OK> <Cancel> e. Choose ### Choose THIS if you want a restoration ### Choose the partition to backup Note that you cannot restore a partition to itself.
Page 72
DA-710 Series Linux System Recovery g. Enter “\” to choose the root directory of the restoration image. Enter root directory containing your data (eg. \mydir\PartImage) <OK> <Cancel> h. Choose DA710_V1.0_Build_08031316 for the restoration image. Action and Available images for restoration …...
Page 73
DA-710 Series Linux System Recovery ATTENTION DO NOT turn off the power during system recovery, as the system may crash. Step 5: Set up the BIOS back to boot from DOM or CompactFlash Disk. a. Power on and press DEL to enter the bios setup menu.
Need help?
Do you have a question about the DA-710 series and is the answer not in the manual?
Questions and answers