iptables将udp系统日志重定向到另一个IP地址,但不转发

iptables将udp系统日志重定向到另一个IP地址,但不转发,udp,iptables,syslog,forward,Udp,Iptables,Syslog,Forward,我有个愚蠢的问题。我正在一个新的设施中安装一个新的syslog收集服务器。我们有许多不同类型的设备,在同一端口上收集系统日志。因此,我必须将单个IP重定向到一个新的IP地址。这是一个临时解决方案,直到我们有人力登录到每个设备,并在单个设备内创建所需的更改。问题是,我们正在重定向一些传入的IP。有些人没有 我想做的是将下面的Y.Y.Y.Y:514转发到X.X.X.X:514 我在中有一个iptable规则,用于允许源74.93.xxx.xxx目标208.67.xxx.xxx目标端口514。然后我有

我有个愚蠢的问题。我正在一个新的设施中安装一个新的syslog收集服务器。我们有许多不同类型的设备,在同一端口上收集系统日志。因此,我必须将单个IP重定向到一个新的IP地址。这是一个临时解决方案,直到我们有人力登录到每个设备,并在单个设备内创建所需的更改。问题是,我们正在重定向一些传入的IP。有些人没有

我想做的是将下面的Y.Y.Y.Y:514转发到X.X.X.X:514

我在中有一个iptable规则,用于允许源74.93.xxx.xxx目标208.67.xxx.xxx目标端口514。然后我有一个预路由,包含以下信息 iptables-t nat-A PREROUTING-i eth0-s 74.93.xxx.xxx-p udp--dport 514-j DNAT--to destination 209.173.xxx.xxx:514-m comment--comment BAC:NameY

我可以从iptables视图中看到169M已经传入,这是输出视图

[root@XXXXX ~]# iptables -L -v -n --line-numbers
Chain INPUT (policy ACCEPT 79M packets, 29G bytes)
num   pkts bytes target     prot opt in     out     source               destination
1     572K  169M ACCEPT     udp  --  eth0   *       74.93.xxx.xxx        208.67.xxx.xxx      udp dpt:514 /* NameY */
2     115M   25G ACCEPT     udp  --  *      *       0.0.0.0/0            0.0.0.0/0           udp dpt:514

Chain FORWARD (policy ACCEPT 239M packets, 63G bytes)
num   pkts bytes target     prot opt in     out     source               destination

Chain OUTPUT (policy ACCEPT 29M packets, 11G bytes)
num   pkts bytes target     prot opt in     out     source               destination
在我的预路由链中,我没有看到该DNAT的任何数据包,herre是输出视图:

[root@XXXXX ~]# iptables -t nat -L -n -v --line-numbers
Chain PREROUTING (policy ACCEPT 107K packets, 33M bytes)
num   pkts bytes target     prot opt in     out     source               destination
1        0     0 DNAT       udp  --  eth0   *       74.93.xxx.xxx        0.0.0.0/0           udp dpt:514 /* NameY */ to:209.173.xxx.xxx:514
2     3468  676K DNAT       udp  --  eth0   *       205.201.xxx.xxx      0.0.0.0/0           udp dpt:514 /* NameB */ to:209.173.xxx.xxx:514
3    80425   21M DNAT       udp  --  eth0   *       0.0.0.0/0            0.0.0.0/0           udp dpt:516 to:209.173.xxx.xxx:514

Chain POSTROUTING (policy ACCEPT 162 packets, 9467 bytes)
num   pkts bytes target     prot opt in     out     source               destination
1     188K   28M MASQUERADE  all  --  *      eth0    0.0.0.0/0            0.0.0.0/0

Chain OUTPUT (policy ACCEPT 107K packets, 6473K bytes)
num   pkts bytes target     prot opt in     out     source               destination
下面是我正在使用的服务器的一些信息 服务器是Dell Poweredge 2950上的Redhat Ent 5,具有32GB ram Linux 2.6.18-348.el5#1 SMP周三11月28日21:22:00 EST 2012 x86_64 x86_64 x86_64 GNU/Linux

这是我的系统代码 [root@XXXX~]#cat/etc/sysctl.conf #Red Hat Linux的内核sysctl配置文件 # #对于二进制值,0被禁用,1被启用。参见sysctl(8)和 #sysctl.conf(5)获取更多详细信息

# Controls IP packet forwarding
net.ipv4.ip_forward = 1

# Controls source route verification
net.ipv4.conf.default.rp_filter = 1

# Do not accept source routing
net.ipv4.conf.default.accept_source_route = 0

# Controls the System Request debugging functionality of the kernel
kernel.sysrq = 0

# Controls whether core dumps will append the PID to the core filename
# Useful for debugging multi-threaded applications
kernel.core_uses_pid = 1

# Controls the use of TCP syncookies
net.ipv4.tcp_syncookies = 1

# Controls the maximum size of a message, in bytes
kernel.msgmnb = 65536

# Controls the default maxmimum size of a mesage queue
kernel.msgmax = 65536

# Controls the maximum shared segment size, in bytes
kernel.shmmax = 68719476736

# Controls the maximum number of shared memory segments, in pages
kernel.shmall = 4294967296
是否有我做错的事情,为什么我不能将74.93.xxx.xxx转发到新IP? 谢谢你的帮助,欢迎大家发表意见


golgiapparatus

这是我的ifconfig的输出。出于安全原因,我更改了一些信息

[root@myname ~]# ifconfig
eth0      Link encap:Ethernet  HWaddr 00:24:E8:62:AE:2F
          inet addr:208.67.xxx.xxx Bcast:208.67.xxx.yyy  Mask:255.255.255.224
          inet6 addr: fe80::124:e6ff:fe51:ae8f/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:764714795 errors:0 dropped:23 overruns:0 frame:0
          TX packets:436520147 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:218689483470 (203.6 GiB)  TX bytes:125953479839 (117.3 GiB)
          Interrupt:169 Memory:f8000000-f8012800

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:5290847 errors:0 dropped:0 overruns:0 frame:0
          TX packets:5290847 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:3124832137 (2.9 GiB)  TX bytes:3124832137 (2.9 GiB)

您能提供
ifconfig
的输出吗?请看我的答案,谢谢。表filter中有许多数据包,但表nat中的数据包很少。主机是否可能在添加DNAT规则之前收到169M个数据包?