background image

DA-660-8/16-LX User’s Manual 

Managing Communications 

 

4-12

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’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/ttyM0 19200 crtscts 

If a username and password are 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/ttyM0 19200 crtscts 

Checking the connection 

Once you have set up a PPP connection, there are some steps that 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. ppp0 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. The output is similar to the following: 

lo 

Link encap Local Loopback 
inet addr 127.0.0.1 

Bcast 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 

ppp0 

Link encap Point-to-Point Protocol 
inet addr 192.76.32.3 

 

P-t-P 129.67.1.165 

Mask 255.255.255.0 

UP POINTOPOINT RUNNING 

MTU 1500  

Metric 1 

RX packets 33 errors 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. The output is similar to the 
following: 

waddington:~$p ping 129.67.1.165 
PING 129.67.1.165 (129.67.1.165): 56 data bytes 
64 bytes from 129.67.1.165: icmp_seq=0 ttl=225 time=268 ms 
64 bytes from 129.67.1.165: icmp_seq=1 ttl=225 time=247 ms 
64 bytes from 129.67.1.165: icmp_seq=2 ttl=225 time=266 ms 
^C 
--- 129.67.1.165 ping statistics --- 
3 packets transmitted, 3 packets received, 0% packet loss 

Summary of Contents for ThinkCore DA-660-16-LX

Page 1: ...DA 660 8 16 LX User s Manual Seventh Edition February 2009 www moxa com product 2009 Moxa Inc All rights reserved Reproduction without permission is prohibited...

Page 2: ...s 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 accurat...

Page 3: ...ng and Running the Hello Program 2 8 Developing Your First Application 2 9 Testing Environment 2 9 Compiling tcps2 c 2 9 Uploading and Running the tcps2 release Program 2 10 Testing Procedure Summary...

Page 4: ...s Guide 5 1 Flash Memory Map 5 2 Linux Tool Chain Introduction 5 2 Debugging with GDB 5 3 Device API 5 4 RTC Real Time Clock 5 4 Buzzer 5 4 WDT Watch Dog Timer 5 5 UART 5 9 LCM 5 10 KeyPad 5 11 Makefi...

Page 5: ...atforms Features include RS 232 422 485 serial ports and dual 10 100 Mbps Ethernet ports making the DA 660 ideal for your embedded applications The following topics are covered in this chapter Overvie...

Page 6: ...ted to the computer with a GNU cross compiler without needing to modify the source code The OS device drivers e g Keypad LCM and Buzzer control and your own applications can all be stored in the NOR F...

Page 7: ...h memory transparent to the user The Journaling Flash File System JFFS2 which was developed by Axis Communications in Sweden places a file system directly on the flash instead of emulating a block dev...

Page 8: ...AT 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...

Page 9: ...ial Console Telnet Console SSH Console Configuring the Ethernet Interface Modifying Network Settings with the Serial Console Modifying Network Settings over the Network Test Program Developing Hello c...

Page 10: ...e DA 660 to a PC There are two ways to connect the DA 660 to a PC through the serial Console port or by using Telnet over the network Serial Console The serial console port gives users a convenient wa...

Page 11: ...C 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 s...

Page 12: ...le example of the configuration that is required Linux Users From a Linux machine use the ssh command to access the DA 660 s Console utility via SSH ssh 192 168 3 127 Select yes to complete the connec...

Page 13: ...dcast The default IP addresses are 192 168 3 127 for LAN1 and 192 168 4 127 for LAN2 with a default netmask of 255 255 255 0 We always want the loopback interface auto eth0 eth1 lo iface lo inet loopb...

Page 14: ...ying the file etc network interfaces For example type the command ifconfig eth0 192 168 1 1 to change the IP address of LAN1 to 192 168 1 1 root Moxa ifconfig eth0 192 168 1 1 root Moxa Test Program D...

Page 15: ...ain 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 NOTE R...

Page 16: ...low hello release an IXP platform execution file created specifically to run on the DA 660 hello debug an IXP platform GDB debug server execution file see Chapter 5 for details about the GDB debug too...

Page 17: ...and PC 2 over an Ethernet connection RS 232 LAN PC 2 PC 1 Write data to PC1 Receive LAN data Read serial data Send data to PC2 tcps2 c Serial Rx Buffer LAN Rx Buffer Compiling tcps2 c The source code...

Page 18: ...ot root 4996 Nov 27 12 03 tcps2 release rw r r 1 root root 4554 Nov 27 11 52 tcps2 c rwxr xr x 1 root root 26823 Nov 27 12 03 tcpsp debug rwxr xr x 1 root root 5396 Nov 27 12 03 tcpsp release rw r r 1...

