EM-1220 LX User’s Manual
Configuring the EM-1220-LX
Examples:
Example 1: Accept all packets from lo interface.
# iptables –A INPUT –i lo –j ACCEPT
Example 2: Accept TCP packets from 192.168.0.1.
# iptables –A INPUT –i eth0 –p tcp –s 192.168.0.1 –j ACCEPT
Example 3: Accept TCP packets from Class C network 192.168.1.0/24.
# iptables –A INPUT –i eth0 –p tcp –s 192.168.1.0/24 –j ACCEPT
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-1220-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
4-7