- 论坛徽章:
- 0
|
今天参考了很多前辈的优秀在资料,在RedHat AS5上用iptables做NAT网关+远程使用kiwisyslog记录日志时,出现了一些小问题,请大家帮忙,谢谢!
[root@localhost etc]# uname -r
2.6.18-8.el5
[root@localhost rc.d]# more rc.local
i#!/bin/sh
#
# This script will be executed *after* all the other init scripts.
# You can put your own initialization stuff in here if you don't
# want to do the full Sys V style init stuff.
touch /var/lock/subsys/local
ifconfig eth0 124.161.X.X netmask 255.255.255.224
ifconfig eth2 192.168.7.1 netmask 255.255.255.0
route add default gw 124.161.X.1
route add -net 172.17.24.0 netmask 255.255.248.0 gw 192.168.7.2
route add -net 172.18.0.0 netmask 255.255.0.0 gw 192.168.7.2
route add -net 172.24.1.0 netmask 255.255.255.0 gw 192.168.7.2
route add -net 172.25.0.0 netmask 255.255.0.0 gw 192.168.7.2
route add -net 172.26.0.0 netmask 255.255.0.0 gw 192.168.7.2
route add -net 172.27.0.0 netmask 255.255.254.0 gw 192.168.7.2
route add -net 10.16.0.0 netmask 255.255.0.0 gw 192.168.7.2
iptables -F
#recevie syslog
iptables -I FORWARD -m state --state NEW -j LOG --log-level debug
#SNAT
iptables -t nat -A POSTROUTING -o eth0 -j SNAT --to 124.161.X.X
echo "1" > /proc/sys/net/ipv4/icmp_echo_ignore_broadcasts
echo "1" > /proc/sys/net/ipv4/ip_forward
rm -rf issue
rm -rf issue.net
cp logo issue
[root@localhost etc]# more syslog.conf
# Log all kernel messages to the console.
# Logging much else clutters up the screen.
#kern.* /dev/console
# Log anything (except mail) of level info or higher.
# Don't log private authentication messages!
*.info;mail.none;authpriv.none;cron.none /var/log/messages
# The authpriv file has restricted access.
authpriv.* /var/log/secure
# Log all the mail messages in one place.
mail.* -/var/log/maillog
# Log cron stuff
cron.* /var/log/cron
# Everybody gets emergency messages
*.emerg *
# Save news errors of level crit and higher in a special file.
uucp,news.crit /var/log/spooler
# Save boot messages also to boot.log
local7.* /var/log/boot.log
#remote net recevie stepup
kern.=debug @172.17.24.250
[root@localhost etc]#
在查寻dmesg时,出现很多如下的信息:该如何屏避掉
IN=eth2 OUT=eth0 SRC=10.16.32.124 DST=120.84.230.135 LEN=675 TOS=0x00 PREC=0x00 TTL=125 ID=47654 PROTO=UDP SPT=30596 DPT=1037 LEN=655
IN=eth2 OUT=eth0 SRC=10.16.3.156 DST=120.87.61.242 LEN=41 TOS=0x00 PREC=0x00 TTL=125 ID=36331 PROTO=UDP SPT=59238 DPT=1863 LEN=21
IN=eth2 OUT=eth0 SRC=10.16.3.156 DST=120.86.200.215 LEN=166 TOS=0x00 PREC=0x00 TTL=125 ID=36334 PROTO=UDP SPT=59238 DPT=1863 LEN=146
IN=eth2 OUT=eth0 SRC=10.16.64.167 DST=220.248.171.28 LEN=55 TOS=0x00 PREC=0x00 TTL=124 ID=24917 PROTO=UDP SPT=45998 DPT=31619 LEN=35
IN=eth2 OUT=eth0 SRC=10.16.64.167 DST=220.248.171.28 LEN=55 TOS=0x00 PREC=0x00 TTL=124 ID=24918 PROTO=UDP SPT=45998 DPT=31619 LEN=35
IN=eth2 OUT=eth0 SRC=10.16.64.150 DST=221.5.232.46 LEN=171 TOS=0x00 PREC=0x00 TTL=125 ID=19423 PROTO=UDP SPT=19371 DPT=51450 LEN=151
IN=eth2 OUT=eth0 SRC=10.16.34.66 DST=120.82.36.252 LEN=70 TOS=0x00 PREC=0x00 TTL=125 ID=29281 PROTO=UDP SPT=1100 DPT=8354 LEN=50
IN=eth2 OUT=eth0 SRC=10.16.36.221 DST=221.7.254.157 LEN=41 TOS=0x00 PREC=0x00 TTL=125 ID=60380 PROTO=UDP SPT=1793 DPT=800 LEN=21
IN=eth2 OUT=eth0 SRC=10.16.1.81 DST=110.72.49.134 LEN=52 TOS=0x00 PREC=0x00 TTL=125 ID=23995 DF PROTO=TCP SPT=6188 DPT=19468 WINDOW=16384 RES=0x00 SYN URGP=0
IN=eth2 OUT=eth0 SRC=10.16.7.61 DST=221.5.156.195 LEN=200 TOS=0x00 PREC=0x00 TTL=125 ID=1603 PROTO=UDP SPT=29909 DPT=29909 LEN=180
IN=eth2 OUT=eth0 SRC=10.16.34.210 DST=113.205.33.248 LEN=41 TOS=0x00 PREC=0x00 TTL=125 ID=4831 PROTO=UDP SPT=16096 DPT=2365 LEN=21
IN=eth2 OUT=eth0 SRC=10.16.34.210 DST=113.205.33.248 LEN=41 TOS=0x00 PREC=0x00 TTL=125 ID=4832 PROTO=UDP SPT=16096 DPT=2365 LEN=21
IN=eth2 OUT=eth0 SRC=10.16.34.210 DST=113.205.33.248 LEN=41 TOS=0x00 PREC=0x00 TTL=125 ID=4833 PROTO=UDP SPT=16096 DPT=2365 LEN=21
IN=eth2 OUT=eth0 SRC=10.16.34.210 DST=113.205.33.248 LEN=41 TOS=0x00 PREC=0x00 TTL=125 ID=4834 PROTO=UDP SPT=16096 DPT=2365 LEN=21
IN=eth2 OUT=eth0 SRC=10.16.34.210 DST=113.205.33.248 LEN=41 TOS=0x00 PREC=0x00 TTL=125 ID=4835 PROTO=UDP SPT=16096 DPT=2365 LEN=21
IN=eth2 OUT=eth0 SRC=10.16.65.254 DST=221.13.54.110 LEN=52 TOS=0x00 PREC=0x00 TTL=125 ID=3946 DF PROTO=TCP SPT=51452 DPT=80 WINDOW=8192 RES=0x00 SYN URGP=0
IN=eth2 OUT=eth0 SRC=10.16.2.177 DST=58.20.210.137 LEN=64 TOS=0x00 PREC=0x00 TTL=125 ID=54086 DF PROTO=TCP SPT=43418 DPT=12171 WINDOW=16384 RES=0x00 SYN URGP=0
IN=eth2 OUT=eth0 SRC=10.16.96.189 DST=123.147.248.198 LEN=169 TOS=0x00 PREC=0x00 TTL=125 ID=36242 PROTO=UDP SPT=1863 DPT=55735 LEN=149
IN=eth2 OUT=eth0 SRC=10.16.0.94 DST=115.46.241.246 LEN=59 TOS=0x00 PREC=0x00 TTL=124 ID=58526 PROTO=UDP SPT=59043 DPT=11203 LEN=39
IN=eth2 OUT=eth0 SRC=10.16.0.94 DST=115.46.241.246 LEN=59 TOS=0x00 PREC=0x00 TTL=124 ID=58527 PROTO=UDP SPT=59043 DPT=25771 LEN=39 |
|