Articles of iptables

iptables不能在重新启动时启动

我已经在systemd中启用了iptables: systemctl enable iptables 但重启后当我尝试service iptables status ,它显示: # service iptables status Redirecting to /bin/systemctl status iptables.service iptables.service – IPv4 firewall with iptables Loaded: loaded (/usr/lib/systemd/system/iptables.service; enabled; vendor preset: disabled) Active: inactive (dead) 但是当我手动systemctl start iptables ,它正常启动。 我正在运行Fedora 22。

iptables转发被忽略

我遇到了将stream量从一个接口转发到另一个接口的问题。 看来我的转发规则没有得到尊重。 sysctl net.ipv4.ip_forward net.ipv4.ip_forward = 1 以下是我的IPtable的外观: Chain INPUT (policy ACCEPT 60 packets, 8184 bytes) pkts bytes target prot opt in out source destination Chain FORWARD (policy ACCEPT 0 packets, 0 bytes) pkts bytes target prot opt in out source destination 0 0 LOG all — any any 192.168.0.0/24 anywhere LOG level warning 0 […]

为什么在我的iptables条目中是否有DNS主机名? (的fail2ban)

我最近安装了fail2ban,它已经开始阻止不好的ssh尝试。 我还设立了一个额外的filter来永久禁止屡犯者 。 现在我注意到,在我的iptables中有一些条目是DNS主机名而不是原始IP地址,这显然是一个可怕的想法。 我在use_dns = no添加了use_dns = no ,并在/ etc / ssh / sshd_config中添加了UseDNS no 。 我已经重新启动了这两个服务,但这些iptables条目仍显示为主机名而不是IP地址。 还有什么可能导致DNS名称? 禁用的ips的永久列表被存储为原始IP,所以翻译似乎是在幕后发生的,因为它们是在启动时由fail2ban添加的。

iptables规则不起作用

我不知道为什么我的iptable规则阻止访问https://example.com:9700尽pipeaccept规则被添加 我开始清理一切 iptables -P INPUT ACCEPT iptables -P FORWARD ACCEPT iptables -P OUTPUT ACCEPT iptables -t nat -F iptables -t mangle -F iptables -F iptables -X 然后放下所有东西,为ssh和我的9700端口添加exception iptables -P INPUT DROP iptables -P FORWARD DROP iptables -P OUTPUT DROP iptables -A INPUT -p tcp -m tcp –dport 22 -j ACCEPT iptables -A OUTPUT -p tcp […]

用iptables的ubuntu服务器阻止ip

我想在我的Ubuntu服务器12.04中用iptables阻塞一个IP。 国外的IP是117.16.18.95.dyna。 你可以看看下一张图片: 我用下一个命令将这个ip添加到了iptables中: sudo iptables -A INPUT -s 117.16.18.95 -p tcp -j DROP sudo service iptables-persistent save sudo service iptables-persistent restart 但是,当我再次运行netstat -tap命令,这个IP不被阻止。 我如何从我的Ubuntu服务器上删除/阻止/删除这个IP?

端口53的iptables规则不起作用

我的Ubuntu 14.04 LTS服务器正在接收来自不同IP地址的端口53上的大量inputstream量。 我没有托pipe任何DNS服务。 所以我决定阻止端口53: iptables -A INPUT -p tcp –destination-port 53 -j DROP iptables -A OUTPUT -p tcp –dport 53 -j DROP 之后我保存新的规则: invoke-rc.d iptables-persistent save 所以最终的结果是这样的: Chain INPUT (policy ACCEPT) target prot opt source destination DROP tcp — 0.0.0.0/0 0.0.0.0/0 tcp dpt:53 Chain FORWARD (policy ACCEPT) target prot opt source destination DOCKER all […]

IPtables白名单安全性如何?

我正在部署一些VPS,当然,安全是一个大问题。 我读了IPtables白名单是保护你的机器的最好方法。 所以我build立了以下的方法: echo "Flushing rules" iptables -F echo "Allow localhost interface" iptables -A INPUT -i lo -j ACCEPT echo "Allow local network traffic" iptables -A INPUT -s 192.168.1.0/255.255.255.0 -j ACCEPT echo "Allow my dear friend 1" iptables -A INPUT -s xx.xx.xx.xx -j ACCEPT echo "Allow my dear friend 2" iptables -A INPUT -s xx.xx.xx.xx […]

如何使用Linux机器作为路由器在生产networking和隔离networking之间进行通信?

我正在创build一个testing环境。 其中我有一个生产networking,孤立的networking和Linux机器。 在具有2个NIC的Linux机器中,一个NIC连接到生产networking环境,然后分配一个IP,另一个是隔离networking。 PROD——-(eth0)[LINUXMACHINE](eth1)—–ISOALTED NETWORK 在上面的表示中,configuration​​一个网卡(eth0)之后,我可以从生产networking机器ping到Linux机器。 然后我将eth1configuration成隔离networking的默认网关。 启用eth1之后,可以从Linux机器ping到隔离的env。 现在我无法从Prod到Linux机器ping。如果我禁用eth1的手段,它将工作,否则它不会。 我是networking新手。 我不知道问题到底在哪里,我做错了什么。 我已经启用了以下 IP转发,MASQUERADE和一些iptables规则 任何人都可以build议我一个很好的方法来完成这项工作。 提前致谢 编辑 使用ifconfig eth0 Link encap:Ethernet HWaddr 00:50:56:8f:68:e7 inet addr:192.168.108.13 Bcast:192.168.108.255 Mask:255.255.255.0 inet6 addr: fe80::250:56ff:fe8f:68e7/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:335609 errors:0 dropped:3107 overruns:0 frame:0 TX packets:48332 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:131610506 (131.6 MB) TX […]

阻止所有直接的IP请求,但允许域请求

什么是最好的Linux选项阻止所有直接的IP请求到公共接口IP,但同时允许某些fqdn(基于域的)请求? 例: 服务器的公共IP为166.137.1.1,www.mywebsite.com DNS指向该服务器和IP。 以下是一些情况: 请求166.137.1.1 – BLOCK(在所有端口上) 请求www.mywebsite.com – 允许(只有端口80和443) 请求www.maliciouswebsite.com哪些点不知道我的服务器的IP为166.137.1.1 – BLOCK(在所有端口上) 示例3给恶意用户提供了例如欺骗web服务器的环境variables(CGI范围)的能力,例如HTTP_HOST

在Debian 9 Stretch中是否有相当于“iptables-services”的软件包?

我想通过iptables-save而不是ufw或firewalld保存好的,老式的iptables命令来pipe理我的firewalld 。 对于RHEL来说,有一个叫做iptables-services简单包,就是这样做的。 (见这里 )对Debian来说,似乎没有一个。 我只能将iptables-restore </etc/default/iptables放到/etc/rc.local然后把它放在那里,但我想要一个更清洁的设置。 如果它可以作为一个systemctl单位它会是理想的。