- iOS/Objective-C 元类和类别
- objective-c - -1001 错误,当 NSURLSession 通过 httpproxy 和/etc/hosts
- java - 使用网络类获取 url 地址
- ios - 推送通知中不播放声音
我已经为启用了完整 netfilter 功能的 android 模拟器编译了 Linux。从源代码构建 android 后得到一个 iptables 二进制文件。
当我将这个二进制文件推送到模拟器时
我可以成功执行如下命令。
iptables -L
iptables -F
iptables -A INPUT -s www.google.com -j DROP
出现此错误:
# # iptables -L
getsockopt for multiport failed strangely: No such file or directory
getsockopt for multiport failed strangely: No such file or directory
Chain INPUT (policy ACCEPT)
target prot opt source destination
Chain FORWARD (policy ACCEPT)
target prot opt source destination
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
#
和
# iptables -A INPUT -s www.google.com -j DROP
getsockopt for multiport failed strangely: No such file or directory
getsockopt for multiport failed strangely: No such file or directory
FIX ME! implement getgrnam() bionic/libc/bionic/stubs.c:344
但至少上面的命令是有效的!
但是当我尝试
iptables-save or
iptables-restore
我收到错误提示
iptables-save: not found
在我的配置文件中
CONFIG_NETFILTER_XT_MATCH_MULTIPORT=m
有什么问题……??以及如何在 android 中启用完整的 iptables 功能,或者如何安全地保存当前 Activity 的 iptables 规则并在下次重启时重新加载它们。
请帮忙。谢谢!
最佳答案
iptables-save
和 iptables-restore
二进制文件不是由默认的 Android 系统 makefile 构建的。
您需要将规则添加到 $mydroid/external/iptables/
中的 Android.mk
文件以构建它们。源文件 iptables-save.c
和 iptables-restore.c
已经在该目录中。
未经测试,但要构建 iptables-save
,请在 Android.mk
的末尾添加类似这样的内容。冲洗并重复 iptables-restore
:
#
# Build iptables-save
#
include $(CLEAR_VARS)
LOCAL_C_INCLUDES:= \
$(LOCAL_PATH)/include/ \
$(KERNEL_HEADERS)
LOCAL_CFLAGS:=-DNO_SHARED_LIBS
LOCAL_CFLAGS+=-DIPTABLES_VERSION=\"1.3.7\"
LOCAL_SRC_FILES:= \
iptables-save.c
LOCAL_MODULE_TAGS:=debug
LOCAL_MODULE:=iptables-save
LOCAL_STATIC_LIBRARIES := \
libiptc \
libext
include $(BUILD_EXECUTABLE)
关于android - android : iptables-save and iptables-restore not working 中的 iptables 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5541983/
我已经为启用了完整 netfilter 功能的 android 模拟器编译了 Linux。从源代码构建 android 后得到一个 iptables 二进制文件。 当我将这个二进制文件推送到模拟器时
由于大量机器人每秒访问我的 Web 服务器太多次,我进入我的服务器并发出以下命令,试图在 5 秒内将连接限制为最多 25 个。我可能需要更严格,但我不是因为我有一个很少访问的页面,它请求 50 个图像
我正在尝试阻止在短时间内打开大量连接的网络机器人。我正在使用这个语法: -A INPUT -p tcp --dport 80 -m state --state NEW -m recent --set
我正在尝试在 iptables 中记录一些来自恶意 IP 地址的丢弃数据包,这些 IP 地址不断攻击我的服务器。 来自这个恶意 IP 的所有内容都被丢弃,我不再在 Web 服务器日志中看到它,这是一件
关闭。这个问题不符合Stack Overflow guidelines .它目前不接受答案。 这个问题似乎不是关于 a specific programming problem, a softwar
我已经设置了 keepalived,只有当我停止 iptables 服务时它才能正常工作。我的iptables配置是这样的,请告诉我应该为keepalived添加什么规则 # Firewall con
我使用 DevStack 在 RHEL6 上安装了 OpenStack,并且运行良好。有一天,我们的一位“系统管理员”注意到 iptables 正在系统上运行,并决定将其关闭(chkconfig ip
测试环境为: 2 操作系统 ubuntu server 10.04 安装在 VirtualBox 上 iptables v1.4.4 已加载 ip_conntrack 模块 这些是我的测试规则:
当我清除 IPtables 然后添加以下规则时,传入连接可以毫无问题地连接到端口 1234 上的我的 KVM VM。 -A PREROUTING -i br0 -p tcp -m tcp --dpor
我正在为我的工作使用 iptables 最近的匹配项,因为它保存了 ip 地址和我需要的最后一次看到的值。 但是现在我需要从 iptables 最近的列表中删除一些条目,这些条目位于 ipset 中。
所以我加了 sudo iptables -t raw -A PREROUTING -p tcp --dport 25 -j TRACE 也 sudo iptables -t raw -A OUTPUT
我在专用的 ubuntu 服务器上有一个防火墙(基于 iptables)。我有几个 LAN 客户端。 在我的一个 LAN 客户端上,我正在运行可以根据 IP 限制访问的软件。对我来说,重要的是我可以通
我不知道如何解决我的问题。 是否可以使用 ipq_set_verdict() 重定向捕获的数据包? 我想将未经授权的用户重定向到登录页面。 请看我的代码: 数据包被接受,我的浏览器打开请求的页面(未更
我正在尝试使用字符串匹配模块获取“from”和“to”偏移量以在我的 iptables 规则中使用。这是我从 tcpdump 工具输出的数据包: listening on eth0, link-typ
我正在尝试使用 python-iptables 编写脚本来设置某些规则。我弄清楚了如何设置规则以允许所有连接和拒绝所有连接,但我需要弄清楚如何编写规则以允许已建立的连接。 例如,我需要使用 pytho
这是规则集: #!/bin/sh iptables-restore -v<
我正在尝试将数据从 xml 加载到 iptables。我正在使用以下命令: xsltproc /usr/share/iptables/iptables.xslt myiptable.xml | ipt
我正在尝试设置 iptable 规则,但在使用 iptable 时收到以下错误消息: iptables v1.4.14: can't initialize iptables table `nat':
我正在从 Windows Bash 运行 Ubuntu 18.04: uname -a Linux DESKTOP-M87DGAS 4.4.0-17134-Microsoft #112-Microso
有一个 IP(来自中国)试图下载我的整个网站。它下载我所有的页面并显着加载服务器(我有超过 500 000 个页面)。查看访问日志,我可以看出它绝对不是 Google 机器人或任何其他搜索引擎机器人。
我是一名优秀的程序员,十分优秀!