Moxa EM-1220-LX [38/57] Nat example
![Moxa EM-1220-LX [38/57] Nat example](/views2/1199903/page38/bg26.png)
EM-1240-LX User’s Manual Configuring the EM-1240-LX
Example 4: Drop TCP packets from 192.168.1.25.
# iptables –A INPUT –i eth0 –p tcp –s 192.168.1.25 –j DROP
Example 5: Drop TCP packets addressed for port 21.
# iptables –A INPUT –i eth0 –p tcp --dport 21 –j DROP
Example 6: Accept TCP packets from 192.168.0.24 to the EM-1240-LX’s port 137, 138, 139
# iptables –A INPUT –i eth0 –p tcp –s 192.168.0.24 --dport 137:139 –j ACCEPT
Example 7: Log TCP packets that visit EM-1240-LX’s port 25.
# iptables –A INPUT –i eth0 –p all –m mac –-mac-source 01:02:03:04:05:06 –j DROP
Example 8: Drop all packets from MAC address 01:02:03:04:05:06.
# iptables –A INPUT –i eth0 –p all –m mac –mac-source 01:02:03:04:05:06 –j DROP
NAT
NAT (Network Address Translation) protocol translates IP addresses used on one network into
different IP addresses used on another network. One network is designated the inside network and
the other is the outside network. Typically, the EM-1240-LX connects several devices on a
network and maps local inside network addresses to one or more global outside IP addresses, and
remaps the global IP addresses on incoming packets back into local IP addresses.
NOTE Click the following link for more information about iptables and NAT:
http://www.netfilter.org/documentation/HOWTO/NAT-HOWTO.html
NAT Example
The IP addresses of all packets leaving LAN1 are changed to 192.168.3.127 (you will need to load
the module ipt_MASQUERADE):
1.
First load the following device drivers:
¾
x_tables.ko
¾
xt_multiport.ko
¾
xt_MARK.ko
¾
xt_tcpudp.ko
¾
ip_tables.ko
¾
ip_nat.ko
¾
iptable_nat.ko
¾
ipt_MASQUERADE.ko
2.
#echo 1 > /proc/sys/net/ipv4/ip_forward
3.
#iptables -t nat –A POSTROUTING –o eth0 –j SNAT --to-source 192.168.3.127
or
4.
#iptables –t nat –A POSTROUTING –o eth0 –j MASQUERADE
Enabling NAT at Bootup
In most real world situations, you should use a simple shell script to enable NAT when the
EM-1240-LX boots up, as indicated by the following:
1. setting iptables
2. iptables-save > /home/xxx.file (xxx.file is the user defined file name)
3. vi /etc/rc
4. Append echo 1 > /proc/sys/net/ipv4/ip_forward
5. Append iptables-restore /home/xxx.file (xxx.file is the user defined file name)
4-7
Содержание
- Em 1240 lx user s manual 1
- Fifth edition february 2009 1
- Www moxa com product 1
- Copyright notice 2
- Disclaimer 2
- Em 1240 lx user s manual 2
- Technical support contact information www moxa com support 2
- Trademarks 2
- Table of contents 3
- Introduction 5
- Overview 6
- Package checklist 6
- Product features 6
- Hardware specifications 7
- Product specifications 7
- Software specifications 8
- Appearance 9
- Em 1240 embedded module development kit 9
- Em 1240 lx user s manual introduction 9
- Hardware block diagram 9
- Em 1240 development kit 10
- Em 1240 embedded module 10
- Em 1240 lx user s manual introduction 10
- Dimensions 11
- Installing the em 1240 lx 11
- Led indicators 12
- Wiring requirements 12
- Connecting data transmission cables 13
- Connecting the power 13
- Connecting to the network 13
- Grounding the em 1240 lx 13
- Connecting to a serial device 14
- Serial console port 14
- Additional functions 15
- Internal sd socket 15
- Reset button 15
- Real time clock 16
- Getting started 17
- Connecting the em 1240 lx to a pc 18
- Console port 18
- Powering on the em 1240 lx 18
- Telnet 19
- Configuring the ethernet interface 20
- Developing your applications 22
- Installing a secure digital sd memory card 22
- Compiling hello c 23
- Installing the em 1240 lx tool chain 23
- Uploading hello to the em 1240 lx 24
- Running hello on the em 1240 lx 25
- Make file example code 26
- Software package 27
- Em 1240 lx software architecture 28
- Journaling flash file system jffs2 29
- Em 1240 lx software package 30
- Configuring the em 1240 lx 32
- Enabling and disabling daemons 33
- How to enable disable etc inittab www server 33
- How to enable disable telnet ftp server 33
- How to enable network time protocol 33
- How to update the system time periodically with network time protocol 33
- Adding a web page 34
- Iptables 34
- Observe and erase chain rules 36
- Append or delete rules 37
- Define policy for chain rules 37
- Enabling nat at bootup 38
- Nat example 38
- Configuring dial in dial out service 39
- Configuring pppoe 39
- Connect using a modem 39
- Dial in service 39
- Dial out service 39
- Direct cable connection 39
- Dynamic driver module load unload 40
- How to mount a remote nfs server 40
- Upgrading the kernel 41
- Upgrading the root file system user directory 42
- Autostarting user applications on bootup 43
- Checking the kernel and root file system versions 43
- Loading factory defaults 43
- Em 1240 lx device api 44
- Buzzer 45
- Rtc real time clock 45
- Uart interface 45
- Api list 46
- Moxa gpio api 46
- How to use the gpio 47
- Gpio library source code 48
- Limits 48
- A system commands 52
- Editor 52
- File manager 52
- System commands 52
- Μclinux normal command utility collection 52
- Moxa special utilities 53
- Network 53
- Process 53
- B snmp agent with mib ii rs 232 like group 54
- Snmp agent with mib ii rs 232 like group 54
- C em 1240 lx faq 57
- Em 1240 lx faq 57
Похожие устройства
- Moxa EM-1220-LX Руководство по аппаратной части
- Carku E-Power-40B Инструкция по эксплуатации
- Moxa EM-1220-LX Руководство по быстрой установке
- Moxa EM-1220-LX Технические характеристики
- Moxa EM-1220-LX Руководство по работе с утилитой Moxa Device Manager
- Moxa EM-1220-T-LX Инструкция по эксплуатации
- Moxa EM-1220-T-LX Руководство по аппаратной части
- Moxa EM-1220-T-LX Технические характеристики
- Moxa EM-1220-T-LX Руководство по быстрой установке
- Moxa EM-1220-T-LX Руководство по работе с утилитой Moxa Device Manager
- Moxa EM-1240-LX Инструкция по эксплуатации
- Moxa EM-1240-LX Руководство по аппаратной части
- Moxa EM-1240-LX Технические характеристики
- Moxa EM-1240-LX Руководство по быстрой установке
- Moxa EM-1240-LX Руководство по работе с утилитой Moxa Device Manager
- Moxa EM-1240-T-LX Инструкция по эксплуатации
- Moxa EM-1240-T-LX Технические характеристики
- Moxa EM-1240-T-LX Руководство по аппаратной части
- Moxa EM-1240-T-LX Руководство по быстрой установке
- Moxa EM-1240-T-LX Руководство по работе с утилитой Moxa Device Manager