Moxa UC-7402 manual

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82

Go to page of

A good user manual

The rules should oblige the seller to give the purchaser an operating instrucion of Moxa UC-7402, along with an item. The lack of an instruction or false information given to customer shall constitute grounds to apply for a complaint because of nonconformity of goods with the contract. In accordance with the law, a customer can receive an instruction in non-paper form; lately graphic and electronic forms of the manuals, as well as instructional videos have been majorly used. A necessary precondition for this is the unmistakable, legible character of an instruction.

What is an instruction?

The term originates from the Latin word „instructio”, which means organizing. Therefore, in an instruction of Moxa UC-7402 one could find a process description. An instruction's purpose is to teach, to ease the start-up and an item's use or performance of certain activities. An instruction is a compilation of information about an item/a service, it is a clue.

Unfortunately, only a few customers devote their time to read an instruction of Moxa UC-7402. A good user manual introduces us to a number of additional functionalities of the purchased item, and also helps us to avoid the formation of most of the defects.

What should a perfect user manual contain?

First and foremost, an user manual of Moxa UC-7402 should contain:
- informations concerning technical data of Moxa UC-7402
- name of the manufacturer and a year of construction of the Moxa UC-7402 item
- rules of operation, control and maintenance of the Moxa UC-7402 item
- safety signs and mark certificates which confirm compatibility with appropriate standards

Why don't we read the manuals?

Usually it results from the lack of time and certainty about functionalities of purchased items. Unfortunately, networking and start-up of Moxa UC-7402 alone are not enough. An instruction contains a number of clues concerning respective functionalities, safety rules, maintenance methods (what means should be used), eventual defects of Moxa UC-7402, and methods of problem resolution. Eventually, when one still can't find the answer to his problems, he will be directed to the Moxa service. Lately animated manuals and instructional videos are quite popular among customers. These kinds of user manuals are effective; they assure that a customer will familiarize himself with the whole material, and won't skip complicated, technical information of Moxa UC-7402.

Why one should read the manuals?

It is mostly in the manuals where we will find the details concerning construction and possibility of the Moxa UC-7402 item, and its use of respective accessory, as well as information concerning all the functions and facilities.

After a successful purchase of an item one should find a moment and get to know with every part of an instruction. Currently the manuals are carefully prearranged and translated, so they could be fully understood by its users. The manuals will serve as an informational aid.

