新之助meow

Kratos
专注于用户阅读体验的响应式博客主题
  1. 首页
  2. 未分类
  3. 正文

iptables 禁止某ip访问 记录日志

2017年10月7日 612点热度 3人点赞 0条评论

封单个IP的命令是:

iptables -I INPUT -s 211.1.0.0 -j DROP

参考:
Linux防火墙:iptables禁IP与解封IP常用命令

iptables记录日志:

suse 11 的 日志设置在 /etc/syslog-ng/syslog-ng.conf
在iptables添加日志选项
iptables -A INPUT -j LOG --log-prefix "iptables"

配置远程日志传输

Details
Edit the following file /etc/syslog-ng/syslog-ng.conf and uncomment or add the following line:
Make sure to uncomment or add this line to the source src block as such:

source src {
udp(ip("0.0.0.0") port(514));
};
If TCP is desired, change the line to read:
source src {
tcp(ip("0.0.0.0") port(514));
};

Restart the syslog service:
/etc/init.d/syslog restart
Verify that the syslog service is listening on the port specified by using the netstat program:

netstat -nap | grep syslog-ng
udp 0 0 0.0.0.0:514 0.0.0.0:* 8043/syslog-ng
If TCP is chosen as the protocol:
netstat -nap |grep syslog-ng
tcp 0 0 0.0.0.0:514 0.0.0.0:* 8043/syslog-ng

NOTE: If there is a firewall enabled, there must be an exception in place for the port chosen.
Setup the clients configuration:
Edit the /etc/syslog-ng/syslog-ng.conf file on the client machine and include/change the following information:

set up logging to loghost

destination loghost {
udp("192.168.93.163" port(514));
};

For TCP:

destination loghost {
tcp("192.168.93.163" port(514));
};

NOTE: Change the IP address to the ip address of the server that is acting as the loghost.

send everything to loghost

log {
source(src);
destination(loghost);
};

Restart the syslog service on the client machine:
/etc/init.d/syslog restart
Test the logging facility on the client to ensure logs are being forwarded to the loghost:
logger test testmessage
One should see test testmessage in /var/log/messages on both the client and the server.

参考:
linux 开启独立iptables日志
SUSE syslog-ng 设置
柏青哥的 SuSE Linux Enterprise Server 10 第九章 系統紀錄檔
iptables日志探秘
SUSE Linux Enterprise 11 Desktop/Server - How to Enable Remote Syslog Logging

标签: 暂无
最后更新:2017年10月7日

tjccn_wx@hotmail.com

这个人很懒,什么都没留下

点赞
< 上一篇
下一篇 >

文章评论

razz evil exclaim smile redface biggrin eek confused idea lol mad twisted rolleyes wink cool arrow neutral cry mrgreen drooling persevering
取消回复

归档

  • 2026 年 10 月
  • 2024 年 2 月
  • 2023 年 7 月
  • 2023 年 1 月
  • 2022 年 10 月
  • 2022 年 9 月
  • 2022 年 6 月
  • 2022 年 4 月
  • 2022 年 3 月
  • 2022 年 2 月
  • 2021 年 11 月
  • 2021 年 10 月
  • 2021 年 9 月
  • 2021 年 1 月
  • 2020 年 12 月
  • 2020 年 11 月
  • 2020 年 10 月
  • 2020 年 9 月
  • 2020 年 7 月
  • 2020 年 6 月
  • 2020 年 5 月
  • 2020 年 4 月
  • 2020 年 3 月
  • 2020 年 2 月
  • 2019 年 10 月
  • 2019 年 8 月
  • 2019 年 7 月
  • 2019 年 4 月
  • 2019 年 3 月
  • 2018 年 12 月
  • 2018 年 11 月
  • 2018 年 10 月
  • 2018 年 6 月
  • 2018 年 5 月
  • 2018 年 4 月
  • 2018 年 3 月
  • 2018 年 2 月
  • 2018 年 1 月
  • 2017 年 12 月
  • 2017 年 11 月
  • 2017 年 10 月
  • 2017 年 9 月
  • 2017 年 8 月
  • 2017 年 7 月
  • 2017 年 6 月
  • 2017 年 5 月
  • 2017 年 4 月
  • 2017 年 3 月
  • 2017 年 2 月
  • 2017 年 1 月
  • 2016 年 12 月
  • 2016 年 11 月
  • 2016 年 10 月
  • 2016 年 9 月
  • 2016 年 8 月
  • 2016 年 7 月
  • 2016 年 6 月
  • 2016 年 5 月
  • 2016 年 4 月
  • 2016 年 3 月
  • 2015 年 12 月
  • 2015 年 8 月

分类

  • android
  • mysql
  • nethunter
  • proxmark
  • 未分类

COPYRIGHT © 2026 新之助meow. ALL RIGHTS RESERVED.

Theme Kratos Made By Seaton Jiang