2017年1月3日 星期二

[Linux 常見問題] What are the iptables rules to permit ntp?

Source From Here
Question
My server's clock is wrong because the firewall doesn't permit NTP traffic. What are the iptables rules required to allow the NTP client to get out and back?

How-To
"out and back" implies you are an NTP client and want to talk to a server i'd imagine by default you can do this; if you haven't set up a firewall to block everything, and have iptables set up at all, you'll have a "allow related/established" rule which means replies to outgoing requests are allowed automatically. In any case, NTP is UDP port 123, so, assuming you are a CLIENT and want to access NTP servers you'd do:
# iptables -A OUTPUT -p udp --dport 123 -j ACCEPT
# iptables -A INPUT -p udp --sport 123 -j ACCEPT

these will append the rules to the end of your OUTPUT and INPUT chains.

Supplement
Saving IPTables Rules
# service iptables save 
or
// where is a user-defined name for your ruleset.
# iptables-save >


沒有留言:

張貼留言

[Git 常見問題] error: The following untracked working tree files would be overwritten by merge

  Source From  Here 方案1: // x -----删除忽略文件已经对 git 来说不识别的文件 // d -----删除未被添加到 git 的路径中的文件 // f -----强制运行 #   git clean -d -fx 方案2: 今天在服务器上  gi...