User`s manual

UC-7400-LX Plus User’s Manual Managing Communications
4-8
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 UC-7400-LX Plus’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 UC-7400-LX Pluss port 25
# iptables –A INPUT –i eth0 –p tcp --dport 25 –j LOG
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 to
different IP addresses used on another network. One network is designated the inside network and
the other is the outside network. Typically, the UC-7400-LX Plus connects several devices on a
network and 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 link for more information about iptables and NAT:
http://www.netfilter.org/documentatio
n/
HOWTO/NAT-HOWTO.html
NAT Example
The IP address of LAN1 is changed to 192.168.3.127 (you will need to load the module
ipt_MASQUERADE):
Embedded Computer
PC1 (Linux or Windows)
IP/Netmask:
Gateway:
192.168.3.100/24
192.168.3.127
PC2 (Linux or Windows)
IP/Netmask:
Gateway:
192.168.4.100/24
192.168.4.127
LAN1
LAN2
LAN1: 192.168.3.127/24
LAN2: 192.168.4.127/24
NAT Area / Private IP
1. #echo 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 eth0 -j MASQUERADE