我有一個愚蠢的問題。我正在一個新的設施中放入一個新的系統日誌收集服務器。我們有許多不同類型的設備,我們正在同一端口上收集syslog。所以我必須將個人IP重定向到一個新的IP地址。在我們有人力登錄到每個設備並在單個設備內創建所需的更改之前,這是一個臨時解決方案。問題是我們正在重定向的一些傳入IP正在工作。有些沒有。iptables重定向udp系統日誌到另一個IP地址不轉發
我所要做的是以下YYYY:514期待XXXX: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 - 到目的地209.173.xxx.xxx:514 - 米評論--comment BAC:NameY
我可以看到從我的iptables查看169M已經通過了,這裏要說的是輸出視圖
[[email protected] ~]# 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
在我的PREROUTING鏈我沒有看到那個DNAT任何數據包,herre是輸出視圖:
[[email protected] ~]# 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
這裏是我使用 Server的服務器上的一些信息是在戴爾紅帽耳鼻喉科5的PowerEdge 2950與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的
這是我的sysctl [根@ XXXX〜]#貓/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'的輸出嗎? – Brightshine
請看我的回答,謝謝 – golgiapparatus
表過濾器中有很多包,但表nat中有很少包。在添加DNAT規則之前,主機是否有可能收到169M數據包? – Brightshine