Home

UC-7402 User`s Manual

image

Contents

1. Dimensions E E ES Doo M Ready C LAN1 E O LAN2 F O Console t E 1 EN Y 8 A Er o EL Ka q i AME Y e 197 mm 7 76 de Hardware Block Diagram The following block diagram shows the layout of UC 7402 s internal components Ethernet PCI to cardbus Bridge bh mamen ff Bus UC 7402 User s Manual Introduction LED Indicators UC 7402 has 4 LED indicators on the top panel Refer to the following table for information about each LED LED Name Color Meaning Ready Green __ Power is ON and system is ready after booting up Yellow 10 Mbps Ethernet connection Ee Green 100 Mbps Ethernet connection Yellow Console port is receiving RX data from the serial device Green __ Console port is transmitting TX data to the serial device Console Reset type Buttons UC 7402 has two reset type buttons The button labeled Reset has the same effect as unplugging the power and then plugging the power back in The button labeled Reset to default returns UC 7402 to the factory default parameter configuration Reset Button Pressing the Reset button initiates a hardware reboot The button plays the same role as a desktop PC s reset button In normal use you should NOT use the Reset Button You should only use this function if the software is not working properly To reset an embe
2. X 5 6 WDE Watch Dos TIMET eoin retro Pt aee tO RET ERR een 5 6 Make Fil Example sit ndn cadens Lupe RADO m eg AA Dan 5 10 dex pile 6 1 Windows UC Finder eae HE eri heated 6 2 Installing the Software rete Her ree Reese too E EE Eege 6 2 Broadcast Search ugeduet DERE Bee dere 6 4 Lanux cfinder dene ete itti db a ettet 6 5 System CommandS oie edited eiut etes e uie ce uis ictu dui enden A 1 busybox V0 60 4 Linux normal command utility collection eee A 1 Fleege ed de RR UR Rn A 1 Le EE A 1 Network e rtc prO A DER po rte R E E EN A 1 PLOGES Sasa ee EEE ten dem a e ae a tubes Be ea EE EE A 2 Appendix B Appendix C MOXA special utilities EENEG EN A 2 Windows Tool Chain Introduction e eee eee eren nnns B 1 UG aT e670 e EE B 2 Installation Procedure cssesseessccevesssnscsceccececvensnececcecvsvsssesecsececvessnsueseecesesssneuscessesesssneese B 3 Using the BASH Shell nieht ater teneo E CD E De DE REFUS B 9 Compilati ri teen RED am Roe OU t IDA I ani tes B 10 GDB debug tool Insight psi een Re apte ERE e PEE B 11 Service Informatlon ieeic coe ceca io rk esce na na anaona Ce Era Eun on Fan TR CER e a DUE REFERRE ERR C 1 MOXA Internet Services EES este bees nieto ete diee breve ber etes teorie e C 2 Problem Report Form 5 o ne ott tert e RE Gr Ee o ee beo tut iet C 3 Product Return
3. State DEEN SS SS SS Rene To log in type the Login name and password as requested The default values are both root Login root Password root 2 2 UC 7402 User s Manual Getting Started Telnet Console If you know at least one of the two IP addresses and netmasks then you can use Telnet to connect to UC 7402 s console utility The default IP address and Netmask for each of the two ports are given below Default IP Address Netmask LANI 192 168 3 127 255 255 255 0 LAN2 192 168 4 127 255 255 255 0 Use a cross over Ethernet cable to connect directly from your PC to UC 7402 You should first modify your PC s IP address and netmask so that your PC is on the same subnet as one of UC 7402 s two LAN ports For example if you connect to LAN 1 you can set your PC s IP address to 192 168 3 126 and netmask to 255 255 255 0 If you connect to LAN 2 you can set your PC s IP address to 192 168 4 126 and netmask to 255 255 255 0 To connect to a hub or switch connected to your local LAN use a straight through Ethernet cable The default IP addresses and netmasks are shown above To login type the Login name and password as requested The default values are both root Login root Password root co Telnet 192 168 10 96 Moxa Embedded Linux Professional Edition Linux armu5teb 2 4 18 mv138 ixdp425 Moxa login root Password HHH HHHH HEH THEE HHH Hit Hitt HHHH Hitt Ht HHHH HHH
4. ES PComm Terminal Emulator COM1 115200 N0ne 8 1 V T100 E x ni xi Profile Edit PortManager Window Help a Mill alale lz E COM1 115200 N0ne 8 1 V T100 EZ root Moxa ifconfig ixpO 192 168 1 1 root Moxa StateOPEN SS PS FS eerie Configuring the WLAN via the PCMCIA Interface IEEE802 11b The following IEEE802 11b wireless modules are supported NDC NWH1010 Senao NL 2511CD PLUS F200 Senao NL 2511CD PLUS EXT2 MERCURY ETSI Senao NI3 2511CD PLUS3 DARK DKW11 330HP DARK XI 330H Planex PCI GW NS11H Corega CG WLPCCL 11 To configure the WLAN for IEEE802 1 1b 1 Unplug the PCMCIA Wireless LAN card first 2 Configure the Wireless LAN card s default IP setting profile Default IP address is 192 168 5 127 netmask 255 255 255 0 Edit network opts with the following command to edit Wireless LAN s default setting vi etc pcmcia network opts UC 7402 User s Manual Getting Started Use DHCE via sbin dhcpcd sbin dhclient or sbin pump y n DHCE n If you need to explicitly specify a hostname for DHCEF requests DHCP HCSINAME address netmask network address broadcast addres IPADDR 32 168 5 127 NETMASK 255 255 255 0 arport opts wireless Gateway address for static routing wlan ng cont GATEWAY 10 0 1 1 etc pcrmcia netwark opts etc pcrcia network opts line 1 of 48 2 3 Configure the Wireless LAN card s default SSID setting profile Def
5. optionxx The option list for a machine describes the kind of access the machine will have Important options are ro Read only This is the default rw Readable and Writeable no root squash If no root squash is selected then the root on the client machine will have the same level of access to files on the system as the root on the server This can have serious security implications although it may be necessary if you want to do administrative work on the client machine that involves the exported directories You should only specify this option when you have a good reason root squash Any file request made by the user root on the client machine is treated as if it is made by user nobody on the server Exactly which UID the request is mapped to depends on the UID of user nobody on the server not the client sync Sync data to memory and flash disk async The async option instructs the server to lie to the client telling the client that all data has been written to the stable storage 4 17 UC 7402 User s Manual Managing Communication NOTE Example 1 tmp rw no root squash In this example UC 7402 shares the tmp directory to everyone gives everyone both read and write authority The root user on the client machine will have the same level of access to files on the system as the root on the server Example 2 home public 192 168 0 0 24 rw ro In this example UC 7402 shares the directory home pub
6. Q Overview LI Hardware Connection Description Package Checklist Wiring Requirements gt Product Features Connecting the Power Product Hardware Specifications Grounding UC 7402 LI Hardware Introduction Connecting to the Network gt Appearance and Dimensions PCMCIA Hardware Block Diagram CompactFlash LED Indicators L Software Introduction gt Reset type Buttons Software Architecture Real Time Clock gt Journaling Flash File System Placement Options JFFS2 gt Wall or Cabinet gt Software Package gt DIN Rail Mounting gt Connecting to the Console Port UC 7402 User s Manual Introduction Overview MOXA UC 7402 a web server embedded network computer features dual 10 100 Mbps Ethernet ports a PCMCIA interface for wireless LAN communication and CompactFlash for mass storage disk expansion UC 7402 uses an Intel XScale IXP 422 266 Mhz RISC CPU Unlike the X86 CPU which uses a CISC design the IXP 422 s RISC design architecture and modern semiconductor technology provide UC 7402 with a powerful computing engine and communication functions but without generating a lot of heat The built in 32 MB NOR Flash ROM and 128 MB SDRAM give you enough memory to put your application software directly on UC 7402 And since the dual LAN ports are built right into the IXP 422 CPU UC 7402 makes an ideal communication platform for Network Security applications If your application requires placin
7. swtd_close swtdfd exit 1 The makefile is shown below all mxscaleb gcc o xxxx xxxx c lmoxalib Make File Example The following Makefile file example codes are copied from the Hello example on UC 7402 s CD ROM CC usr local mxscaleb mxscaleb gcc CPP usr local mxscaleb mxscaleb gcc SOURCES hello c OBJS SOURCES c 0 all hello hello OBJS CC o LDFLAGS LIBS clean rm f OBJS hello core gdb 5 10 D UC Finder The UC Finder utility is used to search the LAN or intranet for Moxa Universal Communicators UC Finder comes in handy if you forget the IP address for troubleshooting field problems and for testing UC Finder works by sending a broadcast message over the LAN to search for UC 7402 MAC addresses It will then query the UC 7402 s for their IP addresses Two versions of UC Finder are provided The GUI version works in Windows environments and the command line utility works in Linux environments The following topics are covered in this chapter Windows UC Finder Installing the Software Broadcast Search LI Linux ucfinder UC 7402 User s Manual UC Finder Windows UC Finder The UC Finder utility is used to search the LAN or intranet for Moxa Universal Communicators Installing the Software 1 Once the Setup program starts running click on Next to proceed 1B Setup UC Finder Welcome to the UC Finder Setup Lyn Wizard This will
8. SNMP 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 icompany com S IP address receiver icompany 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 7 character You will need to add your hostname to the file etc hosts UC 7402 has built in SNMP V1 Simple Network Management Protocol agent software It supports RFC1317 RS 232 like group and RFC 1213 MIB II The following simple example allows you to use an SNMP browser on the host site to query the UC 7402 which is the SNMP agent UC 7402 will respond SNMP QUERY STARTED 1 sysDescr 0 octet string Linux Moxa 2 4 18 mvI30 ixdp425 1049 Tue Oct 26 09 34 15 CST 2004 armv5teb 2 sysObjectID 0 object identifier enterprises 2021 250 10 3 sysUpTime 0 timeticks 0 days 00h 41m 54s 47th 251447 4 sysContact 0 octet string Root lt root localhost gt configure etc snmp snmp local conf 5 sysName 0 octet string Moxa 6 sysLocation 0 octet string Unknown configure etc snmp snmp local conf 7 system 8 0 timeticks 0 days 00h 00m 00s 22th 22 8 system 9 1 2 1 object identifier mib 2 31 9 sys
9. File Edit View Go Bookmarks Tools Help d 8 O EI D nenez166 2127 v amp EL Getting Started 53 Latest Headlines x Test Page This page is used to test the proper operation of the Apache Web server after it has been installed If you can read this page it means that the Apache Web server installed at this site is working properly H If you are the administrator of this website You may now add content to this directory and replace this page Note that until you do so people visiting your website will see this page and not your content If you are a member of the general public The fact that you are seeing this page indicates that the website you just visited is either experiencing problems or is undergoing routine maintenance If you would like to let the administrator of this website know that you ve seen this page instead of the page you expected you should send them e mail In general mail sent to the name webmaster and directed to the website s domain should reach the appropriate person For example if you experienced problems while visiting www gnomovision com you should send e mail to webmaster gnomovision com H The Apache document has been included with this distribution For documentation and information on MontaVista Linux please visit the Monta Vista Software Inc website You are free to use the image below on an Apache powered Web server Thanks for using Apache m Powered by
10. usr sbin snmptrapd s Sbin cardmgr IUSSI ub CES usr sbin rpc mountd usr sbin sshd bin reportip bin massupfirm sbin getty 115200 ttyso sbin getty 115200 tersi bin massupfirm bin massupfirm usr sbin sshd bash ps ef root 105 Powe JONG rooe III FOJE 140 root 144 root 146 root SS TOE Tal zeen 162 root IGS eeng 164 root 166 root 168 root II eeng JL BODE 174 root root Moxa 3 7 UC 7402 User s Manual Managing Embedded Linux Setting the Run Level In this section we outline the steps you should take to set the Linux run level and execute requests Use the following command to enable or disable settings 192 160 3127 PuTTY root8Moxa ect rc d rc3 d4 1s S19nfs common S825nfe user server S99showreadyled 520snmpd S55ssh s24ocmcia S99rmnologin root Moxa etc rc d rc3 d ed etc rc d init d Edit a shell script to execute root tcps2 release and save to tcps2 as an example cd etc rc d rc3 d 1n s etc rc d init d tcps2 S60tcps2 SxxRUNFILE stands for S start the run file while linux boots up xx a number between 00 99 The smaller number has a higher priority RUNFILE the file name 192 168 3 127 PuTTY root Moxa ect rc d rc3 d Is S19nfs common S25nfs user server S99showreadyled S20snmpd S55ssh S24pcmcia S99rmnologin root8Moxa ect rc d rc3 d4 ln s root tcps2 release S60tcps2 root8Moxa ect rc d rc3 d4 1s S19nfs common S25nfs user server S99rmnologin
11. ifcfg vpn while read f1 f2 3 4 r3 do if f1 iface a 2 iface a 3 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 fl in address IPADDR f2 P netmask NETMASK f2 EE broadcast BROADCAST f2 D I esac done break fi done lt etc network interfaces get the ip address of the specified interface mname module up oIFS SIFS IFSz FOUND no for LINE in lsmod do TOK echo SLINE cut d f1 if TOK mname then FOUND yes break fi done 4 21 UC 7402 User s Manual Managing Communication IFS SoIFS if FOUND no then modprobe mname fi start ifcfg_vpn if d dev net Mi then mkdir dev net fi if r dev net tun then create a device file if there is none 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 brO0 brctl addif br0 iface the bridge receives data from any port and forwards it to other ports i expr 0 while do generate a tap0 interface on tun openvpn mktun dev tap i connect tap device to the bridge brctl addif br0 tap i null ip address of tap device ifconfig tap i 0 0 0 0 promisc up i
12. mkpasswd 53 Jan 10 22 03 moxa bat 932 620 enon AMO PATIOS moxa u eo 0 Jan 10 19 48 tmp D Jan 10 19 48 usr O aein LO dL S Nar Compilation Windows tool chain is a cross compiler that can be used to compile Linux source code on a Windows operating system allowing programmers to develop projects on a Windows based PC In this section we describe the procedures you should follow to compile a project with the Windows tool chain First copy the source codes of your project in the Windows tool chain s installation directory In the example shown here we want to compile the hello example provided in our CD ROM We will copy the source code to UC which is the root directory of the Windows tool chain Check the root directory where you can find the hello directory Mkpasswd 1 d gt etc passwd Mkgroup d gt etc group Note that the d switch is necessary for domain users S que A S Je exul totar 9 drwxrwx drwxrwx LL SET 54110 Josie 10 ata hello E EE GAL bs 12 moxa bat 8112 Eet ALCS WI 2 06 usr 06 var 4294967295 4294967295 4294967295 L sftst mew dia betefe Nov Nov Nov Macr 0 Nov 4 ie Va Wale Nasr 0 Nov 53 Nov 3262 Nov 0 Nov 4 0 Nov 4 0 Nov 4 Jared_Wu Jared_Wu Jared_Wu en el Was Jared_Wu Taro d W mkpasswd meonew mow aa keke 4 4294967295 4294967295 4294967295 4294967295 4294967295 4294967295 Jared_Wu Jared_Wu Ja
13. root Moxa upramdisk root Moxa df h Filesystem Size Used Available Us dev mtdblock3 26 0M 8 9M DALH 4 dev mtdblock3 26 0M 8 9M 17 1M 4 dev ram2 2 0M 40 0k TESI 23 var tmpfs 62 IM 0 62 1M 0 dev shm dev raml 29 0M 13 0k 27 5M 0 mnt ramdisk root Moxa cd mnt ramdisk root Moxa mnt ramdisk Mounted on 3 3 The following instructions give the steps required to save the firmware file to UC 7402 s RAM disk and then upgrade the firmware 1 Type the following commands to enable the RAM disk upramdisk dcd mnt ramdisk 2 Type the following commands to use UC 7402 s built in FTP client to transfer the firmware file UC7402 x x x frm from the PC to UC 7402 mnt ramdisk ftp destination PC s IP Login Name xxxx Login Password xxxx ftp bin ftp get UC7402 x x x frm root Moxa mnt ramdisk ftp 192 168 3 193 Connected to 192 165 3 193 1192 165 23 193 1 220 TYPSOf t FIP Server 1 10 ready Name 92 alse Sho ils mootb root 331 Password required for root Password 230 User root logged in Remote system type is UNIX Using binary mode to transfer files ftp gt cd newsw 250 CWD command successful C ftproot newsw is current directory fto hn 200 Type set to I pe Jig 200 Port command successful 150 Opening data connection for directory list drw rw rw JL segs SEC 0 Te Sie to drw rw rw JL Nego eS D Now 30 10 03 rw rw rw JL aerer RGS 1316777
14. w root Moxa date hwclock Thu Dec 9 10 01 07 CST 2004 Thu Dec 9 10 01 08 2004 0 933547 seconds root Moxa NTP Client UC 7402 has a built in NTP Network Time Protocol client that is used to initialize a time request to aremote NTP server Use ntpdate lt this client utility gt to update the system time ntpdate time stdtime gov tw hwclock w Visit http www ntp org for more information about NTP and NTP server addresses 10 120 53 100 PuTTY root Moxa date hwclock Sat Jan 1 00 00 26 CST 2000 Sat Jan PL 00200227 2000 50 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 9 84256 sec root Moxa hwclock w root Moxa date hwclock gy Dee Sr IOS EL Our 2219 97 Thu Dec 9 10 59 12 2004 0 844076 seconds root Moxa 3 9 UC 7402 User s Manual Managing Embedded Linux NOTE Before using the NTP client utility check your IP and DNS settings 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 subsection we show how to use a shell script to update the time automatically Example shell script to update the system time periodically bin sh ntpdate time nist gov You can use the time server s ip address or domain name direc
15. 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 5 3 UC 7402 User s Manual Programmer s Guide Uninstalling the Linux Tool Chain Use the command rpm qalgrep mxscaleb to query if the MOXA tool chain is installed on the system gnome hhl arm hhl arm_ hhl arm 8 1 root rpm qa m command nat found 3 9 mv13 0 0 2 automa hhl arm hhl arm root f rpm qa m command not foi root f rpm e m root 5 4 UC 7402 User s Manual Programmer s Guide Debugging with GDB First compile the program must with option ggdb Use the following steps 1 To debug a program called hello debug on the target use the command gdbserver 192 168 4 142 2000 hello debug This is where 2000 is the network port number on which the server waits for a connection from the client This can be any available port number on the target Following this are the name of the program to be debugged hello debug plus that program s arguments Output similar to the following will be sent to the console Process hello debug created pid 38 2 Usethe following command on the host to change to the directory that contains hello debug cd my work directory myfilesystem testprograms 3 Enter the following command ddd debugg
16. Ethernet port Since PPP is a peer to peer system UC 7402 can also use PPP to link two networks or a local network to the Internet to create a Wide Area Network WAN NOTE 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 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 replace username with the correct name and password replace password with the correct password Note that debug and defaultroute 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 replace password with the correct password pppd connect chat v ATDT5551212 CONNECT user username password password dev ttyMO 115200 crtscts modem 4 11 UC 7402 User s Manual Managing Communication The pppd options are described below connect chat etc This option gives the command to contact the PPP server The
17. If you want to disconnect it use the kill command to kill the pppd process 4 16 UC 7402 User s Manual Managing Communication NFS Network File System NOTE 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 UC 7402 without worrying about the amount of disk space that will be available UC 7402 supports NFS protocol for both client and server 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 UC 7402 as an NFS Server By default UC 7402 enables the service etc init d nfs user server The service link file S25nfs user server is located in the directory rc d rc2 d rc5 d Edit the NFS server configuration file etc exports to set up the remote host NTF client list and access rights for a specific directory The file formats are shown below vi etc exports File Format directory machinel option11 option12 machine2 option21 option22 directory The directory that will be shared with the NFS Client machinel and machine2 Client machines that will have access to the directory A machine can be listed by its DNS address or IP address e g machine company com or 192 168 0 8
18. Opening BINARY mode data connection for hello release 226 Transfer complete ftp 2744 bytes sent in 0 00Seconds 2744000 00Kbytes sec ftp bye 221 You have transferred 2744 bytes in 1 files 221 Total traffic for this session was 3131 bytes in 1 transfers 221 Thank you for using the FTP service on Moxa 221 Goodbye root Moxa chmod 777 hello release root Moxa hello release Hello GDB debug tool lInsight Insight is a graphical user interface that accompanies GDB the GNU Debugger written in Tcl Tk by people working at Red Hat Inc and Cygnus Solutions Red Hat was generous enough to make Insight available for public use and continues to maintain the program Click on for more information about using Insight or click on Help Topics under the Help menu to read the user manual UC 7402 User s Manual Windows Tool Chain Introduction 7 File Run View Control Preferences Help Ze we Soe eral Rel ai source Help Topics About GDB 3 Ep IES Source Window TH ke Insight Index Microsoft Internet Explorer File Edit View Favorites Tools Help Kp Back EI ix erg 95 di Jj search E s El A Address amp ciuciusrlocamescalebishareinsighti DWelplndehtm C UC usr localimxscaleb share insight1 O help index html e Breakpoint Window e Console Window e Function Browser e Locals Window e Memory Window e Register Window e Sessions e Source Wind
19. S20snmpd S55ssh S99showreadyled S24pcmcia S50tops2 root8Moxa etc rc d rc3 dd KxxRUNFILE stands for K start the run file while linux shuts down or halts xx a number between 00 99 The smaller number has a higher priority RUNFILE is the file name For removing the daemon you can remove the run file from etc rc d rc3 d by using the following command drm f etc rc d rc3 d S60tcps2 Adjusting the System Time Setting the Time Manually UC 7402 has two time settings One is the system time and the other is the RTC Real Time Clock time kept by the UC 7402 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 3 8 UC 7402 User s Manual Managing Embedded Linux 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 the RTC time hwclock w Write current system time to RTC The following figure illustrates how to update thesystem time and set the RTC time 192 168 3 127 PuTTY root Moxa date ea gi 23 2319 X08 sil CST 2000 root Moxa hwclock Fri dun 23 SSGS0R Ss A000 SOs IS TIAS seconds root Moxa date 120910002004 thu Dec S 1070000 eS 20104 root Moxa hwclock
20. and fsversion that allow you to check the version numbers of the kernel and file system respectively System Image Backup Upgrading the Firmware A UC 7402 s bios kernel mini file system and user file system are combined into one firmware file which can be downloaded from Moxa s website www moxa com The name of the file has the form UC7402 x x x frm with x x x indicating the firmware version To upgrade the firmware download the firmware file to a PC and then transfer the file to the UC 7402 unit via a serial Console or Telnet Console connection ATTENTION Upgrading the firmware will erase all data on the Flash ROM If you are using the ramdisk to store code for your applications beware that updating the firmware will erase all of the data on the Flash ROM You should back up your application files and data before updating the firmware 3 2 UC 7402 User s Manual Managing Embedded Linux Since different Flash disks have different sizes it s a good idea to check the size of your Flash disk before upgrading the firmware or before using the disk to store your application and data files Use the d h command to list the size of each memory block and how much free space is available in each block root Moxa df h Filesystem Size Used Available Use Mounted on dev mtdblock3 26 0M 8 9M 17 1M 34 dev mtdblock3 26 0M 8 9M AME dev ram2 2m 0M 40 0k TESI 23 tmpfs 62 1M 0 62 1M 0 dev shm
21. 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 wor 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 How to use PPPoE on UC 7402 1 Update two files usr sbin pppd and usr lib pppd 2 4 1 pppoe so on the target UC 7402 for version V1 5 or earlier versions Copy the files from the web or CD ROM and directly update it by the copy command or FTP 2 Connect UC 7402 s LAN port to an ADSL modem with a cross over cable HUB or switch 3 Login to the UC 7402 as the root user 4 Edit the file etc ppp chap secrets and add the following username hinet net password Secrets for authentication using CHAP ieber s ie ret TD addmesses username hinet nei password chap secrets line 1 of 3 33 usernameQG hinet net is the username obtained from the ISP to log in to the ISP account password is the corresponding password for the account 4 14 UC 7402 User s Manual Managing Communication 5 Edit the file etc ppp pap secrets and add
22. 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 vV verbose mode log what we do to syslog wow Double quotes don t wait for a prompt but instead do note that you must include a space after the second quotation mark ATDT5551212 Dial the modem and then CONNECT Wait for an answer wow Send a return null text followed by the usual return ogin username word password Log in with 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 baud rate 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 defaultroute Once the PPP link is established make it the default route if you have a PPP link to the Internet this is probably 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
23. 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 4 enable IP forwarding echo 1 ipf echo ip forwarding enabled to cat ipf stop echo shutdown openvpn bridge ifcfg vpn i expr 0 while do disconnect tap device from the bridge brctl delif br0 tap i 4 22 UC 7402 User s Manual Managing Communication openvpn rmtun dev tap i i expr i 1 if i ge maxtap then break fi done brctl delif br0 iface brctl delbr brO0 ifconfig brO down ifconfig iface SIPADDR netmask NETMASK broadcast BROADCAST killall TERM openvpn case 1 in start start stop stop 7 restart stop start A echo Usage 0 start stop restart exit 1 esac exit 0 Create link symbols to enable this script at boot time 4 ln s etc openvpn openvpn bridge etc rc d rc3 d S32vpn br for example 4 ln s etc openvpn openvpn bridge etc rc d rc6 d K32vpn br for example 4 Create a configuration file named A tap0 br conf and an executable script file named A tap0 br sh on OpenVPN A point to the peer remote 192 168 8 174 dev tap0 secret etc openvpn secrouter key cipher DES EDE3 CBC auth MD5 tun mtu 1500 tun mtu extra 64 ping 40 up etc openvpn A tap0 br sh bin sh v
24. install UC Finder on your computer It is recommended that you close all other applications before continuing Click Next to continue or Cancel to exit Setup 2 Click on Next when the Select Additional Tools window opens to proceed with the installation Lal Setup UC Finder Select Additional Tasks Which additional tasks should be performed Select the additional tasks you would like Setup to perform while installing UC Finder then click Next Additional icons 6 2 UC 7402 User s Manual UC Finder 3 Click on Next to install program files in the default directory or select an alternative location iG Setup UC Finder Ready to Install Setup is now ready to begin installing UC Finder on your computer Click Install to continue with the installation or click Back if you want to review or change any settings Additional tasks Create a desktop icon Completing the UC Finder Setup Wizard Setup has finished installing UC Finder on your computer The application may be launched by selecting the installed icons Click Finish to exit Setup 6 3 UC 7402 User s Manual Broadcast Search The Broadcast Search function is used to locate all UC 7402 units that are connected to the same LAN as your Windows computer Since the Broadcast Search function searches by MAC address and not IP address all UC 7402s connected to the LAN will be found regardless of whether o
25. 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 www linux mtd infradead org Software Package Boot Loader Redboot V1 92 Kernel MontaVista embedded Linux 2 4 18 Protocol Stack ARP PPP CHAP PAP IPv4 ICMP TCP UDP DHCP FTP SNMP V1 V3 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 tinylogin login and user manager utility telnet telnet client program ftp FTP client program smtpclient email utility scp Secure file transfer Client Program Daemons pppd dial in out over serial port daemon snmpd snmpd agent daemon telnetd telnet server daemon inetd TCP server manager program ftpd ftp server daemon apache web server daemon sshd secure shell server nfs user server network file system server openvpn virtual private network openssl open SSL Linux Tool Chain Gcc V3 3 2 C C PC Cross Compiler GDB V5 2 1 Source Level Debug Server Glibc V2 2 5 POSIX standard C library Windows Tool Chain Gcc V3 3 2 C C PC Cross Compiler Glibc V2 2 5 POSIX
26. run tool chain windows compiler setup exe to start installation Once the Setup program starts 1 2 running click on Next to proceed m Moxa UC Tool Chain Setup Welcome ni x Moxa Universal Communicator Tool Chain 1 0 Thank you for selecting Moxa Universal Communicator Tool Chain 1 0 p E Moxa Universal Communicator Tool Chain Copyright 2004 Moxa Technologies Co Ltd http www moxa com Select the Root Directory Note lt Back Cancel If the directory C UC was created during a previous installation it will be displayed as the Root Directory Use this directory if you do not wish to re install the UC windows tool chain again Under Install For All Users Recommended is selected by default Under Default Text File Type Unix Recommended is selected by default P Moxa UC Tool Chain Setup Choose Installation Directory mi xi Select Root Install Directory P Select the directory where you want to install Also choose a few installation OM parameters m Root Directory Cup Browse Install For Ze All Users Recommend C Just Me Default Text File Type C pos Ze Lnix Recommend B 3 lt Back Cancel UC 7402 User s Manual Windows Tool Chain Introduction 3 By default the Local Package Directory is the same as on the CD ROM tool chain windows compiler Click on Next to proceed Note It may take anywhere from 5 to
27. 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 is required use the following command note that noipdefault is optional and root is both the username and password pppd connect chat v user root password root noipdefault dev ttyMO 19200 crtscts 4 12 UC 7402 User s Manual Managing Communication How to check the connection Once you ve set up a PPP connection there are some steps you can take to test the connection First type sbin ifconfig The folder ifconfig may be located elsewhere depending on your distribution You should be able to see all the network interfaces that are UP pppO should be one of them 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 one machine lo Link encap Local Loopback inet addr 127 0 0 1 Beast 127 255 255 255 Mask 255 0 0 0 UP LOOPBACK RUNNING MTU 2000 Metric 1 RX packets 0 errors 0 dropped 0 overrun 0 ppp 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 pac
28. standard C library Insight V6 0 Windows environment source level debug utility Device Drivers PCMCIA amp Card Bus Wireless LAN Card Bus CF Mass storage CompactFlash Watchdog Timer WDT API RTC 2 Getting Started In this chapter we explain how to connect UC 7402 turn on the power and then get started using the programming and other functions The following topics are covered in this chapter LI LI Powering on UC 7402 Connecting UC 7402 to a PC gt Serial Console gt Telnet Console SSH Console Configuring the Ethernet Interface gt Modifying Network Settings with the Serial Console gt Modifying Network Settings over the Netowork Configuring the WLAN via the PCMCIA Interface gt JEEE802 11b gt JEEE802 11 Test Program Developing Hello c gt Installing the Tool Chain Linux Checking the Flash Memory Space gt Compiling Hello c gt Uploading Hello to UC 7402 and Running the Program UC 7402 User s Manual Getting Started Powering on UC 7402 NOTE Connect the SG wire to the Shielded Contact located in the upper left corner of the UC 7402 and then power on UC 7402 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 the Ready LED will light up and the Network address settings will appear on the LCM display After connecting UC 7402 to the power supply it will take about 30 to 60 seconds for t
29. 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 it 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 The following figure shows the IPTABLES hierarchy 4 6 UC 7402 User s Manual Managing Communication NOTE 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 F
30. target INPUT For packets coming into the UC 7402 4 8 UC 7402 User s Manual Managing Communication OUTPUT For locally generated packets FORWARD For packets routed out through the UC 7402 PREROUTING To alter packets as soon as they come in 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 0 Name of an interface via which a packet is going to be sent p The protocol of 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
31. that will be present on the UC 7402 This is particularly true when the RISC Xscale processor architecture of the UC 7402 differs from the CISC x86 processor architecture of the host system but it is also true if the processor architecture is the same The host tool chain that comes with UC 7402 contains a suite of cross compilers and other tools as well as the libraries and headers that are necessary to compile applications for UC 7402 The host environment must be running Linux to install the UC 7402 GNU Tool Chain We have confirmed that the following Linux distributions can be used to install the tool chain Redhat 7 3 8 0 9 0 Fefora core 1 amp 2 The Tool Chain will need about 100 MB of hard disk space on your PC The UC 7402 Tool Chain is located on the UC 7402 CD To install the Tool Chain insert the CD into your PC and then issue the following commands mount dev cdrom mnt cdrom rpm ivh mnt cdrom tool chain Linux mxscaleb x x x x 1386 rpm Wait for a few minutes while the Tool Chain is installed automatically on your Linux PC Once the host environment has been installed add the directory usr local mxscaleb bin to your path and the directory usr local mxscaleb man to your manual path You can do this temporarily for the current login session by issuing the following commands export PATH usr local mxscaleb bin PATH export MANPATH usr local mxscaleb man PATH Alternatively you can add the same commands to H
32. the file handle to do other Input None Output The return value is file handle If has some error it will return lt O value You can get error from errno 5 6 UC 7402 User s Manual Programmer s Guide int int int swtd_enable int fd unsigned long time Description Enable application sWatchDog And you must do ack after this process Input int fd the file handle from the swtd_open return value unsigned long time The time you wish to ack sWatchDog periodically You must ack the sWatchDog before timeout If you do not ack the system will be reboot automatically The minimal time is 50 msec the maximum time is 60 seconds The time unit is msec Output OK will be zero The other has some error to get the error code from errno swtd_disable int fd Description Disable the application to ack sWatchDog And the kernel will be auto ack it User does not to do it at periodic Input int fd the file handle from swtd_open return value Output OK will be zero The other has some error to get error code from errno swtd get int fd int mode unsigned long time Description Get current setting values mode 1 for user application enable sWatchDog need to do ack 0 for user application disable sWatchdog does not need to do ack time The time period to ack sWatchDog Input int fd the file handle from swtd open return value int mode the function will be return
33. the status enable or disable user application need to do ack unsigned long time the function will return the current time period Output OK will be zero The other has some error to get error code from errno 5 7 UC 7402 User s Manual Programmer s Guide 4 int swtd ack int fd Description Acknowledge sWatchDog When the user application enable sWatchDog It need to call this function periodically with user predefined time in the application program Input int fd the file handle from swtd open return value Output OK will be zero The other has some error to get error code from errno int swtd close int fd Description Close the file handle Input int fd the file handle from swtd open return value Output OK will be zero The other has some error to get error code from errno Special Note When you kill the application with 9 or kill without option or Ctrl c the kernel will change to auto ack the sWatchDog When your application enables the sWatchDog and does not ack your application may have a logical error or your application has made a core dump The kernel will not change to auto ack This can cause a serious problem causing your system to reboot again and again User application example Example 1 include lt stdio h gt include lt stdlib h gt include lt string h gt include lt moxadevice h gt int main int argc char argv i
34. 2 Nov 29 10 24 UG7402 1 5 frm TEW EW TW JL zer RES 8778996 Nov 29 10 24 UC7402 usrdisk 1 5 frm 226 Transfer complete ftp get UC7402 1 5 frm 3 3 UC 7402 User s Manual Managing Embedded Linux local UC7402 1 5 frm remote UC7402 1 5 frm 200 Port command successful 150 Opening data connection for UC7402 1 5 frm 226 Transfer complete 13167772 bytes received in 2 17 secs 5925 8 kB s EED 3 Next use the upfirm command to upgrade the kernel and root file system upfirm UC7402 x x x frm root Moxa mnt ramdisk upfirm UC7402 1 5 Upgrade firmware utility version 1 0 To check source firmware file context The source firmware file conext is OK This step will destroy all your firmware Do you want to continue zt Y N X Now upgrade the file redboot Format MTD device dev mtd0 MTD device dev mtd0 erase 128 Kibyte 60000 100 complete Wait to write file Compleleted 100 Now upgrade the file kernel Format MTD device dev mtdl MTD device dev mtdl1 erase 128 Kibyte 100000 100 complete Wait to write file Compleleted 100 Now upgrade the file mini file system Format MTD device dev mtd2 MTD device dev mtd2 erase 128 Kibyte 400000 100 complete Wait to write file Compleleted 100 Now upgrade the file user file system Format MTD device dev mtd3 MTD device dev mtd3 erase 128 Kibyte 1a00000 100 complete Wait to write file Compleleted 100 Now
35. 20 minutes to check the packages in the CD ROM after you click on Next P Moxa UC Tool Chain Setup Select Local Package Directory ni sl l Select Local Package Directory f Select the directory where the package files of Tool Chain exist r Local Package Directory E tool chain Windows compile Browse Pe 4 All required package are selected by default Click on Next to continue wl Moxa UC Tool Chain Setup Select Packages ni x Select Packages Select packages to install Wien Category Category Cun New Bi Sr Package All amp x Default Admin 4 Default Base amp Default Devel amp Default Doc 4 Default Editors 4 Default Graphics amp x Default Interpreters amp Default Libs amp x Default Math amp x Default fl lt Back Cancel e Category column Shows a hierarchical display of packages with category name highest and package name lowest Click the plus sign next to category name to open the category and see the packages within that category B 4 UC 7402 User s Manual Windows Tool Chain Introduction e Base Category List all packages that will be installed by default along with any dependencies If you view the Base column for the Base category you should see every package selected for installation e Packages In the packages listing field package names are arranged by Category Full Partial acco
36. 255 255 255 0 U 0 0 0 ixpO Interface ixp1 is connected to the bridging interface br0 to which device tap0 also connects whereas the virtual device tun sits on top of tap0 This ensures that all traffic from internal networks connected to interface ixp1 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 7 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 eth0 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 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 8 To shut down OpenVPN programs type the command killall TERM openvpn 4 24 UC 7402 User s Manual Managing Communication Setup 2 Ethernet Bridging for Private Networks on the Same Subnet 1 Set up four machines as shown in the following diagram local net eth1 192 168 2 173 eth0 192 168 2 171 eth0 192 168 8 173
37. 7402 supports Linux standard buzzer control with UC 7402 s buzzer running at a fixed frequency of 100 Hz You must include lt sys kd h gt 1 Function KDMKTONE ioctl fd KDMKTONE unsigned int arg Description The buzzer s behavior is determined by the argument arg The high word part of arg gives the length of time the buzzer will sound and the low word part gives the frequency The buzzer s on off behavior is controlled by software If you call the ioctl function you MUST set the frequency at 100 Hz If you use a different frequency the system could crash WDT Watch Dog Timer 1 Introduction The WDT works like a watch dog function You can enable it or disable it When the user enables WDT but the application does not acknowledge it the system will reboot You can set the ack time from a minimum of 50 msec to a maximum of 60 seconds How the WDT works The sWatchDog is enabled when the system boots up The kernel will auto ack it The user application can also enable ack When the user does not ack it will let the system reboot Kernel boot User application running and enable user ack The user API The user application must include lt moxadevic h gt and link moxalib a A makefile example is shown below all mxscaleb gcc o xxxx xxxx c lmoxalib int swtd open void Description Open the file handle to control the sWatchDog If you want to do something you must first to this And keep
38. Format MTD device dev mtd3 Wait to write file 3 5 UC 7402 User s Manual Compleleted 100 Now update the configuration file Upgrade the firmware is OK Managing Embedded Linux Please press any key to reboot system Enabling and Disabling Daemons The following daemons are enabled when UC 7402 boots up for the first time snmpd SNMP Agent daemon kee Telnet Server Client daemon Internet Daemons orian FTP Server Client daemon Secure Shell Server daemon T Apache WWW Server daemon m Network File System Server daemon Type the command ps ef to list all processes currently running root Moxa cd etc root Moxa etc ps ef Uid VmSize Stat Command root T296 E root keventd root letstonmeatiate rel C2 100 root kswapd root bdflush root kupdated Toot mtdblockd root khubd root 3ogierst2 vsketol vme tS root ixpad25 esr root root root root root nobody nobody nobody ixp425 ixp0 stdef ixp425 ixpl usr sbin inetd usr sbin httpd usr sbin httpd usc soie heed lusr sbim heed usr sbin httpd Sbin portmap usr sbin rpc statd usr sbin snmpd s 1 dev null usr sbin snmptrapd s sbin cardmgr EE sbun ftspci misc usr sbin rpc mountd usr sbin sshd bin reportip bin massupfirm sbin getty 115200 ttys01 sbin getty 115200 tevsi bin massupfirm bin massupfirm usr sbin sshd bash ps ef nobody b
39. H HHH Hit HE Hit HHH HHH HR HHH Did HHH Ht DH HHH HHHH Hitt H Du dH HHH HHH HH HH Du HH oid HHH HHH Ht Bun H Du HH Hit HH HH HH Ht HHHH H Hitt DH tt H HH HH HH HHH HHH DH tt H H HHH HHH HHH tt Ht Li HHH Hit Hun Hitt HH HHH D HHH Ht HHH iit Ht Ht HH HHH itt Ht Ht HHH HH DH Ht D HHH D Ht HHH H IHEHIHEHE HEE EERI HIEI HHHH For further information check lhhttpz www moxa com Mount user file system iroot Moxa tt You can proceed with the configuration of UC 7402 s network settings when you reach the bash command shell Configuration instructions are given in the next section 2 3 UC 7402 User s Manual Getting Started ATTENTION Serial Console Reminder Remember to choose VT100 as the terminal type Use cable CBL RJ45F9 150 which comes with UC 7402 to connect to the serial console port Telnet Reminder When connecting to UC 7402 over a LAN you must configure your PC s Ethernet IP address to be on the same subnet as the UC 7402 you wish to contact If you do not get connected on the first try re check the serial and IP settings and then unplug and re plug UC 7402 s power cord SSH Console UC 7402 supports an SSH Console to offer users with better security options 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 UC 7402 in a Windows environment The following figure shows a simple example of the c
40. Internet ixp0 192 168 8 174 eth0 192 168 2 172 ixp1 192 168 2 174 local net 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 Jetc openvpn A tapO br conf and etc openvpn B tap0 br conf Setup 3 Routed IP 1 Setup four machines as shown in the following diagram local net eth1 192 168 2 173 eth0 192 168 2 171 eth0 192 168 8 173 Internet ixp0 192 168 8 174 eth0 192 168 4 172 ixp1 192 168 4 174 local net 4 25 UC 7402 User s Manual Managing Communication 2 Create a configuration file named A tun conf and an executable script file named A tun sh 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 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 d end 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 EDES3 CBC auth MD5 tun mtu 1500 tun mtu extra 64 ping 40 ifconfig 192 168 4 174 192 168 2 173 up etc ope
41. OME bash_profile to cause it to take effect for all login sessions initiated by this user 5 2 UC 7402 User s Manual Programmer s Guide Obtaining help Use the Linux man utility to obtain help on many of the utilities provided by the tool chain For example to get help on the armv5b linux gcc compiler issue the command man armv5b linux gcc Cross Compiling Applications and Libraries To compile a simple C application just use the cross compiler instead of the regular compiler mxscaleb gcc o example Wall g 02 example c mxscaleb strip s example mxscaleb gcc ggdb o example debug example c Tools Available in the Host Environment Most of the cross compiler tools are the same as their native compiler counterparts but with an additional prefix that specifies the target system In the case of x86 environments the prefix is i386 linux and in the case of UC 7402 Xscale boards it is mxscaleb For example the native C compiler is gcc and the cross C compiler for Xscale in UC 7402 is mxscaleb gcc The following cross compiler tools are provided ar Manage archives static libraries as Assembler C g 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
42. Procedures eege EES EE CA 1 Introduction MOXA UC 7402 is a web server embedded network computer that features dual 10 100 Mbps Ethernet ports a PCMCIA interface for wireless LAN communication and CompactFlash for mass storage disk expansion UC 7402 is an excellent choice for embedded network applications and diverse M2M solutions UC 7402 is a rugged compact embedded computer that is designed for industrial applications Two key design features are the low power consumption and fanless operation which together ensure greater reliability and longer system life The communication oriented functionality includes both hardware and software In fact the software design is especially ideal for network communication based applications such as connecting to machines and other devices over a network UC 7402 provides real time data access a secure network gateway and VPN router The built in web server allows UC 7402 to be used as a web enabled gateway to let users access monitoring and control functions from anywhere on the network Because UC 7402 provides WLAN 802 11b g connectivity both wired and wireless networks can be integrated into a system communication medium Users can capture real time data from the network and aggregate it into the UC 7402 embedded web server and convert data into various standard data formats Data can be buffered and then distributed to the proper web browser The following topics are covered in this chapter
43. Tx Mbps Ethernet network The LED will flash on and off 2 ETx when Ethernet packets are being transmitted or received 3 ERx4 8 1 The bottom left corner LED indicator maintains a solid 2 orange color when the cable is properly connected to a 10 6 ERx Mbps Ethernet network The LED will flash on and off 7 m when Ethernet packets are being transmitted or received 8 Connecting to the Console Port UC 7402 s console port is an 8 pin RJ45 RS 232 port Pin RS 232 The port can be used to connect to the console utility TTT 1 DSR from a remote console via a V90 or GPRS modem with 1 8 2 RTS PPP protocol The pin definition is shown at the right If 3 GND you would like to use the console port for normal data i 4 TXD acquisition applications you can set the Console port to 5 RXD startup via PPP protocol For details refer to Dial up 6 DCD Service PPP section in Chapter 4 7 CTS 8 DTR UC 7402 User s Manual Introduction PCMCIA The PCMCIA slot supports the CardBus Card 32 Card standard and 16 bit PCMCIA 2 1 JEIDA 4 2 Card standard It supports 3 3V 5V and 12V at a working voltage of 120 mA Wireless LAN card expansion is optional The Wireless LAN card provided by Moxa lets you connect UC 7402 to a Wireless LAN with both 802 1b and 802 11g interfaces supported If you need device drivers for other kinds of PCMCIA cards contact Moxa for information on how to initiate a cooperative development project Comp
44. UC 7402 User s Manual First Edition January 2006 www moxa com product Moxa Systems Co Ltd Tel 886 2 8919 1711 Fax 886 2 8919 1722 Web www moxa com MOXA Technical Support Worldwide support moxa com tw The Americas support moxa com UC 7402 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 Copyright 2006 Moxa Systems Co Ltd All rights reserved Reproduction without permission is prohibited Trademarks MOXA is a registered trademark of The Moxa Group 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 Technologies 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 erro
45. actFlash UC 7402 provides one CompactFlash slot that supports CompactFlash type I II card expansion Currently Moxa provides a CompactFlash disk for plug amp play mass storage expansion You may also use flash disks available from most computer supply outlets The CompactFlash will be mounted at mnt hda If you need device drivers for other kinds of mass storage cards contact Moxa for information on how to initiate a cooperative development project Software Introduction Software Architecture The Linux operating system that is pre installed in UC 7402 follows the standard Linux architecture making it easy to port programs that follow the POSIX standard to UC 7402 Porting is done with the GNU Tool Chain provided by Moxa In addition to the Standard POSIX API device drivers for the buzzer and CompactFlash mass storage and Wireless LAN PCMCIA card are also included in the UC 7402 Linux system AP User Application Daemon Apache Telnet FTPD SNMP API Application Interface POSIX Socket Secure Socket Protocol Stack TCP IP UDP CMP ARP HTTP SNMP SMTP Device Driver PCMCIA CF WLAN RTC Microkernel Memory control Schedule Process Hardware RS 232 Ethernet PCMCIA CompactFlash UC 7402 s Flash ROM is partitioned into Boot Loader Linux Kernel Mini Root File System and User Root File System partitions In order to prevent user applications from crashing the Root File System UC 7402 uses a specially desi
46. add the DNS server address to the file Ask your network administrator which DNS server address you should use The DNS server IP address is specified with the 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 10 120 53 100 Purry root Moxa etc cat resolv conf 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 Web Service Apache The Apache web server s main configuration file is etc apache httpd conf with the default homepage located at usr www html index html Save your own homepage to the following directory usr www html Save your CGI page to the following directory 4 2 UC 7402 User s Manual Managing Communication usr www cgi bin Before you modify the homepage use a browser such as Microsoft Internet Explore or Mozilla Firefox from your PC to test if the Apache Web Server is working Type the LAN1 IP address in the browser s address box to open the homepage E g if the default IP address is still active type http 192 168 3 127 in address box Test Page for the Apache Web Server on MontaVista Linux Mozilla Firefox Sala
47. ain users S dhe Sel total 9 drwxr xr x drwxr xr x drwXxr Xr x drwXr Xr x Esempio drwxr Xr x EE stephen_ mkpasswd Jan 10 17 24 stephen_ mkpasswd Jan 10 17 24 stephen_ mkpasswd Jan MO 19243 bin stephen_ mkpasswd Jan 10 19 24 etc stephen_ mkpasswd dag 100220503 10s T 0E eo stephen mkpasswd O E E Sg EE stephen mkpasswd 53 Jani 10 22 03 moxa bat stephen_ mkpasswd 3262 Jam 10 22 03 moxa ico stephen mkpasswd 0 Jan 10 19 48 tmp stephen mkpasswd 0 Jan 10 19 48 usr stephen_ mkpasswd 0 Jan 10 18 12 var ENEE drwxr xr x drwxr xr x drwxr xr x m Ov amp M DB IB OP WN OO S Your Windows OS you use must satisfy the following requirements 1 Operating System Windows 2000 workstation or Windows XP professional 2 Minimum of 500 MB of free hard drive space to install the tool chain and develop programs All of the disk space must be on a single drive 3 CD ROM or equivalent 4 Ethernet connect to download the application program to UC 7402 5 Beable to log in as administrator 6 Usea Windows username without spaces You will be using a BASH shell window to enter commands In addition for editing text files such as configuration files you should use vi editor Do NOT use WordPad which could cause problems when the files are transferred to a bona fide Linux environment UC 7402 User s Manual Windows Tool Chain Introduction Installation Procedure Insert the CD into your PC s CD ROM drive and
48. allation Robust fanless design UC 7402 User s Manual Introduction Product Hardware Specifications UC 7402 LX CPU Intel Xscale IXP 422 266 MHz RAM 128 MB Flash 32 MB LAN Auto sensing 10 100 Mbps x 2 LAN Protection Built in 1 5 KV magnetic isolation Serial Console PPP RS 232 x 1 RJ45 USB 1 1 Client 1 PCMCIA PCMCIA type I II socket x 1 Compact Flash CompactFlash type I II socket x 1 Real Time Clock Yes Buzzer Yes LEDs Serial x 8 Console PPP x 1 PWR x 1 Ready x 1 LAN 10 100 x 2 Power input 12 48 VDC Power Consumption 7W Dimensions 197 x 125 x 44 mm Gross Weight 830g Operating temperature 10 to 60 C 14 to 140 F 5 to 95 RH Storage temperature 20 to 80 C 4 to 185 F 5 to 95 RH Regulatory Approvals EMC FCC Class A CE Class A Safety UL CUL TUV Warranty 5 years UC 7402 User s Manual Introduction Hardware Introduction Appearance and Dimensions Appearance UC 7402 Rear View 12 48 VDC Power Input 10 100 Mbps Ethernet x 2 DC 12 48V PCMCIA LANI LAN2 Console nie LL e CF Wee ay m Di USB 1 1 Client x 1 SE RS 232 miniB Connector PCMCIA x 1 PPP Console UC 7402 Top View LC 7402 Universal Communicator Ready Lani LAN Console UC 7402 Front View Reset to Default Reset to Default Hardware Reset Reset UC 7402 User s Manual Introduction
49. alue after net is the subnet behind the remote peer route add net 192 168 4 0 netmask 255 255 255 0 dev br0 d end Create a configuration file named B tap0 br conf and an executable script file named B tap0 br sh on OpenVPN B point to the peer remote 192 168 8 173 dev tap0 secret etc openvpn secrouter key cipher DES EDES3 CBC auth MD5 tun mtu 1500 tun mtu extra 64 4 23 UC 7402 User s Manual Managing Communication ping 40 up etc openvpn B tap0 br 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 dev br0 a A T end Note Select cipher and authentication algorithms by specifying cipher and auth To see with algorithms are available type openvpn show ciphers openvpn show auths 5 Start both of OpenVPN peers openvpn config A tap0 br conf amp openvpn config B tap0 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 6 Oneach OpenVPN machine check the routing table by typing the command route Destination Gateway Genmsk Flags Metric Ref Use Iface 192 168 4 0 255 255 255 0 U 0 0 0 brO 192 168 2 0 x 255 255 255 0 U 0 0 0 brO 192 168 8 0
50. ast 192 168 4 255 f An example ethernet card setup s Insert State OPEN mM mm broadcast and gateway are optional Dynamic IP addresses By default UC 7402 is configured for static IP addresses To configure one or both LAN ports to request an IP address dynamically replace static with dhcp and then delete the address network netmask and broadcast lines Default Setting for LANI iface ixpO inet static address 192 168 3 127 network 192 168 3 0 netmask 255 255 255 0 broadcast 192 168 3 255 Dynamic Setting using DHCP iface ixpO inet dhcp 11 115200 N0ne 8 1 V T100 Profile Edit PortManager Window Help a BIA alaale zl E CO 1 V T100 Te auto ixpO ixpl lo iface lo inet loopback iface ixpO inet dhcp iface ixpl inet dhcp ER After the boot settings of the LAN interface have been modified issue the following command to activate the LAN settings immediately etc init d networking restart 2 6 UC 7402 User s Manual Getting Started NOTE After changing the IP settings use the networking restart command to activate the new IP address Modifying Network Settings over the Network IP settings can be activated over the network but the new settings will not be saved to the flash ROM without modifying the file etc network interfaces For example type the command ifconfig ixp0 192 168 1 1 to change the IP address of LANI to 192 168 1 1
51. ateway are optional d f etc network interfaces line 1 of 162 0s StateOPEN M SS SS ere 2 9 UC 7402 User s Manual Getting Started Additional WLAN parameters are contained in the file RT2500STA dat To open the file navigate to the RT2500STA folder and invoke vi or type the following command vi etc Wireless RT2500STA RT2500STA dat to edit the file with vi editor Setting options for the various parameters are listed below the figure E PComm Terminal Emulator COM1 115200 None 8 1 T100 Profile Edit Port Manager Window Help eil BA c 2 ex z e lz E COM1 115200 None Te s Default or amp CountryRegqion 0 ers twirelessMode 0 SSID any etuorkType Infra Channel 0 eyzStr paPsk abcdefghijklmmopagqrstuyvywxyz TxHBurst 0 TurboRate 0 GProtection 0 ShortSlot 0 TxRate 0 RTSThreshold 2z31z FragThreshold 2312 SMode CAM fetc Wireless RTZSOOSTA SRTZSOOSTA dat line 1 of 34 2 State DEEN EE SS SS EETECIPETNETENET CountryRegion Sets the channels for your particular country region Setting Explanation 0 use channels 1 to 11 1 use channels 1 to 11 2 use channels 1 to 13 3 use channels 10 11 4 use channels 10 to 13 5 use channel 14 6 use channels 1 to 14 7 use channels 3 to 9 WirelessMode Sets the wireless mode Setting Explanation 0 11b g mixed 1 11b only 2 11g onl
52. ault SSID is any i vi etc wlan wlan conf D etc wlancfg wlancfg DEFAULT are used 2 for example SSID_wlan0 linux wlan This expects a file called etc wlan wlancfg linux wlan to be present E f Use a SSID of to associate with any network in range S SSSSSSS SSID wlan 0 any ENABLE wlan0 y ENABLE wlanl n SSID wlanz bzNABLE wlan2 n Consult your network administrator for SSID required in your wireless network For example SSID waln0 any Enable wlan0zyll 4 Duplicate the configuration profile to a new profile cp e c wlan wlancfg DEFAULT etc wlan wlancfg any Copy configuration profile DEFAULT to new configuration profile any 5 Configure the WEP setting if WEP is required on your wireless network vi etc wlan wlancfg any Settings only matter if PrivacyInveked is true lnxreq hostWEPEncrypt false true false inxreq hostWEPLecrypt false true false IldotllErivacyInvcked false true false ctllWHEFDefaultReyID 0 0111213 ctllExcludeUnencrypted false true false in AP this means WEF is required If ERIV GENSTR is not empty use ERIV GENTSTR to generate keys just a convenience PRIV_GENERATCR sbin nwepgen nwepgen Neesus compatible PRIV KEY128 false keylength to generate ERIV GENSTIR or set them explicitly Set genstr or keys nct both ctlliWEEDefaultKey0 format XX XX XX XX XX or ctllWEPDefasu
53. dded linux system always use the software reboot command gt reboot to protect the integrity of data being transmitted or processed Reset to default Button Press the Reset to default button continuously for at least 5 seconds to load the factory default configuration After the factory default configuration has been loaded the system will reboot automatically The Ready LED will blink on and off for the first 5 seconds and then maintain a steady glow once the system has rebooted We recommend that you only use this function if the software is not working properly and you want to load factory default settings To reset an embedded linux system always use the software reboot command gt reboot to protect the integrity of data being transmitted or processed The Reset to default button is not designed to hard reboot UC 7402 ATTENTION Reset to default preserves user s data The Reset to default button will NOT format the user directory and erase the user s data Pressing the Reset to default button will only load the configuration file All files in the etc directory will revert to their factory defaults but other User Data will still exist in the Flash ROM If you need to load the default System Image file refer to the System Image Backup section in Chapter 3 UC 7402 User s Manual Introduction Real Time Clock UC 7402 s real time clock is powered by a lithium battery We strongly recommend that you do not replace th
54. e Chapter 5 for details about the GDB debug tool Be sure to type the make command from within the tmp example hello directory since UC s tool chain puts a specially designed Makefile in that directory This special Makefile uses the mxscale gcc compiler to compile the hello c source code for the Xscale environment If you type the make command from any other directory Linux will use the x86 compiler for example cc or gcc Refer to Chapter 5 to see a Make file example 2 14 UC 7402 User s Manual Getting Started Uploading Hello to UC 7402 and Running the Program Use the following command to upload hello release to the UC 7402 via FTP 1 From the PC type ftp 192 168 3 127 2 Use bin command to set the transfer mode to Binary mode and the put command to initiate the file transfer ftp gt bin ftp gt put hello release 3 From the UC 7402 type chmod x hello release hello release The word Hello will be printed on the screen hello release 2 15 3 Managing Embedded Linux This chapter includes information about version control deployment updates and peripherals The information in this chapter will be particularly useful when you need to run the same application on several UC 7402 units The following topics are covered in this chapter LI LI DDL System Version Information System Image Backup gt Upgrating the Firmware gt Loading Factory Default
55. e System 3 5 Deploying the User File System to Additional UC 7402 Units s 3 5 Enabling and Disabling Daemons esee enne trennen 3 6 Setting the R n Level eere a ee edet e eter eee ns 3 8 Adjusting the System De dee ENNEN E e doesn dena E EE Tea 3 8 Setting the Time Manually cinnire e etri Pte oerte ud 3 8 NTP e E 3 9 Updating the Time Automatically eese rennen 3 10 Cron daemon to Execute Scheduled Commands esee 3 10 Connecting Peripherals tcr e pm Rc qe idet trecenti tener ees 3 11 CE Mass Storage ics acct EES 3 11 Managing Communications ccccseeceeeeeeeeeeeeeeeeesseeeeeeeeseneeeeeeeeeneeeeneeeees 4 1 Telnet TE hte ste n qr e red dp Pene e mata das 4 2 LENK 4 2 Web Service A DEER oou ee A AA E E AE en EE 4 2 Saving a Web Page to the CF Card sss 4 4 IPTABLES EE 4 6 KEE 4 10 NAT Example tette meer tte eee E 4 10 Enabling NAT at BOUD senine aea n ea nennen teen nennen 4 10 Dial up Service PPP ae etit ec Dre EP E et 4 11 NN TEE 4 14 NES Network HUE EE 4 17 Setting up UC 7402 as an NFS Server sse 4 17 Setting up UC 7402 as an NFS Client 4 18 EU 4 18 KE LEE 4 19 Open VPN HEET 4 20 Programmer s GUlde eege 5 1 Flash Memory Map 5 2 Linux Tool Chain Introduction neret ener nennen rennen eene nein 5 2 D bugeme With GDB unie pn DERE RERUM 5 5 Device AH seess geet e a esa t e aei bie en RO 5 5 REC RealTime Clock etta tenerte nitet 5 5 BUZZED
56. e instructions given in a previous section to access UC 7402 s Console Utility via the serial Console port and then type amp cd etc network to change directories ER PComm Terminal Emulator COM1 115200 N0ne 8 1 V T100 loj x Profile Edit Port Manager Window Help el RA e 2 es lz EP COMI1 115200 Nnne 8 1 TIO Foot Moxa cd etc network ro E bestet State OPEN 2 Type vi interfaces to edit the network configuration file with vi editor You can configure UC 7402 s Ethernet ports for static or dynamic DHCP IP addresses Static IP addresses As shown below 4 network addresses need to be modified address network netmask and broadcast The default IP addresses are 192 168 3 127 for LANI and 192 168 4 127 for LAN2 with default netmask of 255 255 255 0 2 5 UC 7402 User s Manual Getting Started ES PComm Terminal Emulator 41 115200 None 8 1 T100 Profile Edit PortManager Window Help 4 BIA alale sio EM COM1 115200 None 8 1 T100 E 2 f See the interfaces 5 manpage for information on what options are oR s available eMrerttitierettiirrrrtisirrriisirrriitirrrtiiieretititertrititireriiiir ts f We always want the loopback interface auto ixpO ixpl lo iface lo inet loopback iface ixp inet static address 192 168 3 127 network 192 168 3 0 netmask 255 255 255 0 broadcast 192 168 3 255 address 192 168 4 127 network 192 168 4 0 netmask 255 255 255 0 broadc
57. e lithium battery without help from a qualified Moxa support engineer If you need to change the battery contact Moxa RMA service team WARNING There is a risk of explosion if the battery is replaced by an incorrect type Placement Options Wall or Cabinet The two metal brackets that come standard with UC 7402 are used to attach UC 7402 to a wall or the inside of a cabinet Use two screws per bracket first to attach the brackets to the bottom of the UC 7402 Fig A Next use two screws per bracket to attach the UC 7402 to a wall or cabinet Fig B LIC 7402 Universal Communicator B Ready Wan Lanz Console Figure B UC 7402 Universal Communicator Wall Mounting Brackets top view UC 7402 User s Manual Introduction DIN Rail Mounting The aluminum DIN Rail attachment plate is included in the package If you need to reattach the DIN Rail attachment plate to UC 7402 make sure the stiff metal spring is situated towards the top as shown in the figures below 1 Insert the top of the DIN Rail into the 2 The DIN Rail attachment unit will snap slot just below the stiff metal spring into place as shown below metal spring L metal spring DIN Rail DIN Rail To remove UC 7402 from the DIN Rail simply reverse Steps 1 and 2 above Hardware Connection Description This section describes how to connect UC 7402 to serial devices for first time testing purposes We cover Wiring Require
58. ection File manager Editor Network SO SON BO ba e Qo sd E e cp Is In mount rm chmod chown chgrp sync mv pwd df mkdir rmdir vi cat zcat grep cut find more test sleep echo 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 UC 7402 User s Manual System Commands Process Other SOLO SI ON ice sh kill ps dmesg sty zcat mknod free date env clear reboot halt du gzip gunzip hostname MOXA special utilities QS ope E backupfs bf kversion cat etc version 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 pr
59. er mxscaleb gdb hello debug amp 4 Enterthe following command at the GDB DDD command prompt Target remote 192 168 4 99 2000 The command produces another line of output on the target console similar to the following Remote debugging using 192 168 4 99 2000 192 168 4 99 is the machine 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 breakpoint on main by double clicking or entering b main on the command line Click the cont button Device API UC 7402 supports control devices with the ioctl system API You will need to include moxadevice h and use the following ioctl function int ioctl int d int request Input int d open device node return file handle int request argument in or out Use the desktop Linux s man page for detailed documentation man ioctl RTC Real Time Clock The device node is located at dev rtc UC 7402 supports Linux standard simple RTC control You must include lt linux rtc h gt 1 Function RTC_RD_TIME int ioctl fd RTC_RD_TIME struct rtc time time Description read time information from RTC It will return the value on argument 3 2 Function RTC SET TIME int ioctl fd RTC SET TIME struct rtc time time Description set RTC time Argument 3 will be passed to RTC 5 5 UC 7402 User s Manual Programmer s Guide Buzzer The device node is located at dev console UC
60. g UC 7402 in a location that is not located near an Ethernet LAN connection you can use UC 7402 s PCMCIA port to attach a wireless LAN card The pre installed Linux operating system provides an open software operating system for your software program development Software written for desktop PCs can be easily ported to the UC 7402 platform with a GNU cross compiler without needing to modify the source code All of the necessary device drivers such as a PCMCIA Wireless LAN module and Buzzer control are also included with UC 7402 The Operating System device drivers and the software you develop for your own application can all be stored in UC 7402 s Flash memory Package Checklist UC 7402 LX Data acquisition embedded computer with dual Ethernet PCMCIA CompactFlash Linux OS UC 7402 is shipped with the following items e UC 7402 Wall Mounting Kit DIN Rail Mounting Kit UC 7402 Quick Installation Guide UC 7402 Documentation amp Software CD Cross over Ethernet cable CBL RJ45F9 150 150 cm 8 pin RJ45 to Female DB9 console port cable Power Adaptor e Product Warranty Booklet NOTE Notify your sales representative if any of the above items is missing or damaged Product Features Intel XScale IXP 422 266 MHz Processor On board 128 MB RAM 32 MB Flash ROM Dual 10 100 Mbps Ethernet PCMCIA CompactFlash wireless LAN expansion supports 802 11b 802 11g Linux ready communication platform DIN Rail or wall mounting inst
61. gned Mini File System with Protected Configuration for emergency use This Mini File System comes with serial and Ethernet communication capability for users to load the Factory 1 10 UC 7402 User s Manual Introduction Default Image file The Mini File System will only be activated if the boot loader fails to load the User Root File System User AP User Directory Mini Root File System User Configuration Configuration 3 Linux Kernel amp Root Boot Loader HW To improve system reliability UC 7402 has a built in mechanism that prevents the system from crashing The procedure is as follows When the Linux kernel boots up the kernel will mount the root file system and then enable services and daemons During this time the kernel will start searching for system configuration parameters via rc or inittab Normally the kernel uses the User Root File System to boot up the system The Mini Root File System is protected and cannot be changed by the user providing a safe zone The kernel will only use the Mini Root File System when the User Root File System crashes For more information about the memory map and programming refer to Chapter 5 Programmer s Guide Journaling Flash File System JFFS2 The User Root File System 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 transparent to the user The Journali
62. he operating system to boot up The green Ready LED will not turn on until the operating system is ready Connecting UC 7402 to a PC There are two ways to connect UC 7402 to a PC through the serial Console port or via Telnet over the network Serial Console The serial console port gives users a convenient way of connecting to UC 7402 s console utility This method is particularly useful when using UC 7402 for the first time The signal is transmitted over a direct serial connection so you do not need to know either of UC 7402 s two IP addresses in order to connect to the serial console utility Use the serial console port settings shown below Baud rate 115200 bps Parity None Data bits 8 Stop bits 1 Flow Control None Terminal VT100 Once the connection is established the following window will open EA COMI 115200 Nons 8 1 V T100 Te oxa Embedded Linux Professional Edition oxa login root Password Z 88 LELES ES SHSKSHS S8999 8s sss ggss Ld sss ggss sss sss ss sgg sss sss sss L2 sss sgg Z gg 8 88 D SESE Ss g gg sss ggg sgg S5 38 ds g gg sss Er S888 g 8 355 8 FF FF sg S888 g sss 8 ss FF ss sss LLE EEEE g gg ggg 88 859 D sg ggg 358 8 ggg u sss sss ss 8 8 ss sss 8 8 sg 5 29 seg H Z zerg F z gorg LE EEEE EES LEESE EE EEE E EE E E EE E MEE E E EEE For further information check top wins moxa com ount user file system iroot8Moxa
63. he IPTABLES Click on the following links for more information about iptables http www linuxguruz com iptables http www netfilter org documentation HOW TO packet filtering HOW TO html Since the IPTABLES command is very complex to illustrate the IPTABLES syntax we have divided our discussion of the various rules 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 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
64. idence of original purchase Obtain a Product Return Agreement PRA from the sales representative or dealer Fill out the Problem Report Form PRF Include as much detail as possible for a shorter product repair time Carefully pack the product in an anti static package and send it pre paid to the dealer The PRA should be visible on the outside of the package and include a description of the problem along with the return address and telephone number of a technical contact CA
65. ilter Table FORWARD Chain Mangle Table POSTROUTING Chain NAT Table OUTPUT Chain Filter Table OUTPUT Chain NAT Table POSTROUTING Chain Outgoing Packets UC 7402 supports the following sub modules Be sure to use the module that matches your 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 UC 7402 does NOT support IPV6 and ipchains 4 7 UC 7402 User s Manual Managing Communication NOTE The basic syntax to enable and load an IPTABLES module is as follows 1smod modprobe ip_tables modprobe iptable filter Use lsmod to check if the ip tables module has already been loaded in the UC 7402 Use modprobe to insert and enable the module Use the following command to load the modules iptable filter iptable mangle iptable nat modprobe iptable filter Use iptables iptables restore iptables save to maintain the database IPTABLES plays the role of packet filtering or NAT Take care when setting up the IPTABLES rules If the rules are not correct remote hosts that connect via a LAN or PPP may be denied access We recommend using the Serial Console to set up t
66. in 104 root 1098 root but oe ISS ee 143 root 145 root 152 TODE INGO zeen IEL oE ISA Koog IGS roge ISE ooe 167 root LTO wee 17 root JEE eeng root Moxa ect S 5 eS S S S S S e D 5 S S S S S eS 5 nobody S se SDI httpd 5 S S S S S eS e 9 5 S S S S e S 5 eS 3 6 UC 7402 User s Manual Managing Embedded Linux To run a private daemon you can edit the file rc local as follows cd etc rc d dvi rc local root Moxa cd etc rc d root Moxa etc rce d vi rc local Next use the vi open your application program We use the example program tcps2 release and put it to run in the background bin sh Add you want to run daemon root tcps2 release amp Then you will find the enabled daemons after you reboot the system root Moxa ps ef PID uid VmSize Stat Command root 1296 init root keventd POOG ksoftirqd_CPU0 root kswapd root bdflush root kupdated root mtdblockd E HAHN PWD root khubd root root root root root root root nobody S e S 5 eS S S S S GEESS weel D eene S ixp425 ixp0 S ixp425 ixpl e stdef S usr sbin inetd IS usr sbin httpd S usr sbin httpd nobody S usr sbin httpd nobody S usr sbin httpd nobody S EE EE ee 5 2 5 X S S S e S 5 e e S S S S e S 5 nobody h usr sbin httpd S TUTTI root tcps2 release usech desen Statd usr sbin snmpd s 1 dev null
67. in the following table Address Size Contents 0x00000000 0x0005FFFF 384 KB Boot Loader Read ONLY 0x00060000 0x0015FFFF 1 MB Kernel object code Read ONLY 0x00160000 0x0055FFFF 4 MB Mini root file system EXT2 Read ONLY 0x00560000 0x01F5FFFF 26 MB User root file system JFFS2 Read Write 0x01F60000 0x01FBFFFF 384 KB Not used 0x01FC0000 0x01 FDFFFF 128 KB Boot Loader configuration Read ONLY 0x01FE0000 0x01 FFFFFF 128 KB Boot Loader directory Read ONLY Mount the user file system to mnt usrdisk with the root file system Check to see if the user file system was mounted correctly If user file system is okay the kernel will change the root file system to mnt usrdisk If the user file system is not okay the kernel will use the default Moxa file system To finish boot process run the init program 1 The default Moxa file system only enables the network and CF It lets users recover the user file system when it fails 2 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 3 Users can create the user file system on the PC host or target platform and then copy it to the UC 7402 Linux Tool Chain Introduction To ensure that an application will be able to run correctly when installed on UC 7402 you must ensure that it is compiled and linked to the same libraries
68. ion 0 disable 1 enable TxRate Sets the TxRate Setting Explanation Auto 1 Mbps 2 Mbps 5 5 Mbps 11 Mbps 6 Mbps 9 Mbps 12 Mbps 18 Mbps 24 Mbps 36 Mbps 48 Mbps 12 54 Mbps VOA UO vto rj j ic e RTSThreshold Sets the RTS threshold Setting 1 to 2347 FragThreshold Sets the fragment threshold Setting 256 to 2346 2 12 UC 7402 User s Manual Getting Started Test Program Developing Hello c In this section we use the standard Hello programming example to illustrate how to develop a program for UC 7402 In general program development involves the following seven steps Step 1 A Connect UC 7402 to a Linux PC Step 2 Install Tool Chain GNU Cross Compiler amp glibc Step 3 Set the cross compiler and glibc environment variables Step 4 Code and compile the program Step 5 Download the program to UC 7402 Via FTP or NFS ee Step 6 a 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 UC 7402 units if needed Compiler Installing the Tool Chain Linux NOTE The PC must have the Linux Operating System pre installed before installing the UC 7402 GNU Tool Chain Redhat 7 3 8 0 Fedora core and compatible versions are recommended The Tool Chain requi
69. kets 33 errors 0 dropped 0 overrun 0 TX packets 42 errors 0 dropped 0 overrun 0 Now type ping z z z z where z z z z is the address of your name server This should work Here s what the response could 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 ttl2225 time 266 ms C 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 Try typing netstat nr This should show three routes something like this Kernel routing table Destination Gateway Genmask Flags Metric Ref Use iface 129 67 1 165 0 0 0 0 255 255 255 255 UH 0 0 6 pppO 127 0 0 0 0 0 0 0 255 0 0 0 U 0 0 0 lo 0 0 0 0 129 67 1 165 0 0 0 0 UG 0 0 6298 pppO 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 try 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 4 13 UC 7402 User s Manual Managing Communication Setting up a Machine for Incoming PPP Connections This first example applies to using a modem and requiring
70. l M Done To open the default CGI page type http 192 168 3 127 cgi bin printenv in your browser s address box Mozilla Firefox File Edit View Go Bookmarks Tools Help E I Co QM D MEIER Ae hieren Getting Started E Latest Headlines lt Q 9 KE DOCUMENT ROOT usr www html GATEWAY INTERFACE CGI 1 1 HTITP_ACCEPT text xml1 application xml application xhtml xml text html q 0 9 text plain q 0 8 image png q 0 5 HITP ACCEPT CHARSET ISO 8859 1 utf 8 q 0 7 q 0 7 HTTP ACCEPT ENCODING gzip deflate HTTP ACCEPT LANGUAGE en us en q 0 5 HTTP CONNECTION keep alive HTTP HOST 192 168 3 127 HTTP KEEP ALIVE 300 HITP USER AGENT Mozilla 5 0 Windows U Windows NT 5 1 en US rv 1 7 5 Gecko 20041107 Firefox 1 0 PATH bin usr bin sbin usr sbin QUERY STRING REMOTE ADDR 192 168 3 105 REMOTE PORT 3634 REQUEST METHOD GET REQUEST URI cgi bin printenv SCRIPT FILENAME usr www cgi bin printenv SCRIPTI NAME cgi bin printenv SERVER ADDR 192 168 3 127 SERVER ADMIN root Glocalhost SERVER NAME localhost SERVER PORT 80 SERVER PROTOCOL HITP 1 1 SERVER SIGNATURE address Apache 2 0 42 Server at localhost Port 80 address An SERVER SOFIWARE Apache 2 0 42 Unix 4 3 UC 7402 User s Manual Managing Communication NOTE To open the default CGI test script report page type http 192 168 3 127 cgi bin test cgi in your br
71. lic to a local network 192 168 0 0 24 with read and write authority NFS clients can just read home public they do not have write authority Example 3 home test 192 168 3 100 rw In this example UC 7402 shares the directory home test to an NFS Client 192 168 3 100 with both read and write authority After editing the NFS Server configuration file remember to use the following command to restart and activate the NFS server etc init d nfs user server restart Setting up UC 7402 as an NFS Client Mail NOTE The following procedure is used to mount a remote NFS Server 1 Scan the NFS Server s shared directory 2 Establish a mount point on the NFS Client site 3 Mount the remote directory to a local directory Step 1 showmount e HOST showmount Show the mount information for an NFS Server e Show the NFS Server s export list HOST IP address or DNS address Steps 2 amp 3 mkdir p home nfs public mount t nfs MES Server IP directory mount point Example mount t nfs 192 168 3 100 home public home nfs public 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 4 18 UC 7402 User s Manual Managing Communication
72. ltKeyl 2 MNXINXIXXIXXINXIXXIXXIXXIXXIXXIXXIXXIXX ctllWEFDefaultEey2 e g 01 20 03 40 08 ar Idcotl1l1WEPEDefaultRey3 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d SELECT STATICN MCLE IS ADHCC n yin y adhoc n infrastructure UC 7402 User s Manual Getting Started IEEE802 11g The following IEEE802 11g wireless modules are supported ASUS WL 107g CNET CWTC 854 181D version Edmiax EW 7108PCg Amigo AWP 914W GigaByte GN WMGK Other brands that use the Ralink RT2560 series chip set To configure the WLAN for IEEE802 11g 1 2 Unplug the CardBus Wireless LAN card first Use the command vi etc networking interfaces to open the interfaces configuration file with vi editor and then edit the 802 11g network settings circled in red in the following figure E3 PComm Terminal Emulator COM1 115200 None 8 1 T100 M zii d Profile Edit PortManager Window Help 2 BIA glzcleisiecl Sei E COMI1 115200 N0ne 8 1 V TL OO Te ff embedded ethernet LANL iface ixpO inet static address 192 168 3 127 network 192 168 3 0 netmask 255 255 255 0 broadcast 192 168 3 255 f embedded ethernet LANZ iface ixpl inet static address 192 168 4 127 network 192 168 4 0 netmask 255 255 255 0 S02 11qg Gigabyte Cardbus wireless card iface ethO inet static address 192 168 5 127 network 192 168 5 0 netmask 255 255 255 0 broadcast 192 168 5 255 ff An example ethernet card setup broadcast and g
73. ly advised that you label wiring to all devices in the system 1 8 UC 7402 User s Manual Introduction Connecting the Power Connect the 12 48 VDC power line with UC 7402 s terminal block If the power is properly supplied the Ready LED will illuminate with a solid green color after 30 to 60 seconds have passed Grounding UC 7402 Grounding and wire routing helps limit the effects of noise due to electromagnetic interference EMI Run the ground connection from the ground screw to the grounding surface prior to connecting devices ATTENTION This product is intended to be mounted to a well grounded mounting surface such as a metal panel SG The Shielded Ground sometimes called Protected Ground contact is DDS the left most contact of the 3 pin power terminal block connector when viewed from the angle shown here Connect the SG wire to an appropriate grounded metal surface DC 12 48V Connecting to the Network Connect one end of the Ethernet cable to one of UC 7402 s 10 100M Ethernet ports 8 pin RJ45 and the other end of the cable to the Ethernet network If the cable is properly connected UC 7402 will indicate a valid connection to the Ethernet in the following ways 8 1 The bottom right corner LED indicator maintains a solid Pin Signal green color when the cable is properly connected to a 100 1 E
74. ments Connecting the Power Grounding UC 7402 Connecting to the Network Connecting to the Console Port PCMCIA and CompactFlash Wiring Requirements ATTENTION Safety First Be sure to disconnect the power cord before installing and or wiring your UC 7402 Wiring Caution Calculate the maximum possible current in each power wire and common wire Observe all electrical codes dictating the maximum current allowable for each wire size If the current goes above the maximum ratings the wiring could overheat causing serious damage to your equipment Temperature Caution Be careful when handling UC 7402 When plugged in UC 7402 s internal components generate heat and consequently the outer casing may feel hot to the touch You should also observe the following common wiring rules Use separate paths to route wiring for power and devices If power wiring and device wiring paths must cross make sure the wires are perpendicular at the intersection point NOTE Do not run signal or communication wiring and power wiring in the same wire conduit To avoid interference wires with different signal characteristics should be routed separately e You can use the type of signal transmitted through a wire to determine which wires should be kept separate The rule of thumb is that wiring that shares similar electrical characteristics can be bundled together Keep input wiring and output wiring separate e Where necessary it is strong
75. n Complete window Moxa Setup ES ES UC 7402 User s Manual Windows Tool Chain Introduction Uninstalling the Windows Tool Chain 1 Insert the MOXA CD into the CD ROM drive and enter the tool chain Windows compiler directory Next double click on the setup exe program and select the Root Install Directory Moxa UC Tool Chain Setup Choose Installation Directory DER Select Root Install Directory Select the directory where you want to install Also choose a few installation parameters Root Directory CAUC Browse Install For r Default Text File Type All Users Recommend C pos C Just Me Unis Recommend E 5em T 50 mm 2 Select the local package directory es Moxa UC Tool Chain Setup Select Local Package Directory SEE Select Local Package Directory Select the directory where the package files of Tool Chain exist m Local Package Directory H tool chain Windows compile E E 5e T 50 nm B 7 UC 7402 User s Manual Windows Tool Chain Introduction 3 Double click on the Default item and change it to the Uninstall item pz Moxa UC Tool Chain Setup Select Packages Select Packages p Select packages to install Diii View Category Moxa UC Tool Chain Setup Select Packages Select Packages Select packages to install B 8 UC 7402 User s Manual Windows Tool Chain Introduction 4 The tool chai
76. n will begin to unstall F Moxa UC Tool Chain Setup Progress This page displays the progress of the installation Uninstalling moxa mxscaleb Package Total Disk 5 The Uninstalls complete window will appear when the uninstallation process is complete Moxa Setup Uninstalls complete Using the BASH Shell A command line interface is used to develop applications with the tool chain To access the command line you need to launch a BASH shell window To open a BASH shell window choose Start Menu gt Programs gt UC Tool Chain gt Moxa Bash Shell or lick on the desktop Moxa Bash Shell icon S Your group is currently mkpasswd This indicates that The etc passwd and possibly etc group files should be rebuil See the man pages for mkpasswd and mkgroup then for example ru mkpasswd 1 d gt etc passwd mkpasswd l d gt etc group Note that the d switch is necessary for domain users Is medl total 9 obey pere rel stephen mkpasswd drwXxr xr x stephen mkpasswd drwXr xr x stephen mkpasswd Jan 10 19 48 bin drwXxr xr x stephen mkpasswd Jan 10 19 24 etc SEW re stephen_ mkpasswd 3262 Jan 10 22 03 insight ico drwXr Xr x Stephen mkpasswd 0 geet LO Lesa Late Jan 10 17 24 Jan 10 17 24 0 0 0 0 UC 7402 User s Manual Windows Tool Chain Introduction SGwxie xr x en Se drwxr xr x drwXxr Xr x drwXxr Xr x mkpasswd mkpasswd mkpasswd mkpasswd
77. ng Flash File System JFFS2 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 directory 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 which enhances the write life of the devices native data compression inside the file system design support for hard links The key features of JFFS2 are Targets the Flash ROM Directly e Robustness Consistency across power failures No integrity scan fsck is required at boot time after normal or abnormal shutdown Explicit wear leveling Transparent compression UC 7402 User s Manual Introduction 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 board
78. nication Add a line in the end of re Local home nat sh EXIF ixp0O 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 dev null means the standard error messages will be dump to null device modprobe ip tables 2 dev null modprobe ip conntrack 2 dev null modprobe ip conntrack ftp 2 dev null modprobe ip conntrack irc 2 dev null modprobe iptable nat 4 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 proc sys net ipv4 ip forward sbin iptables F sbin iptables X sbin iptables Z sbin iptables F t nat sbin iptables X t nat sbin iptables Z t nat sbin iptables P INPUT ACCEPT sbin iptables P OUTPUT ACCEPT sbin iptables P FORWARD ACCEPT sbin iptables t nat P PREROUTING ACCEPT sbin iptables t nat P POSTROUTING ACCEPT sbin iptables t nat P OUTPUT ACCEPT 4 Step 3 Enable IP masquerade Dial up Service PPP 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 Modem PPP access is almost identical to connecting directly to a network through UC 7402 s
79. nt fd fd swtd_open if fad lt 0 printf Open sWatchDog device fail n exit 1 swtd_enable fd 5000 enable it and set it 5 seconds while 1 do user application want to do 5 8 UC 7402 User s Manual Programmer s Guide swtd_ack fd swtd_close fd exit 0 The makefile is shown below all mxscaleb gcc o xxxx xxxx c lmoxalib Example 2 include lt stdio h gt include lt stdlib h gt include lt signal bs include lt string h gt include lt sys stat bs include lt sys ioctl h gt include lt sys select h gt include lt sys time h gt include lt moxadevice h gt static void mydelay unsigned long msec struct timevaltime time tv_sec msec 1000 time tv_usec msec 1000 1000 select 1 NULL NULL NULL amp time static int swtdfd static int stopflag 0 static void stop swatchdog stopflag 1 static void do_swatchdog void swtd_enable swtdfd 500 while stopflag 0 mydelay 250 swtd ack swtdfd swtd disable swtdfd int main int argc char argv pid t sonpid signal SIGUSR1 stop swatchdog swtdfd swtd open if swtdfd lt 0 printf Open sWatchDog device fail n exit 1 if sonpid fork 0 do swatchdog do user application main function 5 9 UC 7402 User s Manual Programmer s Guide end user application kill sonpid SIGUSR1
80. nvpn 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 d end 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 tunO 192 168 2 0 x 255 255 255 0 U 0 0 0 ixpl 192 168 8 0 255 255 255 0 U 0 0 0 ixpO 4 26 Programmer s Guide This chapter includes important information for programmers This following functions are covered in this chapter Flash Memory Map Linux Tool Chain Introduction Debug with GDB Device API RTC Real Time Clock Buzzer WDT Watch Dog Timer Make File Example DOCOCODDUC UC 7402 User s Manual Programmer s Guide Flash Memory Map NOTE Partition sizes are hard coded into the kernel binary To change the partition sizes you will need to rebuild the kernel The flash memory map is shown
81. ogram 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 backup file system user directory built the file system user directory show kernel version show user directory version mount ramdisk unmount ramdisk A 2 B Windows Tool Chain Introduction UC 7402 s Windows Tool Chain is a cross development environment that simulates the Linux root file system allowing users to develop applications on a Windows PC The following topics are covered in this appendix Introduction Installation Procedure Using the BASH Shell Compilation GDB debug tool Insight UUUUU UC 7402 User s Manual Windows Tool Chain Introduction Introduction UC 7402 s Windows Tool Chain is a cross development environment that simulates the Linux root file system allowing users to develop applications in a Windows environment Install the Windows tool chain to set up a Linux like environment on your Windows machine The following figure shows an example of what the Windows Tool Chain environment looks like Your group is currently mkpasswd This indicates that The etc passwd and possibly etc group files should be rebuil See the man pages for mkpasswd and mkgroup then for example ru mkpasswd 1 d gt etc passwd mkpasswd 1 d gt etc group Note that the d switch is necessary for dom
82. onfiguration that is required Ze PuTTY Configuration Category Session Basic options for your PuTTY session Logging Specify your connection by host name Terminal Host Name Port Keyboard 192 168 3 127 22 Bell Protocol Wind dro C Baw C Telnet Rlogn e SSH Appearance Translation Load save or delete a stored session Selection Saved Sessions DOE UC 7402 Console Setting Connection Telnet Default Settings E Load UC 7402 Console Setting Rlogin SSH Tunnels Delete Save Close window on exit C Always Never Only on clean exit Cancel 2 4 UC 7402 User s Manual Getting Started Linux Users NOTE From a Linux machine use the ssh command to access UC 7402 s Console utility via SSH ssh 192 168 3 127 Select yes to complete the connection root8bee notebook root ssh 192 168 3 127 ioe SEET our loversic VIZ ote Sho dbz I Lee EE erue qe dere eieaa eneel RSA eren Eeer at Skis Ee E geen diam i Glo AE a Are you sure you want to continue connection yes no yes_ SSH provides better security compared to Telnet for accessing UC 7402 s Console utility over the network Configuring the Ethernet Interface UC 7402 s network settings can be modified with the serial Console or online over the network Modifying Network Settings with the Serial Console In this section we use the serial console to modify UC 7402 s network settings 1 Follow th
83. ow e Stack Window e Target Window e Thread Window e Watch Window B 12 C Service Information This appendix shows you how to contact Moxa for information about this and other products and how to report problems The following topics are covered in this appendix U MOXA Internet Services Q Problem Report Form LI Product Return Procedure UC 7402 User s Manual Service Information MOXA Internet Services Customer satisfaction is our number one concern and to ensure that customers receive the full benefit of our products Moxa Internet Services has been set up to provide technical support driver updates product information and user s manual updates The following services are provided E mail for technical support support moxa com tw World Wide Web WWW Site for product information CENE http www moxa com C 2 UC 7402 User s Manual Service Information Problem Report Form MOXA UC 7402 Customer name 1 Moxa Product L1UC 7402 LX 2 Serial Number Problem Description Please describe the symptoms of the problem as clearly as possible including any error messages you see A clearly written description of the problem will allow us to reproduce the symptoms and expedite the repair of your product C 3 UC 7402 User s Manual Service Information Product Return Procedure For product repair exchange or refund the customer must Provide ev
84. owser s address box 7 Mozilla Firefox DES Fie Edit View Go Bookmarks Tools Help Qa H amp A http 192 168 3 127cgi binttest cgi v Go KI fp Getting Started Latest Headlines CGI 1 0 test script report 0 9 text plain q 0 8 image png q 0 5 The CGI function is enabled by default If you want to disable the function modify the file etc apache httpd conf When you develop your own CGI application make sure your CGI file is executable 192 168 3127 PuTTY root Moxa usr www cgi bin ls al drwxr xr x 2 KOE root 0 Aug 24 1999 drwXxr xr x Iro root Q Ney S Loerie EE d ng root 268 Dec 19 2002 Se ee lll OOE root 757 Aug 24 1999 root Moxa usr www cgi bin Saving a Web Page to the CF Card Since some applications will have web pages that take up a lot of memory space you will need to be able to run the homepage and other pages from the CF card In this section we use a simple example to illustrate how to save web pages to the CF card and then configure the Apache web server to open the pages The files used in this example can be downloaded from Moxa s website Step 1 Prepare web page and put pages to CF card Click on the following link to download the web page test suite http www w3 org MarkUp Test HTML401 zip Uncompress the zip file to your desktop PC and then use FTP to transfer it to UC 7402 s mnt hda directory 192 168 3 127 PUTTY root Moxa mnt hda ls al drwxr xr x
85. r not they are on the same subnet as the host 1 2 The Searching window displays the Model MAC Address and IP Address of devices that Click o n the Broadcast Search button to start searching T8 UC Finder File Function About Broadcast Search No Model X 1 MAC Address IP Address Search Result 0 UC s were located Searching for UC Found 1 UC s remain timeout 3 second s No Mod MAC Address IP Address uc 7110 00 90 E8 00 00 18 192 168 3 127 6 4 UC Finder UC 7402 User s Manual NOTE When the search is complete the same information is displayed in the UC Finder window T UC Finder File Function About 2 Broadcast Search IP Address 132 158 3 127 Search Result 1 UC s UC Finder is designed to determine the IP addresses of all UC units connected to the same LAN the host that is running UC Finder To configure UC s IP addresses or other configuration parameters use Telnet over the network or connect directly to the serial Console port to access UC 7402 s Console utility Linux ucfinder Copy ucfinder from the Documentation and Software CD to your Linux PC and then use the following command to start the program UC Finder will automatically locate all UC 7402 units on the LAN and then report their IP addresses ucfinder 6 5 UC Finder A System Commands busybox V0 60 4 Linux normal command utility coll
86. ramdisk df h Filesystem Size Used Available Use Mounted on dev mtdblock3 26 0M 9 0M 17 0M 352 dev mtdblock3 26 0M 9 0M 17 0M 35 dev ram2 0M 42 0k 1 8M 2 var tmpfs 62 1M 0 62 1M 0 dev shm dev raml 29 0M 13 0k 27 5M 0 mnt ramdisk root Moxa mnt ramdisk backupuf mnt ramdisk usrfs backup Sync the file system Now backup the user root file system Please wait Backup user root file system OK root Moxa mnt ramdisk Deploying the User File System to Additional UC 7402 Units For some applications you may need to ghost one UC 7402 user file system to other UC 7402 units Back up the user file system to a PC refer to the previous subsection Backing Up the User File System for instructions and then type the following commands to copy the backup to additional UC 7402 units upramdisk cd mnt ramdisk upfirm usrfs backup root Moxa mnt ramdisk ls al drwxr xr x 3 root root 1024 Jun 15 02 47 drwxr xr x 15 root root 1 poot root UA Piss canbe Er 28 lost found Saja il se eYouE root 27263140 Jun 15 02 48 root Moxa mnt ramdisk upfirm usrfs backup Upgrade firmware utility version 1 1 To check source firmware file context The source firmware file conext is OK This step will destroy all your firmware Do you want to continue it Y N Now upgrade the file user file systim Do you want to keep the network IP setting on etc network interfaces file Y N Backup the network setting
87. rding to the View by button When viewing by Category click the plus sign to open or close the packages under that category This is the same list you see in flat form when viewing by Full Partial By default named packages are installed e Install If the package was not previously installed select this option to install the package now e Reinstall If the package was previously installed select this option to install it again This will overwrite the previous installation e Uninstall If the package was previously installed select this option if you do NOT want to make any changes e Skip Ignores a package entirely regardless of whether it was previously installed or uninstalled Packages marked Skip are omitted from the Partial display 5 The Progress window will appear The installer will install all packages that were selected This process could take from 5 to 30 minutes depending on the speed of your system When the installation is complete the Complete the Installation window will appear F7 Moxa UC Tool Chain Setup loj x Progress This page displays the progress of the installation Parsing ini file Package EEE B 5 UC 7402 User s Manual Windows Tool Chain Introduction 6 Checkmark Create icon on Desktop to place a Moxa BASH Shell icon on your desktop and then click on Finish Le Moxa UC Tool Chain Setup Create Icons 7 Click on OK to close the Installatio
88. red_Wu Jared_Wu Jared_Wu Jared_Wu drwxrwx drwxrwx 13 drwxrwx 6 Next enter the hello directory and invoke the make program that will execute the compilation instructions written in the Makefile to compile the hello project 4294967295 mkpasswd 4294967295 4294967295 4294967295 4294967295 4294967295 4294967295 4 11710 ete 18 07 hello 4 11 12 insight ico dl Abe ak iia 4 10 12 moxa bat Nov 4 11 12 moxa ico Nov 4 18 11 tmp Nov 4 11 06 usr Jared_Wu Jared_Wu Jared_Wu Jared_Wu drwxrwx N oz MO SEN drwxrwx C Ce ei Ze O a lt Jared_Wu Jared_Wu Jared_Wu Jared_Wu N o N TO B 10 UC 7402 User s Manual Windows Tool Chain Introduction drwxrwx 6 Jared Wu 4294967295 0 Nov 4 11 06 var cd hello make usr local mxscaleb bin mxscaleb gcc o hello release hello c usr local mxscaleb bin mxscaleb strip s hello release usr local mxscaleb bin mxscaleb gcc ggdb o hello debug hello c ls Makefile README hello debug hello release hello c After that use FTP to upload the executable file to the UC and then run the executable ftp gt bye cp 192 168 14 9 Connected to 192 168 14 9 220 Moxa FTP server lt Version wu 2 6 1 lt 2 gt Mon Nov 24 12 17 04 CST 2003 gt ready User lt 192 168 14 9 lt none gt gt root 331 Password required for root Password 230 User root logged in ftp bam 200 PORT command successful 150
89. res about 100 MB of hard disk space on your PC The UC 7402 Tool Chain software is located on the UC 7402 CD To install the Tool Chain insert the CD into your PC and then issue the following commands mount dev cdrom mnt cdrom rpm ivh mnt cdrom tool chain Linux mxscaleb x x x x i386 rpm The Tool Chain will be installed automatically on your Linux PC within a few minutes Before compiling the program be sure to set the following path first since the ToolChain files including the compiler link library and include files are located in this directory PATH usr local mxscaleb bin PATH Setting the path allows you to run the compiler from any directory Refer to Appendix B for an introduction to the Windows Tool Chain In this chapter we use the Linux tool chain to illustrate the cross compiling process 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 df h 2 13 UC 7402 User s Manual Getting Started NOTE 1 Terminal Emulator COM1 115200 None 8 1 T100 Bl xl Profile Edit PortManager Window Help 4 SR l iss sia None 8 1 V T100 EZ done root Moxa fetc init d df h or Filesystem Size Used Available Uses Mounted on RTS dev mtdblock3 z6 0M 9 0HM 17 0M 35 u Ze OH 3 OH 17 0M 35 2 0M 40 0k 1 8M 2 var 62 1M 0 62 1M DS dev
90. riod only applies if the connect or pty option is used plugin pppoe so lt End of File options line 1 of 342 0 4 15 UC 7402 User s Manual Managing Communication 11 Add one of two files ete ppp options ixp0 or etc ppp options ixp1 The choice depends on which LAN is connected to the ADSL modem If you use LANI to connect to the ADSL modem then add etc ppp options ixp0 If you use LAN2 to connect to the ADSL modem then add etc ppp options ixp1 The file context is shown below name username hinet net 4 1 909 mru 1492 defaultroute noipdefault options ixp line 1 of 5 20 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 ixp0 The ixp0 is what is connected to the ADSL modem LAN port The example above uses LANI To use LAN2 type pppd ixp1 Type ifconfig ppp0 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
91. root root 16384 Dec 11 14 18 drwXr Xxr x root roort 0 Sep 29 17 43 CEWRI SE K root root 1768 Dec 11 14 16 drwXr Xr x root root 4096 Dec 11 14 19 E SEIN root 26011 Dec Il abe acts EE TOOL root 3145 Dec 11 14 16 CUENTE root POOE 90 Dec ETE 14 17 drwXxr Xxr x root root 24576 Dec 11 14 20 EE JL SESE root 2808s Dec abb cabe ES rootGMoxa mnt hdai 4 4 UC 7402 User s Manual Managing Communication NOTE Step 2 Use the following commands to configure the Apache web server s DocumentRoot cd etc apache vi httpd conf DocumentRoot mnt hda Change the document root directory to your CF card 192 T6873 T PUTTY ServerRoot etc apache PidFile var run httpd pid ScoreBoardFile var run httpd scoreboard Timeout 300 KeepAlive On MaxKeepAliveRequests 100 KeepAliveTimeout 15 MinSpareServers 5 MaxSpareServers 10 StartServers 5 MaxClients 150 MaxRequestsPerChild 0 Listen 80 User nobody Group nobody ServerAdmin root localhost ServerName localhost DocumentRoot mnt had Step 3 Use the following commands to restart the Apache web server cd etc init d apache restart Step4 Open your browser and connect to the UC 7402 by typing the current LANI IP address in the browser s address box HTMLA Test Suite Mozilla Firefox DE Fie Edit View Go Bookmarks Tools Help 3 PN C http192 168 3 1277 v c GL Getting Started 53 Latest Headlines HTML4 Test Suite Content
92. rs Changes are periodically made to the information herein to correct such errors and these changes are incorporated into new editions of the publication Chapter 1 Chapter 2 Chapter 3 Table of Contents tte le EL d EE 1 1 OVEIVIEW ee EES Ee EA Ee es aE 1 2 Package Checklists eee bat p E er Ra m eR teen 1 2 Product Features 5 ioci deett obo eir Ee e dei eed 1 2 Product Hardware Specifications 0 ccecssesecssecseesececseesccneeseceaeeecaecaeesecseeseeneeeeeeas 1 3 Ha rdware Introducti n 52e iom RS RU OE o AER eO RS 1 4 Appearance and Dimensions ssssssssseseseeeeerenr ener nennen nennen 1 4 Hardware Block Duaeram sese enne nennen nennen 1 5 REENEN 1 6 Reset type Buttons ed Eeer d ieri 1 6 Real Tune Clock 3 epe RE ERU E RERO Read 1 7 Placement Options uo eae eer es Eet Ae ee Aisin bite ee biases 1 7 Wall or C bmet 351 2m oo meten Te Seta en m Eder ee eg 1 7 DIN Rail Mounting oi RR Ou he ee n ATE I ea ta 1 8 Hardware Connection Descrp on eene enne rennen enne trennen 1 8 Wianng Requiernents EE 1 8 Connecting the Power 4 3 o egeta Gn UU Rer hes 1 9 Groundmg UC 7402 Sege iia Hae it aie rut ee te eu t b a Es 1 9 Connecting to the Network uum ee rr hee 1 9 Connecting to the Console Port 1 9 PCMCGIA 5 ptenatu ade dmatdtui a D e eto m A ere tp fea 1 10 CompactFlash 4 m cona SU eA e AI n p d o ER i 1 10 Software Introduction 2 p dee Ree ag RR ERR PR PE P Ra Ea 1 10 Software Archi
93. s Backing Up the User File System gt Deploying the User File System to Additional UC 7402 Units Enabling and Disabling Daemons Setting the Run Level Adjusting the System Time Setting the Time Manually gt NTP Client Updating the Time Automatically Cron daemon to Execute Scheduled Commands Connecting Peripherals CF Mass Storage UC 7402 User s Manual Managing Embedded Linux System Version Information NOTE To determine the hardware capability of your UC 7402 and what kind of software functions are supported check the version numbers of your UC 7402 s hardware kernel and user file system Contact Moxa to determine the hardware version You will need the Production S N Serial number which is located on UC 7402 s bottom label To check the kernel version type kversion To check the user file system version type fsversion 192 T1683 127 PHTTY root Moxa kversion JL odis root Moxa fsversion dL dl oS root Moxa The kernel version and user file system version numbers are the same for the factory default configuration and if you download the latest firmware version from Moxa s website and then upgrade UC 7402 s hardware the two version numbers will be the same However to help users define the user file system the kernel and user file system are separate and hence could have different version numbers For this reason we provide two utilities called kversion
94. s 1 HTML Test Suite Documentation Documentation for the HTML4 01 Test Suite 2 HTML Test Suite Assertions Assertions from the W3C HTML 4 01 Specification 3 HTML Test Suite Tests Tests created to test assertions from the W3C HTML 4 01 Specification Feedback regarding the HTML4 Test Suite should be sent to www html testsuite w3 org The HTML Test Suite is an effort of the World Wide Web Consortium based on a contribution Copyright Microsoft Corporation All Rights Reserved 2002 from Microsoft on lad behalf of Microsoft Corporation Openwave Systems Inc and America Online Inc WAT Copyright 2002 2003 w3c All Rights Reserved W3C liability trademark document use and software licensing rules apply Visit the Apache website at http httpd apache org docs for more information about setting up an Apache server UC 7402 User s Manual Managing Communication 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 A rule such as a jump to a user defined chain in the same table is called a target UC 7402 supports 3 types of IPTABLES table Filter tables NAT tables and Mangle
95. shm root Moxa fetc init d StateOPEN Em SS ES E If there isn t enough Available space for your application you will need to delete some existing files To do this connect your PC to the UC 7402 with the console cable and then use the console utility to delete the files from UC 7402 s flash memory If the flash memory is full you will need to free up some memory space before saving files to the Flash ROM Compiling Hello c NOTE The UC 7402 CD contains several example programs Here we use Hello c as an example to show you how to compile and run your applications Type the following commands from your PC to copy the files used for this example from the CD to your computer s hard drive cd tmp mkdir example cp r mnt cdrom example tmp example To compile the program go to the Hello subdirectory and issue the following commands cd example hello make You should receive the following response root localhost hello make usr local mxscaleb bin mxscaleb gcc o hello release hello c usr local mxscaleb bin mxscaleb strip s hello release usr local mxscaleb bin mxscaleb gcc ggdb o hello debug hello c root localhost hello _ Next execute the hello exe to generate hello release and hello debug which are described below hello release an IXP platform execution file created specifically to run on UC 7402 hello debug an IXP platform GDB debug server execution file se
96. side Once established all operations will be performed in that directory Setup 1 Ethernet Bridging for Private Networks on Different Subnets 1 Setup four machines as shown in the following diagram local net OpenVPNA eth1 192 168 2 173 eth0 192 168 2 171 eth0 192 168 8 173 Internet ixp0 192 168 8 174 eth0 192 168 4 172 ixp1 192 168 4 174 OpenVPN B local net 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 moved 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 4 20 UC 7402 User s Manual Managing Communication 2 Generate a preset shared key by typing the command openvpn genkey secret secrouter key Copy the file that is generated to the OpenVPN machine 3 Generate a script file named openvpn bridge on each OpenVPN machine This script reconfigures interface ixp1 as IP less creates logical bridge s and TAP interfaces loads modules enables IP forwarding etc bin sh iface ixpl 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 4 etc sysconfig network scripts ifcfg ixpl
97. side 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 Click on the following link for more information about iptables and NAT http www netfilter org documentation HOWTO NAT HOWTO html NAT Example The IP address of all packets leaving LANI are changed to 192 168 3 127 you will need to load the module ipt MASQUERADE IP Netmask 192 168 3 100 24 Gateway 192 168 3 127 PCI Linux or Windows LANI LANl ixp0 192 168 3 127 24 UC 7402 LAN2 ixpl 192 168 4 127 24 LAN2 PC2 Linux or Windows IP Netmask 192 168 4 100 24 Gateway 192 168 4 127 NAT Area Private IP ehco 1 gt proc sys net ipv4 ip forward modprobe ip tables modprobe ip conntrack modprobe iptable nat modprobe ipt_MASQUERADE iptables t nat A POSTROUTING o ixp0 j SNAT to source 192 168 3 127 Ou fF LA M or 7 iptables t nat A POSTROUTING o ixp0 j MASQUERADE Enabling NAT at Bootup In the most of real world situations you will want to use a simple shell script to enable NAT when UC 7402 boots up The following script is an example bin bash If you put this shell script in the home nat sh Remember to chmod 744 home nat sh Edit the rc local file to make this shell startup automatically vi etc rc d rc local 4 10 UC 7402 User s Manual Managing Commu
98. tecture s UE tet PR Eee tertie tees 1 10 Journaling Flash File System JFFS2 eee 1 11 Software Package 2 4 otn ee HR BART ID rie euin 1 12 Getting Started eee pde ee ete ae Ae Ae 2 1 Powennsion Le EE 2 2 Connecting UC 740210 a PC a ena nia ees Ee EE Ies is 2 2 Serial Console Reess eh ee EE i eH ERE 2 2 Telnet Console eee nee EE REPE RE Herbie E 2 3 SSH Console sineru ae a rei e Or D e HER RE perite 2 4 Configuring the Ethernet Interface essere ener enne enne 2 5 Modifying Network Settings with the Serial Console ess 2 5 Modifying Network Settings over the Network 2 7 Configuring the WLAN via the PCMCIA Interface AA 2 7 IBBES802 LID EE 2 IBEES802 T Ig oii epe pte o RE eR 2 9 Test Program Developing Hello 2 13 Installing the Tool Chain O ammnus enne 2 13 Checking the Flash Memory Space essere eene 2 13 Compiling Hell6ie 25 aine gata en ee RT ER Ir er RR 2 14 Uploading Hello to UC 7402 and Running the Program 2 15 Managing Embedded Linux eeeeeeeeeeeeeeeeeeeeee nennen 3 1 System Version Intormaton eese nete nennen nre nennen nnnn nennen trennt nnne 3 2 System Image Backup ise ct eerta Het e t n dude nee 3 2 Upgrading the Firmware esses ener 3 2 Chapter 4 Chapter 5 Chapter 6 Appendix A Loading Factory D faults egen dessa ae t e reno nem 3 4 Backing Up the User Fil
99. tem 9 1 2 2 object identifier internet 6 3 1 10 system 9 1 2 3 object identifier mib 2 49 11 system 9 1 2 4 object identifier ip 12 system 9 1 2 5 object identifier mib 2 50 13 system 9 1 2 6 object identifier internet 6 3 16 2 2 1 14 system 9 1 2 7 object identifier internet 6 3 10 3 1 1 15 system 9 1 2 8 object identifier internet 6 3 11 3 1 1 16 system 9 1 2 9 object identifier internet 6 3 15 2 1 1 17 system 9 1 3 1 octet string The MIB module to describe generic objects for network interface sub layers 18 system 9 1 3 2 octet string The MIB module for SNMPv2 entities 19 system 9 1 3 3 octet string The MIB module for managing TCP implementations 20 system 9 1 3 4 octet string The MIB module for managing IP and ICMP implementations 21 system 9 1 3 5 octet string The MIB module for managing UDP implementations 22 system 9 1 3 6 octet string View based Access Control Model for SNMP octet string The SNMP Management Architecture MIB octet string The MIB for Message Processing and Dispatching octet string The management information definitions for the SNMP User based Security Model timeticks 0 days 00h 00m 00s 04th 4 timeticks 0 days 00h 00m 00s 09th 9 timeticks 0 days 00h 00m 00s 09th 9 timeticks 0 days 00h 00m 00s 09th 9 timeticks 0 days 00h 00m 00s 09th 9 1 23 system 9 1 3 7 24 system 9 1 3 8 25 system 9 1 3 9 26 system 9 1 4 1 27 system 9 1 4 2 28 system 9 1 4 3 29 s
100. the following usernameGhinet net password H password if you don t use the login option of pppd The mgetty Debian package already provides this option make sure you don t change that INBOUND connections Every regular user can use PPP and has to use passwords from etc passwd R username hinet net password 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 TT master hostname x root hostname support hostname stats hostname OUTBOUND connections Here you should add your userid password to connect to your providers via PAP The means that the password is to be used for ANY host you connect to Thus you do not have to worry about the foreign machine name Just replace password with your password pap secrets line 1 of 42 2 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 6 Editthe file etc ppp options and add the following line plugin pppoe terminated because it was idle tholdoff n Wait for up n milliseconds after the connect script finishes for a valid PPP packet from the peer At the end of this time or when a valid PPP packet is received from the peer pppd will commence negotiation by sending its first LCP packet The default value is 1000 1 second This wait pe
101. 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 ixp0 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 ixp0 p tcp s 192 168 1 0 24 j ACCEPT Example 4 Drop TCP packets from 192 168 1 25 iptables A INPUT i ixp0 p tcp s 192 168 1 25 j DROP Example 5 Drop TCP packets addressed for port 21 iptables A INPUT i ixp0 p tcp dport 21 j DROP Example 6 Accept TCP packets from 192 168 0 24 to UC 7402 s port 137 138 139 iptables A INPUT i ixpO0 p tcp s 192 168 0 24 dport 137 139 j ACCEPT Example 7 Log TCP packets that visit UC 7402 s port 25 iptables A INPUT i ixp0 p tcp dport 25 j LOG Example 8 Drop all packets from MAC address 01 02 03 04 05 06 iptables A INPUT i ixpO0 p all m mac mac source 01 02 03 04 05 06 j DROP NOTE In Example 8 remember to issue the command modprobe ipt mac first to load module ipt mac 4 9 UC 7402 User s Manual Managing Communication NAT NOTE NAT Network Address Translation protocol translates IP addresses used on one network different IP addresses used on another network One network is designated the inside network and the other is the outside network Typically UC 7402 connects several devices on a network and maps local in
102. tly If you use domain name you must enable the domain client on the system by updating 4 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 run the shell script automatically when the kernel boots up Copy the example shell script fixtime to directory etc init d and then use 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 Use the command finit q to re init the kernel Cron daemon to Execute Scheduled Commands Start Cron from the directory etc rc d rc local It will return immediately so you don t need to start it with amp to run the background The Cron daemon will search etc cron d 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 the current 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 Modify the file etc cron d crontab to set up your scheduled applications Crontab files have the following format mm h dom mon dow user command minute hour date month
103. to the CF Card IPTABLES NAT gt Enabling NAT Bootup Dial up Service PPP PPPoE NFS Network File System Setting up UC 7402 as an NFS Server Setting up UC 7402 as an NFS Client Mail SNMP Open VPN UC 7402 User s Manual Managing Communication Telnet FTP DNS In addition to supporting Telnet client server and FTP client server the UC 7402 system also supports SSH and sftp client server To enable or disable the Telnet ftp server you first 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 The default is to enable the Telnet ftp server discard dgram udp wait root bin discard discard stream tcp nowait root bin discard telnet stream tcp nowait root bin telnetd ftp stream tcp nowait root bin ftpd 1 Disabling the Telnet ftp server Disable the daemon by typing in front of the first character of the row to comment out the line UC 7402 supports DNS client but not DNS server To set up DNS client you need to edit three configuration files etc hosts etc resolv conf and etc nsswitch conf etc hosts This is the first file that the Linux system reads to resolve the host name and IP address etc resolv conf This is the most important file that you need to edit when using DNS for the other programs For example before you using ntpdate time nist goc to update the system time you will need to
104. upgrade the file directory Format MTD device dev mtd6 MTD device dev mtd6 erase 128 Kibyte 20000 100 complete Wait to write file Compleleted 100 Now upgrade the new configuration file Upgrade the firmware is OK Please press any key to reboot system ATTENTION After you reboot your UC DO NOT power off the UC until the Ready LED comes back ON Note that after upgrading the firmware the first boot up will take as much as 2 to 3 minutes Loading Factory Defaults The easiest way to load factory defaults is to update the firmware follow the instructions in the previous section to upgrade the firmware Note that if your user file is not working properly the system will mount the Mini File System In this case you will need to load factory defaults to resume normal operation 3 4 UC 7402 User s Manual Managing Embedded Linux Backing Up the User File System 1 Create a backup file The specific commands used to back up the user file system First type the following command to enable the RAM disk upramdisk Next use the file system backup utility provided by Moxa backupuf mnt ramdisk usrfs backup Alternatively you may type the following command to back up the file system to the CF card backupuf mnt hda usrfs backup 2 Once the file system is backed up use FTP to transfer the file usrfs backup to your PC root Moxa upramdisk root Moxa cd mnt ramdisk root Moxa mnt
105. week user command 0 59 0 23 1 31 1 12 0 6 0 is Sunday 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 STEP 1 Write a shell script named fixtime sh and save it to home bin sh ntpdate time nist gov hwclock systohc exit 0 3 10 UC 7402 User s Manual Managing Embedded Linux STEP 2 Change mode of fixtime sh chmod 755 fixtime sh STEP 3 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 home fixtime sh STEP 4 Enable the cron daemon manually etc init d cron start STEP 5 Enable cron when the system boots up Add the following line in the file etc init d rc local etc init d cron start Connecting Peripherals CF Mass Storage The UC 7402 supports PNP and hot pluggability for connecting a CF mass storage device UC 7402 has a built in auto mount utility that eases the mount procedure The CF mass storage device will be mounted automatically by the mount command to mnt hda UC 7402 will be un mounted automatically by umount when you disconnect it 4 Managing Communications In this chapter we explain how to configure UC 7402 s various communication functions The following topics are covered in this chapter LI LI LI Ooo Ooo Telnet FTP DNS Web Service Apache Saving a Web Page
106. y SSID Sets the softAP SSID Setting Any 32 byte string 2 10 UC 7402 User s Manual Getting Started NetworkType Sets the wireless operation mode Setting Explanation Infra Infrastructure mode uses access points to transmit data Adhoc Adhoc mode transmits data from host to host Channel Sets the channel Setting Explanation 0 auto lto 14 the channel you want to use AuthMode Sets the authentication mode Setting OPEN SHARED WPAPSK WPANONE EncrypType Sets encryption type Setting NONE WEP TKIP AES DefaultKeyID Sets default key ID Setting 1 to 4 Key1Str Key2Str Key3Str Key4Str Sets strings Key1 to Key4 Setting The keys can be input as 5 ascii characters 10 hex numbers 13 ascii characters or 26 hex numbers TxBurst WPA pre shared key Setting 8 to 64 ascii characters WpaPsk Enables or disables TxBurst Setting Explanation 0 disable 1 enable UC 7402 User s Manual Getting Started TurboRate Enables or disables TurboRate Setting Explanation 0 disable 1 enable BGProtection Sets 11b 11g protection this function is for engineering testing only Setting Explanation 0 auto 1 always on 2 always off ShortSlot Enables or disables the short slot time Setting Explanat
107. ystem 9 1 4 4 30 system 9 1 4 5 31 system 9 1 4 6 timeticks 0 days 00h 00m 00s 19th 19 32 system 9 1 4 7 timeticks 0 days 00h 00m 00s 22th 22 2 2 ao oe oe oe ee ee ee ee ee ee ee ee ee Se ee 33 system 9 1 4 8 timeticks 0 days 00h 00m 00s 22th 2 34 system 9 1 4 9 timeticks 0 days 00h 00m 00s 22th 2 SNMP QUERY FINISHED 4 19 UC 7402 User s Manual Managing Communication NOTE Click on the following links for more information about MIB II and RS 232 like group http www fags org rfcs rfc1213 html http www fags org rfcs rfc1317 html gt UC 7402 does NOT support SNMP trap The following tables list the variables supported by UC 7402 Open VPN This function is only available for firmware version V1 5 and later versions OpenVPN provides two types of tunnels for users to implement VPNS Routed IP Tunnels and Bridged Ethernet Tunnels Here we describe the second type of tunnel To begin with check to 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 each OpenVPN machine you should generate a working directory such as etc openvpn where script files and key files re

Download Pdf Manuals

image

Related Search

Related Contents

Advanced User`s Guide  Belkin F8N518-189  

Copyright © All rights reserved.
Failed to retrieve file