openwrt iptables
时间: 2023-09-14 14:15:37 浏览: 154
Openwrt
OpenWrt is a Linux-based firmware for routers that provides a wide range of network features, including firewall capabilities using iptables. iptables is a command-line tool that allows you to configure firewall rules in Linux.
To configure iptables on OpenWrt, you can use the following steps:
1. Log in to your OpenWrt router using SSH or the LuCI web interface.
2. Navigate to the Firewall section in the web interface or use the command-line tool to create firewall rules.
3. Create a new firewall zone that defines the rules for the traffic to be allowed or blocked. For example, you can create a "wan" zone for incoming traffic from the Internet, and a "lan" zone for traffic between devices in your local network.
4. Add rules to the firewall zone using the iptables syntax. For example, you can allow incoming SSH traffic from the Internet to a specific device in your local network using the following command:
iptables -A zone_wan_input -p tcp --dport 22 -d 192.168.1.100 -j ACCEPT
This rule allows incoming TCP traffic to port 22 (SSH) on the device with IP address 192.168.1.100 in the "lan" zone.
5. Save the firewall rules to the OpenWrt configuration file to make them persistent across reboots:
/etc/init.d/firewall save
6. Restart the firewall service to apply the changes:
/etc/init.d/firewall restart
These are just some examples of how to configure iptables on OpenWrt. For more information and advanced configuration options, refer to the OpenWrt documentation or consult with a network administrator.
阅读全文