1

I am trying to add a rule to my Ubuntu 14 iptables to allow NTP (123) though using the command for allowing Incoming Traffic on Specific Ports Basic iptables How to?

Here is my command:

sudo iptables -A INPUT -p tcp --dport ntp -j ACCEPT

After I run that I then see and entry in iptables -L liek this:

ACCEPT     tcp  --  anywhere             anywhere             tcp dpt:ntp

So I then use two external sites to do a port scan on that port and both come back and say the port is closed. So I rebooted, no change. I then wanted to remove the entry from iptables:

DROP       tcp  --  anywhere             anywhere             tcp dpt:ntp

That did not have the desired affect because now I have something like this: ACCEPT tcp -- anywhere anywhere tcp dpt:ntp ACCEPT tcp -- anywhere anywhere tcp dpt:ntp DROP tcp -- anywhere anywhere tcp dpt:ntp ACCEPT tcp -- anywhere anywhere tcp dpt:ntp

I decided to stop there as I am not sure what I am doing wrong. Is there a command I need to run to actually open the port?

2

AFAIK, NTP works on UDP. So you can try something like,

sudo iptables -A OUTPUT -p udp --dport 123 --sport 1024:65535 -j ACCEPT
sudo iptables -A INPUT -p udp --sport 123 --dport 1024:65535 -j ACCEPT
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.