Moxa DA-682A-C7-DPP-LX [43/108] Rule examples applying user defined chains

Moxa DA-682A-C7-DPP [43/108] Rule examples applying user defined chains
DA-682A-DPP Linux Software Managing Communications
3-25
ATTENTION
To use the rule in Exam
ples 8 and 9, below, remember to first, to load the module ipt_mac:
moxa@Moxa:~# modprobe ipt_mac.
To make a module load across reboots, you may add it to the /etc/modprobe.conf file
using this command:
moxa@Moxa:~# echo “ipt_mac” >> /etc/modprobe.conf
Don’t forget to backup your modprobe.conf file before altering it, and take care to
use the double pointer (>>)
which is append
rather the single pointer (>) which is
overwrite.
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
Example 9: Accept all packets from MAC address 02:03:04:05:06:07.
# iptables A INPUT i eth0 p all m mac --mac-source 02:03:04:05:06:07 j ACCEPT
Rule Examples: Applying User-Defined Chains
Some network administrators may find it useful to define their own rule chains. Here, we show how to
implement them in the INPUT chain, and use the chains defined above, in the section User-Defined Chains.
# iptables -A INPUT -p udp -m conntrack --ctstate NEW -j UDP
# iptables -A INPUT -p tcp --syn -m conntrack --ctstate NEW -j TCP
The TCP and UDP chains are now attached to the INPUT chain; by adding in the above connection rule, once
a connection is accepted by either chain, it will be handled by the RELATED/ESTABLISHED rule. You may now
add rules to these chains as if you were adding rules to the INPUT chain. Using some of the INPUT rules defined
above as examples:
# iptables -A TCP -p tcp --dport 80 -j ACCEPT
# iptables -A TCP -p tcp --dport 443 -j ACCEPT
# iptables -A TCP -p tcp --dport 22 -j ACCEPT
# iptables -A UDP -p udp --dport 53 -j ACCEPT
ATTENTION
A s
ample firewall is provided in Appendix C, Sample Scripts
. If you have further questions, please refer to
those.
Saving the Firewall
You must save your firewall so that it will reload on the next reboot; otherwise, the firewall rules and settings
will be permanently deleted. After configuring iptables, the following command will save the ruleset to
/etc/sysconfig/iptables:
moxa@Moxa:~# /sbin/service iptables-save
NAT (Network Address Translation)
The NAT (Network Address Translation) protocol translates IP addresses used on a local network into IP
addresses used on a connecting network. One network is designated the inside network and the other is the
outside network. Typically, the DA-682A-DPP-LX connects several devices on a network and maps local inside
network addresses to one or more global outside IP addresses, and translates the global IP address used on by
packets coming in from the WAN back into local IP addresses.

Содержание

Похожие устройства

Скачать