-1

Hi all into my ubuntu server I want to block the ftp port for all except my ip: 123.123.123.123

How is possible this?

1
  • Yes but I wanna be sure what I set into iptables because I have a lot of site into this server Jun 6, 2013 at 12:19

1 Answer 1

4

Write a rule which blocks all the incoming traffic for FTP, assuming the FTP port is 21:

iptables -A INPUT -p tcp --destination-port 21 -j DROP

Then write the following rule to exclude your IP from being blocked:

iptables -I INPUT -s 123.123.123.123 -p tcp --destination-port 21 -j ACCEPT

The -I parameter will insert the rule at the top of the stack. Since we didn't provide any rule number, it will be inserted at the top by default.

1
  • If I write the first iptables return me No chain/target/match by that name why? what is wrong? Jun 6, 2013 at 13:09

Not the answer you're looking for? Browse other questions tagged .