我想在 tc 中使用 fw 过滤器对出站 UDP 数据包施加任意延迟;但是,我无法让过滤器正常工作:
tc qdisc add dev eth0 root handle 1: prio
tc qdisc add dev eth0 parent 1:3 handle 30: netem delay 200ms
tc filter add dev eth0 parent 1:0 protocol ip prio 3 handle 1 fw flowid 1:3
iptables -A PREROUTING -i eth0 -t mangle -p udp -j MARK --set-mark 1
Run Code Online (Sandbox Code Playgroud)
如果我使用以下 u32 过滤器,我会得到想要的效果:
tc filter add dev eth0 parent 1:0 protocol ip prio 3 u32 match ip dport 53 0xffff flowid 1:3
Run Code Online (Sandbox Code Playgroud)
我不想使用 …
我已经在我的 CentOs VPS 上安装了 OpenVPN 服务器,并成功启动
并尝试通过以下命令为其配置 iptables:
iptables -A FORWARD -m state -–state RELATED,ESTABLISHED -j ACCEPT
iptables -A FORWARD -s 10.8.0.0/24 -j ACCEPT
iptables -A FORWARD -j REJECT
iptables -t nat -A POSTROUTING -s 10.8.0.0/24 -j SNAT --to 209.54.48.68Run Code Online (Sandbox Code Playgroud)
但是我无法连接到它,所以我在我的电脑上运行 nmap:
nmap -p 1194 209.54.48.68 在 2011-12-27 22:28 IRST 开始 Nmap 5.21 ( http://nmap.org ) 209.54.48.68.nativehosting.com (209.54.48.68) 的 Nmap 扫描报告 主机已启动(0.53 秒延迟)。 港口国服务 1194/tcp 关闭未知 Nmap 完成:3.22 秒内扫描 1 个 IP 地址(1 个主机启动)
现在问题出在哪里,我应该如何解决?为什么安装 OpenVPN 后 1194 关闭?
我已经按照 …
我想知道是否可以使用简单的 IP 表规则来防止小型 (D)DoS 攻击?
小我的意思是他们用来自一两个 IP 地址的大约 400 多个请求淹没了我的 Web 服务器。在我注意到 IP 地址开始攻击我的 Web 服务器后,我可以删除它们,但 IP 表通常需要几分钟才能针对该 IP 启动,然后开始完全删除它,以免影响该 Web 服务器.
我使用以下命令删除 IP:
iptables -I INPUT -s "IP HERE" -j DROP
然后显然保存它:
/etc/init.d/iptables save
我通常使用以下命令找出攻击 IP 地址:
netstat -plan|grep :80|awk '{print $5}'|cut -d: -f 1|sort|uniq -c|sort -n
这样做的问题是我必须在那里,并且需要我事后采取行动。是否有 IP 表规则可用于在达到 150 个连接后立即删除 IP 地址?这样我就不必担心它会压倒 Web 服务器,而且我也不必在那里阻止它。
顺便说一句,如果重要的话,我在 CentOS 上使用 Apache。
感谢您的时间。
我们想要阻止对 SSH 的所有访问,除了两个 IP 地址。一个地址是动态的,它以 124.567.890.xxx 开头,其中 xxx 一直在变化。我读到你可以通过改变来做到这一点/etc/hosts.allow?我们应该怎么做?
我正在使用 Apache 2/MySQL 运行 Centos 6.0 服务器。我已经运行了 iptables。我今晚按照以下步骤使用 iptables 阻止来自 IP 的所有流量:
iptables -A INPUT -s xxx.xxx.xxx.xxx -j DROP
iptables -A OUTPUT -d xxx.xxx.xxx.xxx -j DROP
service iptables save
service iptables restart
Run Code Online (Sandbox Code Playgroud)
但是我仍然在我的 Apache 访问日志中不断看到来自这个 IP 的点击,即使在我重新启动 Apache 之后也是如此。iptables 肯定正在运行,而且它绝对是正确的 IP 地址。
这些是我其余的 iptables 条目:
Chain INPUT (policy ACCEPT)
num target prot opt source destination
1 ACCEPT all -- anywhere anywhere
2 REJECT all -- anywhere loopback/8 reject-with icmp-port-unreachable
3 ACCEPT all -- anywhere anywhere state RELATED,ESTABLISHED
4 ACCEPT tcp …Run Code Online (Sandbox Code Playgroud) 我想阻止我的两个 DNS 服务器上的所有传入请求,除了某些 IP 地址,例如 1.2.3.4 的 IP 将被允许发出请求,但其他人不会。
你如何用 iptables 做到这一点?
非常感谢。
安装和配置fail2ban后,我尝试使用错误的密码通过ssh登录我的服务器。经过几次尝试,我尝试使用正确的密码成功。所以,fail2ban 没有禁止用户 ip 允许他登录。不管我设置了什么规则,maxretry = 1 等等。
我的 iptables -L 输出:
Chain INPUT (policy ACCEPT)
target prot opt source destination
fail2ban-SSH tcp -- anywhere anywhere tcp dpt:ssh
Chain FORWARD (policy ACCEPT)
target prot opt source destination
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
Chain fail2ban-SSH (1 references)
target prot opt source destination
RETURN all -- anywhere anywhere
Run Code Online (Sandbox Code Playgroud)
这是调试日志,不完整的版本如下:
root@host:~# fail2ban-client -v -v -v start
DEBUG Reading configs for /etc/fail2ban/fail2ban under /etc/fail2ban
DEBUG Reading config files: /etc/fail2ban/fail2ban.conf
DEBUG Reading …Run Code Online (Sandbox Code Playgroud) 我正在使用 ansible 在我的数据库服务器上配置 ufw 以只接受从某些服务器连接到特定端口的连接(可以说1234)。
当曾经有访问权限的服务器从池中取出时,可能会忘记删除该服务器的访问规则。
我的解决方案:设置规则时,我想删除 port 的所有规则1234,然后使用当前池中的服务器重新创建它们。
不幸的是,ufw delete需要精确指定要删除的规则(端口、协议、scr IP,...)。
我尝试了类似 的解决方案ufw delete $(ufw status numbered | grep 1234 | <get all the numbers of the rules> ),但它变得非常丑陋,速度非常快。
有没有更好的方法来删除某个端口的所有规则?
我正在研究传输层中的一些东西,在我运行我们的自定义策略来保护我无法traceroute从 linux 机器上执行的策略之后。
root@keystone-evm:~# iptables -L
Chain INPUT (policy ACCEPT)
target prot opt source destination
ACCEPT udp -- anywhere 10.222.4.212 udp dpt:echo
ACCEPT udp -- anywhere 10.222.4.212 udp dpt:isakmp
ACCEPT udp -- anywhere 10.222.4.212 udp dpt:radius
ACCEPT udp -- anywhere 10.222.4.212 udp dpt:ntp
ACCEPT icmp -- anywhere 10.222.4.212
ACCEPT udp -- anywhere 10.222.4.212 udp dpt:domain
ACCEPT udp -- anywhere 10.222.4.212 udp dpt:bootpc
ACCEPT udp -- anywhere 10.222.4.212 udp dpt:bootps
ACCEPT 123 -- anywhere 10.222.4.212
DROP all -- anywhere …Run Code Online (Sandbox Code Playgroud) 我对iptables. 下图显示了根据我目前的理解评估链的顺序。如果这种印象是错误的,请告诉我。
我的问题是,当我像这样添加自定义链时,在下图中的哪个位置放置了自定义链?
sudo iptables -N MYCHAIN
我知道该命令在过滤器表中创建了一个新链,但我不确定这意味着什么。是规则MYCHAIN之前或其他连锁店的规则后评估?