Table of contents for the manual

  • Page 1

    UC-7402 User ’ s Manual Fourth Edition, February 2009 www .moxa.com/product © 2009 Moxa Inc. All righ ts reserved. Reproducti on without perm ission is pr ohibited.[...]

  • Page 2

    UC-7402 User’s Manual The software d escribed in thi s manual i s furnished u nder a license agreem ent and m ay be used only in accordance with the term s of that agreement. Copyright Notice Copyright © 2009 Moxa Inc. All rights reserved. Reproducti on without perm ission is pr ohibited. Trademarks MOXA is a re gistered tra demark of M oxa Inc.[...]

  • Page 3

    Table of Contents Chapter 1 Introduction .................................................................................................. 1-1 Overview.................................................................................................................................. 1-2 Package Ch ecklis t............................................[...]

  • Page 4

    Loading Factor y Defa ults ........................................................................................... 3-5 Enabling and Disa bling Daem ons ............................................................................................ 3-5 Setting the Ru n-Level ..........................................................................[...]

  • Page 5

    1 1 Chapter 1 Introduction Moxa UC-7402 is a web server embedd ed network computer that features dual 10/100 Mbps Ethernet ports, a PCMCIA interface for wire less LAN comm unication, and CompactFlash for mass storage disk expansi on. UC-74 02 is an excell ent choice f or embedded network ap plications and diverse M 2M soluti ons. UC-7402 is a rugge[...]

  • Page 6

    UC-7402 User’s Manual Introduction 1-2 Overview Moxa UC-7402, a web server embedded n etwork computer features dual 10 /100 Mbps Ethernet ports, a PCMCIA interface for wireless L AN co mmunication a nd CompactFlash for m ass storage disk expansio n. UC-7402 uses an Intel XScale IX P422 266 Mhz RISC CPU . Unlike th e X86 CPU, which u ses a CISC de[...]

  • Page 7

    UC-7402 User’s Manual Introduction 1-3 Product Hardware Specifications UC-7402-L X CPU Intel Xscale IXP422, 266 MHz RAM 128 MB Flash 32 MB LAN Auto-sensi ng 10/100 M bps x 2 LAN Protecti on Built-in 1.5 KV magnetic isolation Serial Console/PPP RS-232 x 1, RJ45 USB 1.1 Clie nt 1 PCMCIA PCMCIA type I/II socket x 1 Compact Flash CompactFlash type I/[...]

  • Page 8

    UC-7402 User’s Manual Introduction 1-4 Hardware Introduction Appearance and Dimensions Appearance UC-7402 Rear View DC 12-48V LAN1 LAN2 Console V+ V- PCMCIA CF 12-48 VDC Power Input CF x 1 PCMCIA x 1 10/100 Mbps Ethernet x 2 USB 1.1 Client x 1, miniB Connector RS-232 PPP/Console UC-7402 Top View UC-7402 Front Vie w Reset Reset to Default Hardware[...]

  • Page 9

    UC-7402 User’s Manual Introduction 1-5 Dimensions 197 mm [7.76"] 125 mm [4.92"] 44 mm [1.73"] Hardware Block Diagram The following block diagram shows the layou t of UC-7402’s internal componen ts. PCMCIA & CompactFlash Console PHY PHY PCI Bus RTC USB Client PCI to cardbus Bridge Xscale IXP-422 266 MHz 32 MB Flash 128 MB SDRA[...]

  • Page 10

    UC-7402 User’s Manual Introduction 1-6 LED Indicators UC-7402 has 4 LED indicator s on the top pa nel. Re fer to the following table for information about each LED. LED Name Color Meaning Ready Green Power is ON, and syst em is ready (after boot ing up) Yellow 10 Mbps Ether net connection LAN1, LAN2 Green 100 Mbps Et hernet co nnection Yellow Con[...]

  • Page 11

    UC-7402 User’s Manual Introduction 1-7 Real Time Clock UC-7402’s real time clock is powered by a lith iu m battery. We strongly recommend that you do not replace the lithium battery without help from a qu alified Moxa support engi neer. If y ou need to change the battery, contact M oxa RMA serv ice team. WARNING There is a risk of explosi on if[...]

  • Page 12

    UC-7402 User’s Manual Introduction 1-8 DIN-Rail Mounting The aluminum DIN-Rail attachm ent plate is included in the package. If you need to reattach the DIN-Rail attachment plate to UC-7402, make sure t h e stiff metal spring is situated towards th e top, as shown in the figures below. 1. Insert the top of the DIN-Rail into the slot just below th[...]

  • Page 13

    UC-7402 User’s Manual Introduction 1-9 You should al so observe the following comm on wiring rule s: y Use separate p aths to route wiring for power and devi ces. If powe r wiring and device wiri ng paths must cross, m ake sure the wires are perpendicular at t he intersection point. NOTE: Do not run signal o r communicati on wiring and power wi r[...]

  • Page 14

    UC-7402 User’s Manual Introduction 1-10 Connecting to the Network Connect one end of the Ethernet cab le to one of UC-7402’s 10/100M Ethern et ports (8-pin RJ45) and the other end of t he cable to the Ethernet ne twork. If the cable is properly connected, UC-7402 will indicate a valid connection to the Ethernet in the following ways: The bottom[...]

  • Page 15

    UC-7402 User’s Manual Introduction 1-11 Software Introduction Software Architecture The Linux operating system that is pre-installed in UC-7402 follows the standard Linux architecture, making it easy to po rt programs that follow the POSIX standard to UC-7402. Porting is done wit h the GNU Tool Chain provided by Moxa. In a ddition t o the Standa [...]

  • Page 16

    UC-7402 User’s Manual Introduction 1-12 Normally, the kernel uses t he User Root File System to boot up the system. T he Mini Root File System is protected, and cannot be ch anged by the user, providing a “safe” zone. The kernel will only use t he Mini Root File System when the User Root File System crashes. For more infor mation about the m [...]

  • Page 17

    UC-7402 User’s Manual Introduction 1-13 Software Package Boot Loader Redboot (V1.92) Kernel MontaVist a embedded Linux 2. 4.18 Protocol S tack ARP, PPP, CHAP, PAP, IPv4, ICMP, TCP, UDP, DHCP, FTP, SNMP V1, HTTP, NTP, NFS, SMTP, SSH 1.0/2. 0, SSL, Telnet, PP PoE, OpenVPN File System JFFS2, NFS, Ext2, E xt3, VFAT/FAT OS shell command bash Busybox L[...]

  • Page 18

    2 2 Chapter 2 Getting Started In this chapter, we explain how to connect UC-740 2, turn on the power, an d then get started using the program ming and othe r function s. The following topics are covered in this chapter:  Powering on UC-7402  Connec ting UC-740 2 to a PC ¾ Serial Console ¾ Telnet C onsole ¾ SSH C onsole  Configuring the [...]

  • Page 19

    UC-7402 User’s Manual Getting Started 2-2 Powering on UC-7402 Connect the SG wire to the Shielded Con tact 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 second s for the system to boot up. Once t he system is read y, the Ready LED will light up, and the Ne[...]

  • Page 20

    UC-7402 User’s Manual Getting Started 2-3 Telnet Console If you know at least one of the tw o IP addresses an d netmasks, then you can use Telnet to connect to UC-7402’s console utility. The default IP addr ess and Netmask for each of th e two ports are given belo w: Default IP Address Netmask LAN 1 192.168.3.127 255.255.255 .0 LAN 2 192.168.4.[...]

  • Page 21

    UC-7402 User’s Manual Getting Started 2-4 ATTENTION Serial Console Reminder Remember to choose VT100 as the terminal type. Use cable C BL-RJ45F9-15 0, which com es with UC-7402, to connect to the serial console port. Telnet Reminder When conn ecting to UC-7402 over a LAN, you must configur e your PC’s Ethernet IP address to be on the same subne[...]

  • Page 22

    UC-7402 User’s Manual Getting Started 2-5 Linux Users From a Linux machine, use t he “ssh” command to access UC-7402’s Co nsole utility via SSH. #ssh 192.168.3.127 Select yes to complete the connection. [root@bee_notebook root]# ssh 192.168.3.127 The authenticity of host ‘192.168.3.127 (192.168.3.127)’ can’t be established. RSA key fi[...]

  • Page 23

    UC-7402 User’s Manual Getting Started 2-6 Dynamic IP addresses : By default, UC-7402 is configu red for “static” IP addresses. To conf igure one or both LAN ports to request an IP a ddress dynami cally, replace static with dhcp and then delete the address, network , netmask, and broa dcast lines. Default Setting for LAN1 Dynamic Setting using[...]

  • Page 24

    UC-7402 User’s Manual Getting Started 2-7 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, bu t the new settings will no t be saved to the flash ROM without modifying the file /etc/network/interfaces . [...]

  • Page 25

    UC-7402 User’s Manual Getting Started 2-8 Edit network.opts with the following command to edit Wireless LAN’s default setting. #vi /etc/pcmcia/network.op ts 3. Configur e the Wireless LAN card’s default SSID setting profile. (Default SSID is “any”) #vi /etc/wlan/wlan.conf // Consult your netw ork administrator for SSI D required in your w[...]

  • Page 26

    UC-7402 User’s Manual Getting Started 2-9 IEEE802.11g The following I EEE802.11g wireless modules are supported: y ASUS — WL-1 07g y CNET — CWC-8 54 (181D ve rsion) y Edmiax — EW-7108PCg y Amigo — AWP-914W y GigaByte — GN-WMGK y Other brands that use the Ralin k RT2560 series chip set To configu re the WLAN for IEEE802. 11g: 1. Unplug t[...]

  • Page 27

    UC-7402 User’s Manual Getting Started 2-10 3. Additional WLAN parameters are contained in the file RT2500STA.dat . To open the file, navigate to t he RT2500ST A folder a nd invoke vi, or type t he followi ng comma nd #vi /etc/Wireless/RT2500STA/RT2500STA.dat to edit the file with vi editor. Settin g options for the various parameters are listed b[...]

  • Page 28

    UC-7402 User’s Manual Getting Started 2-11 SSID —Sets the softAP SSID Setting Any 32-byte string NetworkT ype —Sets the wireless operation mode Setting Explanation Infra Infrastructure mode (uses acc ess points to transmit data) Adhoc Adhoc m ode (transm its data from host to host ) Channel —Sets the channel Setting Explanation 0 auto 1 to [...]

  • Page 29

    UC-7402 User’s Manual Getting Started 2-12 WpaPsk —Enabl es or disables TxBurst Setting Explanation 0 disable 1 enable T urboR ate —Enables or disables T u rboRate Setting Explanation 0 disable 1 enable BGProtection —Sets 1 1b/1 1g protection (t his function i s for e ngineering t esting only ) Setting Explanation 0 auto 1 always on 2 alway[...]

  • Page 30

    UC-7402 User’s Manual Getting Started 2-13 R TSThr eshold —Sets the R TS threshold Setting 1 to 2347 FragThr eshol d —Sets the fragm ent threshold Setting 256 to 23 46 Test Program — Developing Hello.c In this section, we use the standard “Hello” programming example to illu strate how to develop a program for UC-7402. I n general, progr[...]

  • Page 31

    UC-7402 User’s Manual Getting Started 2-14 Checking the Flash Memory Space If the flash mem ory is full, you will not be able to save data to the Flash ROM. Use the following command to ca lculate the am ount of “Avai lable” flas h memory: />df –h If there isn’t enough “Available” space for you r application, you will need to delet[...]

  • Page 32

    UC-7402 User’s Manual Getting Started 2-15 NOTE Be sure to type the #make comm and from wit hin the /tmp/example/hello directory, since UC’s tool chain p uts a specially desi gned Makefile in that directory. This special Makefile uses t he mxscale-gcc compiler to com pile th e hello.c source code for the Xs cale environment. If y ou type the #m[...]

  • Page 33

    3 3 Chapter 3 Managing Embedded Linux This chapte r includes inf ormati on about vers ion contr ol, deploym ent, upda tes, and peri pherals. The information in this chapter will be particu larly useful when you need to run the same application on several UC-7402 un its. The following topics are covered in this chapter:  System Version Informatio[...]

  • Page 34

    UC-7402 User’s Manual Managing Embedded Linux 3-2 System Version Information To determine the hardw are capability o f your UC-7402, and what kind of software fu nctions are supported, c heck the ve rsion num bers of your UC -7402’s har dware, kern el, and user fil e system . Contact Moxa to determine the hardware version. You will need the Pro[...]

  • Page 35

    UC-7402 User’s Manual Managing Embedded Linux 3-3 Since different Flash disks have different sizes, it’ s a good idea to check the size of your Flash disk before upgrading the firmware, o r before using the disk to store your application and data files. Use the #df –h command to list the size of each memory block, and how m uch free space is [...]

  • Page 36

    UC-7402 User’s Manual Managing Embedded Linux 3-4 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) ftp> 3. Next, use the upfirm command to upgrade the kernel an d root file system: #upfirm UC7402-x.x[...]

  • Page 37

    UC-7402 User’s Manual Managing Embedded Linux 3-5 Loading Factory Default s The easiest way to load factory defaults is to up date th e firmware (follow the instructions in the previous section to u pgrade the firm ware). Note that if y our use r file is n ot working p roperly, the sy stem wi ll mount the M ini File S ystem. In this case, you wil[...]

  • Page 38

    UC-7402 User’s Manual Managing Embedded Linux 3-6 Type the command “ps –ef” to list all pro cesses currently running. 192.168.3.127 – PuTTY root@Moxa:~# cd /etc root@Moxa:/etc# ps -ef PID Uid VmSize Stat Command 1 root 1296 S init 2 root S [keventd] 3 root S [ksoftirqd_CPU0] 4 root S [kswapd] 5 root S [bdflush] 6 root S [kupdated] 7 root [...]

  • Page 39

    UC-7402 User’s Manual Managing Embedded Linux 3-7 Then you will find the enab led daemons after you reboot the system. 192.168.3.127 – PuTTY root@Moxa:~# ps -ef PID Uid VmSize Stat Command 1 root 1296 S init 2 root S [keventd] 3 root S [ksoftirqd_CPU0] 4 root S [kswapd] 5 root S [bdflush] 6 root S [kupdated] 7 root S [mtdblockd] 8 root S [khubd[...]

  • Page 40

    UC-7402 User’s Manual Managing Embedded Linux 3-8 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 follow ing comm and to enable or disable settings: 192.168.3.127 – PuTTY root@Moxa:/ect/rc.d/rc3.d# ls S19nfs-common S25nfs-user-server S99showreadyled S20snmpd S[...]

  • Page 41

    UC-7402 User’s Manual Managing Embedded Linux 3-9 Adjusting the System Time Setting the T ime Manually UC-7402 has two time settings. One is the syste m time, and the other is the RTC (Real Time Clock) tim e kept by the UC-7402 ha rdware. Use t he #dat e command to query t he current system time or set a ne w system time. Use #hwclock to query th[...]

  • Page 42

    UC-7402 User’s Manual Managing Embedded Linux 3-10 NTP Client UC-7402 has a built-in NTP (Network Time Protocol) client that is used to initialize a time req uest to a remote NTP server. Use #ntpdate < this client utility > to update the system time. #ntpdate time.stdtime.gov.tw #hwclock –w Visit http://www.ntp.org fo r more information a[...]

  • Page 43

    UC-7402 User’s Manual Managing Embedded Linux 3-11 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 ‘&’ to run th e background. The Cron daemon will search /etc/cron.d/crontab for cronta b files, which are named aft er accounts i[...]

  • Page 44

    4 4 Chapter 4 Managing Communications In this chapt er, we ex plain how to configure UC -7402’s va rious comm unication functions. The following topics are covered in this chapter:  Telnet / FTP  DNS  Web Service—Apache ¾ Saving a W eb Page to the CF Card  IPTABLES  NAT  NA T Example ¾ Enabling NA T at B ootup  Dial-up Se[...]

  • Page 45

    UC-7402 User’s Manual Managing Communication 4-2 Telnet / FTP In addition to suppo rting Telnet client/server an d 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 [...]

  • Page 46

    UC-7402 User’s Manual Managing Communication 4-3 Web Service—Apache The Apache web server’s main co nfiguration file is /etc/apache/httpd.conf , with the default homepage loca ted at /usr/www/html/index.html . Save your own hom epage to the following directory: /usr/www/html/ Save your CGI page to the f ollowing direct ory: /usr/www/cgi-bin/ [...]

  • Page 47

    UC-7402 User’s Manual Managing Communication 4-4 To open the de fault CGI te st script re port page, ty pe http://192.168.3.127 /cg i-bin/test-cgi in your browser’s address box. NOTE The CGI functi on is enabl ed by defa ult. If yo u want to di sable the functi on, modi fy the file /etc/apache/httpd.conf . When you devel op your own CGI applica[...]

  • Page 48

    UC-7402 User’s Manual Managing Communication 4-5 Saving a W eb 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 r un the homepage a nd other pages from the CF ca rd. In this sect ion, we use a si mple example to illustrate how to save web pages to the CF card, and then[...]

  • Page 49

    UC-7402 User’s Manual Managing Communication 4-6 Step 3: Use the follow ing comm ands to restart the Apache web server: #cd /etc/init.d #./apache restart Step4: Open your br owser and conn ect to the UC-7 402 by typin g the current LA N1 IP address i n the browser’s address box. NOTE Visit the Apache website at http://httpd.ap ache.org/docs/ fo[...]

  • Page 50

    UC-7402 User’s Manual Managing Communication 4-7 Source NAT (SNAT) — changes the first source packet IP address Destination NAT (DNAT) — changes the first destination packet IP a ddress MASQUERA DE — a special form for SNAT. If o ne hos t can connect to internet, th en other computers that c onnect to this host can connect to the Internet w[...]

  • Page 51

    UC-7402 User’s Manual Managing Communication 4-8 UC-7402 s upports the following sub-modul es. Be sure to use the m odule that m atches your application. ip_conntrack ipt_ MARK ipt_ah ipt_state ip_conntrack_ftp ip t_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[...]

  • Page 52

    UC-7402 User’s Manual Managing Communication 4-9 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 incl uded: INPUT, OUT PUT, and FORWARD. INPUT chains are acce pted automatically, and all connections ar e accepted without being filtered. #iptables ?[...]

  • Page 53

    UC-7402 User’s Manual Managing Communication 4-10 Example 3: Ac cept TCP pack ets from Cl ass C network 1 92.168.1.0/24. # iptables –A INPUT –i ixp0 –p tcp –s 192.168.1.0/24 –j ACCEPT Example 4: D rop TCP pac kets from 192. 168.1.25. # iptables –A INPUT –i ixp0 –p tcp –s 192.168.1.25 –j DROP Example 5: Dr op TCP packets ad dre[...]

  • Page 54

    UC-7402 User’s Manual Managing Communication 4-11 1. #ehco 1 > /proc/sys/net/ipv4/ip_forward 2. # modprobe ip_tables 3. # modprobe ip_conntrack 4. # modprobe iptable_nat 5. # modprobe ipt_MASQUERADE 6. #iptables -t nat –A POSTROUTING –o ixp0 –j SNAT --to-source 192.168.3.127 or 7. #iptables –t nat –A POSTROUTING –o ixp0 –j MASQUE[...]

  • Page 55

    UC-7402 User’s Manual Managing Communication 4-12 The pppd daem on is used to connect to a PPP se rver from a Linux syste m. For detai led informati on about pppd see t he man page. Example 1: Connecting to a PPP server over a simple dial-up connection The followin g command is used to con nect to a PPP serve r by modem . Use this com mand for ol[...]

  • Page 56

    UC-7402 User’s Manual Managing Communication 4-13 192.1.1.17 This is a de generate case of a general option of t he 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 conn ection. If this option is no t specified, or if just one side is specified, t hen x.x.x.x de faults to the[...]

  • Page 57

    UC-7402 User’s Manual Managing Communication 4-14 Try typing: netstat -nr This should show three routes, so mething 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 ppp0 127.0.0. 0 0.0.0. 0 255.0.0.0 U 0 0 0 lo 0.0.0.0 12 9.67.1. 165 0.0.0.0 UG 0 0 6298 ppp0 If[...]

  • Page 58

    UC-7402 User’s Manual Managing Communication 4-15 4. Edit the file /etc/ppp/chap-secrets and add the following: “username@hinet. net” * “password” * “username@hinet.net” is t he username obtai ned from the ISP to log in to the ISP account. “password” is the corresponding password for the account. 5. Edit the file /etc/ppp/pap-secr[...]

  • Page 59

    UC-7402 User’s Manual Managing Communication 4-16 6. Edit the file /etc/ppp/options and add the following line: plugin pppoe 7. Add one of two files: /etc/ppp/options.ixp0 or /etc/ppp/options.ixp1 . The choice depends on which LAN is connected to t he ADSL modem . If you use LAN1 to connect to the ADSL modem , then add /etc/ppp/options.ixp0 . If [...]

  • Page 60

    UC-7402 User’s Manual Managing Communication 4-17 8. Set up DNS If you are using DNS servers supplied by your ISP, edit the file /etc/resolv.con f by adding t he followi ng line s of code: nameserver ip_addr_of_first_dns _server nameserver ip_addr_o f_second_dns _server For example: nameserver 16 8.95.1.1 nameserver 139.175.1 0.20 9. Use the fo l[...]

  • Page 61

    UC-7402 User’s Manual Managing Communication 4-18 optionx x The option list for a machine descri bes the ki nd 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 machin e will have the same level of access [...]

  • Page 62

    UC-7402 User’s Manual Managing Communication 4-19 Setting up UC-7402 as an NFS Client The followin g procedure is used to m ount a remote NFS Server. 1. Scan the NFS Server’s shared directory. 2. Establish a mount point on the NFS Cli ent site. 3. Moun t the remote director y to a local directory. Step 1: #showmount –e HOST showmount: Show th[...]

  • Page 63

    UC-7402 User’s Manual Managing Communication 4-20 SNMP UC-7402 has built-in SNMP V1 (Simple Networ k Management Pro tocol) agent software. It supports RFC1317 RS-2 32 like group and RFC 1213 MI B-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.[...]

  • Page 64

    UC-7402 User’s Manual Managing Communication 4-21 The following tables list the variables supported by UC-7402. Open VPN This function is o nly available for firm ware version V1. 5 (and later version s). OpenVPN provides two types of tunn els for users to implement VPNS: Routed IP Tu nnels and Bridged Ethernet Tunnels . Here we descri be the sec[...]

  • Page 65

    UC-7402 User’s Manual Managing Communication 4-22 3. Generate a script fil e named openvpn-bridge on each OpenVPN machine. This scri pt reconfigures interface “ixp1” as IP-less, crea tes logical bridge(s) an d TAP interfaces, loads modules, e nables IP forwa rding, etc. #---------------------------------Start----------------------------- #!/b[...]

  • Page 66

    UC-7402 User’s Manual Managing Communication 4-23 { ifcfg_vpn if [ ! ( -d “/dev/net” ) ]; then mkdir /dev/net fi if [ ! ( -r “/dev/net/tun” ) ]; then # create a device file if there is none 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[...]

  • Page 67

    UC-7402 User’s Manual Managing Communication 4-24 brctl delbr br0 ifconfig br0 down ifconfig $iface $IPADDR netmask $NETMASK broadcast $BROADCAST killall -TERM openvpn } case “$1” in start) start ;; stop) stop ;; restart) stop start ;; *) echo “Usage: $0 [start|stop|restart]” exit 1 esac exit 0 #---------------------------------- end ----[...]

  • Page 68

    UC-7402 User’s Manual Managing Communication 4-25 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& # openvpn --config B-tap0-br.conf& [...]

  • Page 69

    UC-7402 User’s Manual Managing Communication 4-26 Setup 2: Ethernet Bridging for Pr ivate Networks on the Same Subnet 1. Set up four m achines as sho wn in the following diagram: OpenVPN A OpenVPN B Host A eth0: 192.168.2.171 Host B eth0: 192.168.2.172 ixp0: 192.168.8.174 eth1: 192.168.2.173 local net local net Internet Internet ixp1: 192.168.2.1[...]

  • Page 70

    UC-7402 User’s Manual Managing Communication 4-27 2. Creat e a configuration file nam ed “A-tun.conf” and an execut able script file nam ed “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 u[...]

  • Page 71

    5 5 Chapter 5 Programmer’s Guide This chapter includes importan t information for programmers. This following functions are covered in this chapter:  Flas h Memo ry Map  Linux Tool Chai n Introducti on  Debugging with GDB  Device API  RTC (Real Time Clock)  Buzzer  WDT (Watch Do g Timer)  Make File Example[...]

  • Page 72

    UC-7402 User’s Manual Programmer’s Guide 5-2 Flash Memory Map Partition sizes are hard coded into th e kernel bina ry. To chang e the partition sizes, you will need to rebuild the kernel. The flash memory map is shown in the following table. Address Size Contents 0x00000000 – 0x0005FFFF 384 KB Boot Loa der—Read ONLY 0x00060000 – 0x0015FFF[...]

  • Page 73

    UC-7402 User’s Manual Programmer’s Guide 5-3 Obtaining help Use the Linux man utility to obtain help on many of the utilities provid ed by the tool chain. For example to get help on the armv5b-linux-gcc com piler, issue the command: #man armv5b-linux-gcc Cross Compiling Applications and Libraries To compile a simple C application , just use the[...]

  • Page 74

    UC-7402 User’s Manual Programmer’s Guide 5-4 Uninstalling the Linux Tool Chain Use the command rpm –qa|grep m xscaleb to query if the Moxa tool chain is installed on the system. Use the command rpm -e mxscal e-x.x.x-x t o uninstal l the Moxa Xscale t ool chain.[...]

  • Page 75

    UC-7402 User’s Manual Programmer’s Guide 5-5 Debugging with GDB First compile the program must with option -ggdb. Use the following steps: 1. To de bug a pro gram called hello-debug on the target, use t he command: #gdbserver 192.168.4.142:2000 hello-debug This is where 2000 is the network port number on which the serv er waits for a connection[...]

  • Page 76

    UC-7402 User’s Manual Programmer’s Guide 5-6 Buzzer The device node is located at /dev/console . UC-7402 supports Linux stan dard buzzer co ntrol, with UC-7402’s buzzer runni ng at a fixe d frequency of 100 Hz. Yo u must include <sys/kd.h> . 1. Funct ion: KDMKTONE ioctl(fd, KDMKTONE, unsigned int arg); Description: The buzzer’ s behav[...]

  • Page 77

    UC-7402 User’s Manual Programmer’s Guide 5-7 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 peri odically. Yo u must ack the sWatchDog before ti[...]

  • Page 78

    UC-7402 User’s Manual Programmer’s Guide 5-8 int swtd_ack(int fd) Description: Acknowledge sWatchDog. When the user appli cation enable sWatchDog. It need to ca ll this function periodically with user predefined time in the application prog ram. Input : int fd - the file handle from swtd_open() return value. Output: OK will be zero. The other h[...]

  • Page 79

    UC-7402 User’s Manual Programmer’s Guide 5-9 ….. …. swtd_ack(fd); ….. …. } swtd_close(fd); exit(0); } The makefile is shown below: all: mxscaleb-gcc –o xxxx xxxx.c –lmoxalib Example 2: #include <stdio.h> #include <stdlib.h> #include <signal.h> #include <string.h> #include <sys/stat.h> #include <sys/i[...]

  • Page 80

    UC-7402 User’s Manual Programmer’s Guide 5-10 ….. ….. ….. // end user application kill(sonpid, SIGUSR1); 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 ar e copied fro m the Hello e xample on UC -7402’s CD-ROM. CC = /u[...]

  • Page 81

    A A Appendix A System Commands Linux normal command utility collection File manager 1. cp c o p y f i l e 2. ls list file 3. ln make symbolic link file 4. mount mount an d check fi le system 5. rm delete file 6. chmod change file owner & gr oup & user 7. chown c h a n g e f i l e o w n e r 8. chgrp c h a n g e f i l e g r o u p 9. sync sync[...]

  • Page 82

    UC-7402 User’s Manual System Commands A-2 Process 1. kill kill process 2. ps display now running process Other 1. dmesg dump kernel log message 2. sty t o s e t s e r i a l p o r t 3. zca t dump .gz file context 4. mknod make device node 5. free display system memory usage 6. date print or set the system date and time 7. env run a program in a mo[...]