Moxa Technologies 331 User Manual Page 44

  • Download
  • Add to my manuals
  • Print
  • Page
    / 69
  • Table of contents
  • BOOKMARKS
  • Rated. / 5. Based on customer reviews
Page view 43
Moxa C Programmable RTU Controllers Managing Communications
4-10
# iptables A INPUT i eth0 p all m mac -–mac-source 01:02:03:04:05:06 j DROP
NOTE: In Example 7, remember to issue the command #modprobe ipt_mac first to load module ipt_mac.
NAT
NAT (Network Address Translation) protocol translates IP addresses used on one network to different IP
addresses used on another network. One network is designated the inside network and the other is the outside
network. Typically, the RTU controller connects several devices on a network, maps local inside 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.
NOTE
Click on the following links for more information about iptables and NAT:
http://www.netfilter.org/documentation/HOWTO/NAT
-HOWTO.html
NAT Example
The IP address of LAN1 is changed to 192.168.127.254 (you will need to load the module ipt_MASQUERADE):
1. #echo 1 > /proc/sys/net/ipv4/ip_forward
2. #modprobe ip_tables
3. #modprobe iptable_filter
4. #modprobe ip_conntrack
5. #modprobe iptable_nat
6. #modprobe ipt_MASQUERADE
7. #iptables -t nat -A POSTROUTING -o eth0 -j SNAT --to-source 192.168.127.254
8. #iptables -t nat -A POSTROUTING -o eth0 -s 192.168.127.0/24 -j MASQUERADE
Enabling NAT at Bootup
In most of the situations, you will want to use a simple shell script to enable NAT when the RTU controller 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
Page view 43
1 2 ... 39 40 41 42 43 44 45 46 47 48 49 ... 68 69

Comments to this Manuals

No comments