Page 19: ...release 226 Transfer complete ftp 3 From the DA 660 type chmod x tcps2 release tcps2 release 192 168 3 127 PuTTY root Moxa ls al drwxr xr x 2 root root 0 Jun 12 02 14 drwxr xr x 15 root root 0 Jan 1 1...

Page 20: ...8 S usr sbin inetd 52 root 4464 S usr sbin httpd 53 nobody 4480 S usr sbin httpd 54 nobody 4480 S usr sbin httpd 64 nobody 4480 S usr sbin httpd 65 nobody 4480 S usr sbin httpd 66 nobody 4480 S usr sb...

Page 21: ...ng environment is illustrated in the following figure However note that there are limitations to the example program tcps2 c tcps2 c RS 232 LAN PC 2 PC 1 Write data to PC1 Receive LAN data Read serial...

Page 22: ...run the same application on several DA 660 units The following topics are covered in this chapter System Version Information System Image Backup Upgrading the Firmware Loading Factory Defaults Enabli...

Page 23: ...ason we provide two utilities called kversion and fsversion that allow you to check the version numbers of the kernel and file system respectively System Image Backup Upgrading the Firmware The DA 660...

Page 24: ...e firmware file da660 x x x frm from the PC to the DA 660 mnt ramdisk ftp destination PC s IP Login Name xxxx Login Password xxxx ftp bin ftp get da660 x x x frm 192 168 3 127 PuTTY root Moxa mnt ramd...

Page 25: ...device dev mtd3 MTD device dev mtd3 erase 128 Kibyte 1a0000 100 complete Wait to write file Completed 100 Now upgrade the file directory Format MTD device dev mtd6 MTD device dev mtd6 erase 128 Kibyt...

Page 26: ...8 root 4044 S usr sbin snmpd s l dev null 110 root 2828 S usr sbin snmptrapd s 139 root 1364 S sbin cardmgr 143 root 1756 S usr sbin rpc nfsd 145 root 1780 S usr sbin rpc mountd 152 root 2960 S usr sb...

Page 27: ...l dev null 111 root 2832 S usr sbin snmptrapd s 140 root 1364 S sbin cardmgr 144 root 1756 S usr sbin rpc nfsd 146 root 1780 S usr sbin rpc mountd 153 root 2960 S usr sbin sshd 161 root 1272 S bin re...

Page 28: ...umber 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 rm f etc rc...

Page 29: ...stdtime gov tw 9 Dec 10 58 53 ntpdate 207 step time server 220 130 158 52 offset 155905087 984256 sec root Moxa hwclock w root Moxa date hwclock Thu Dec 9 10 59 11 CST 2004 Thu Dec 9 10 59 12 2004 0 8...

Page 30: ...checks each command to see if it should be run in the current minute Modify the file etc cron d crontab to set up your scheduled applications Crontab files have the following format mm h dom mon dow u...

Page 31: ...e time is Eastern Standard Time and the only conversion performed is for Daylight Savings Time For this reason there is no need to adjust the hardware clock for Daylight Savings Time twice a year In t...

Page 32: ...tree or a symbolic link to it The DA 660 does not provide use share zoneinfo files so you will need to copy a time zone information file to the DA 660 and write over the original local time file y Th...

Page 33: ...s communication functions The following topics are covered in this chapter Telnet FTP DNS Web Service Apache IPTABLES NAT NAT Example Enabling NAT at Bootup Dial up Service PPP PPPoE NFS Network File...

Page 34: ...To set up the 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 na...

Page 35: ...your CGI page to the following directory 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 Serv...

Page 36: ...default If you want to disable the function modify the file etc apache conf httpd conf When you develop your own CGI application make sure your CGI file is executable 192 168 3 127 PuTTY root Moxa usr...

Page 37: ...TING 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 produc...

Page 38: ...Process Mangle Table OUTPUT Chain NAT Table OUTPUT Chain Filter Table OUTPUT Chain The DA 660 supports the following sub modules Be sure to use the module that matches your application ip_conntrack i...

Page 39: ...cket filtering HOWTO 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...

Page 40: ...ed o 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 spo...

Page 41: ...lobal IP addresses on incoming packets back into local IP addresses NOTE Click on the following link for more information about iptables and NAT http www netfilter org documentation HOWTO NAT HOWTO ht...

Page 42: ...es 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 n...

Page 43: ...2 CONNECT user username password password dev ttyM0 115200 crtscts modem The pppd options are as follows connect chat etc This option provides the command to contact the PPP server The chat program is...

Page 44: ...a PPP connection there are some steps that 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 t...

Page 45: ...applies to using a modem and requiring authorization with a username and password pppd dev ttyM0 115200 crtscts modem 192 168 16 1 192 168 16 2 login auth You should also add the following line to th...

Page 46: ...ugin pppoe so 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 c...

Page 47: ...DA 660 supports the NFS protocol for both client and server NOTE Click the following links for more information about NFS http www tldp org HOWTO NFS HOWTO index html http nfs sourceforge net nfs how...

Page 48: ...one and 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 1...

Page 49: ...browser on the host site to query the DA 660 which is the SNMP agent The DA 660 will respond SNMP QUERY STARTED 1 sysDescr 0 octet string Linux Moxa 2 4 18_mvl30 ixdp425 1049 Tue Oct 26 09 34 15 CST...

Page 50: ...ut MIB II and RS 232 like groups http www faqs org rfcs rfc1213 html http www faqs org rfcs rfc1317 html The DA 660 does NOT support SNMP trap OpenVPN OpenVPN provides two types of tunnels for users t...

Page 51: ...1 as IP less creates logical bridge s and TAP interfaces loads modules enables IP forwarding etc Start bin sh iface eth1 defines the internal interface maxtap expr 1 defines the number of tap devices...

Page 52: ...face 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 t...

Page 53: ...le ln s etc openvpn openvpn bridge etc rc d rc6 d K32vpn br for example 3 On machine OpenVPN A modify the remote address in the configuration file etc openvpn tap0 br conf etc openvpn tap0 br conf poi...

Page 54: ...n create link symbols to enable the etc openvpn openvpn bridge script at boot time ln s etc openvpn openvpn bridge etc rc d rc3 d S32vpn br ln s etc openvpn openvpn bridge etc rc d rc6 d K32vpn br 5 O...

Page 55: ...n in the following diagram OpenVPN A OpenVPN B Host A LAN1 192 168 2 171 Host B LAN1 192 168 4 172 LAN1 192 168 8 174 LAN1 192 168 2 173 local net local net t e n r e t n I t e n r e t n I LAN2 192 16...

Page 56: ...penvpn secrouter key cipher DES EDE3 CBC auth MD5 tun mtu 1500 tun mtu extra 64 ping 40 ifconfig 192 168 4 174 192 168 2 173 up etc openvpn B tun sh Start bin sh value after net is the subnet behind t...

Page 57: ...des important information for programmers The following functions are covered in this chapter Flash Memory Map Linux Tool Chain Introduction Debugging with GDB Device API RTC Real Time Clock Buzzer WD...

Page 58: ...sure that an application will be able to run correctly when installed on the DA 660 you must ensure that it is compiled and linked to the same libraries that are on the DA 660 This is particularly tru...

Page 59: ...ssembler c g C compiler cpp C preprocessor gcc C compiler gdb Debugger ld Linker nm Lists symbols from object files objcopy Copies and translates object files objdump Displays information about object...

Page 60: ...tl man page for detailed documentation man ioctl RTC Real Time Clock The device node is located at dev rtc The DA 660 supports Linux standard simple RTC control You must include linux rtc h 1 Function...

Page 61: ...cation must include moxadevic h 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 sWatch D...

Page 62: ...ch Dog does not need to acknowledge the action time The time period to acknowledge the Watch Dog Input int fd the file handle from swtd_open return value int mode the function will be return the statu...

Page 63: ...r application enables the Watch Dog and does not acknowledge it your application may have a logical error or your application has made a core dump The kernel will not auto acknowledge this This can ca...

Page 64: ...NULL NULL 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_disa...

Page 65: ...de will be returned in parameter 3 There are two Moxa private ioctl commands for setting up special baudrates Function MOXA_SET_SPECIAL_BAUD_RATE Function MOXA_GET_SPECIAL_BAUD_RATE If you use this io...

Page 66: ...nly supports text mode display with screen size of 16 cols by 8 rows The device node is dev lcm See the examples given below We provide a private struct defined as follows typedef struct lcm_xy int x...

Page 67: ...ue of the key value is returned in argument 3 Special Note 1 The DA 660 s kernel will store the pressed key history in a buffer The maximum buffer size is 31 keys If the buffer overflows the first key...

Page 68: ...plays the amount of free space on the device 13 mkdir make new directory 14 rmdir delete directory Editor 1 vi text editor 2 cat dump file context 3 zcat compress or expand files 4 grep search file fo...

Page 69: ...usage 6 date print or set the system date and time 7 env run a program in a modified environment 8 clear clear the terminal screen 9 reboot reboot power off on the server 10 halt halt the server 11 d...

Reviews: