Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Hi all into my Ubuntu server I want to block ftp port for all but I when I launch command:

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

Return me this error: iptables: No chain/target/match by that name

The lines of command:

root@webanddesignsrl-one:/# iptables -A input -p tcp --destination-port 21 -j DROP
iptables: No chain/target/match by that name.

i have seen many question about it:

iptables: No chain/target/match by that name
iptables: No chain/target/match by that name.
iptables error: No chain/target/match by that name?

no one helps me. how can I solve?

The server is an Ubuntu 10.04

output of lsmod is:

binfmt_misc             7960  1 
act_police              4620  0 
cls_flow                7754  0 
cls_fw                  4283  0 
cls_u32                 6698  0 
sch_htb                15660  0 
sch_hfsc               15167  0 
sch_ingress             2098  0 
sch_sfq                 5863  0 
xt_time                 2181  0 
xt_connlimit            3396  0 
xt_realm                1058  0 
iptable_raw             2230  0 
xt_comment              1032  18 
xt_recent               8218  0 
xt_policy               2614  0 
ipt_ULOG                8199  0 
ipt_REJECT              2384  4 
ipt_REDIRECT            1269  0 
ipt_NETMAP              1261  0 
ipt_MASQUERADE          1863  0 
ipt_ECN                 1953  0 
ipt_ecn                 1505  0 
ipt_CLUSTERIP           6151  0 
ipt_ah                  1245  0 
ipt_addrtype            2151  4 
nf_nat_tftp             1017  0 
nf_nat_snmp_basic       8796  0 
nf_nat_sip              6169  0 
nf_nat_pptp             2245  0 
nf_nat_proto_gre        1719  1 nf_nat_pptp
nf_nat_irc              1577  0 
nf_nat_h323             5978  0 
nf_nat_ftp              2513  0 
nf_nat_amanda           1275  0 
ts_kmp                  1933  5 
nf_conntrack_amanda     2977  1 nf_nat_amanda
nf_conntrack_sane       4240  0 
nf_conntrack_tftp       4001  1 nf_nat_tftp
nf_conntrack_sip       18894  1 nf_nat_sip
nf_conntrack_proto_sctp     8072  0 
nf_conntrack_pptp       5566  1 nf_nat_pptp
nf_conntrack_proto_gre     4798  1 nf_conntrack_pptp
nf_conntrack_netlink    16910  0 
nf_conntrack_netbios_ns     1662  0 
nf_conntrack_irc        4429  1 nf_nat_irc
nf_conntrack_h323      55193  1 nf_nat_h323
nf_conntrack_ftp        7126  1 nf_nat_ftp
xt_tcpmss               1605  0 
xt_pkttype              1160  0 
xt_physdev              1739  0 
xt_owner                1250  0 
xt_NFQUEUE              2344  0 
xt_NFLOG                1193  0 
nfnetlink_log           9053  1 xt_NFLOG
xt_multiport            2794  5 
xt_MARK                 1055  1 
xt_mark                 1055  0 
xt_mac                  1116  0 
xt_limit                2180  0 
xt_length               1320  0 
xt_iprange              1645  0 
xt_helper               1463  0 
xt_hashlimit           10027  0 
xt_DSCP                 2277  0 
xt_dscp                 1829  0 
xt_dccp                 2213  0 
xt_conntrack            2774  0 
xt_CONNMARK             1473  0 
xt_connmark             1345  0 
xt_CLASSIFY             1067  0 
ipt_LOG                 5370  9 
xt_tcpudp               2667  16 
xt_state                1490  6 
iptable_nat             5219  0 
nf_nat                 19501  12 ipt_REDIRECT,ipt_NETMAP,ipt_MASQUERADE,nf_nat_tftp,nf_nat_sip,nf_nat_pptp,nf_nat_proto_gre,nf_nat_irc,nf_nat_h323,nf_nat_ftp,nf_nat_amanda,iptable_nat
nf_conntrack_ipv4      12980  9 iptable_nat,nf_nat
nf_defrag_ipv4          1481  1 nf_conntrack_ipv4
nf_conntrack           73966  31 xt_connlimit,ipt_MASQUERADE,ipt_CLUSTERIP,nf_nat_tftp,nf_nat_snmp_basic,nf_nat_sip,nf_nat_pptp,nf_nat_irc,nf_nat_h323,nf_nat_ftp,nf_nat_amanda,nf_conntrack_amanda,nf_conntrack_sane,nf_conntrack_tftp,nf_conntrack_sip,nf_conntrack_proto_sctp,nf_conntrack_pptp,nf_conntrack_proto_gre,nf_conntrack_netlink,nf_conntrack_netbios_ns,nf_conntrack_irc,nf_conntrack_h323,nf_conntrack_ftp,xt_helper,xt_conntrack,xt_CONNMARK,xt_connmark,xt_state,iptable_nat,nf_nat,nf_conntrack_ipv4
iptable_mangle          3315  1 
nfnetlink               4142  2 nf_conntrack_netlink,nfnetlink_log
iptable_filter          2791  1 
ip_tables              18358  4 iptable_raw,iptable_nat,iptable_mangle,iptable_filter
x_tables               22461  43 xt_time,xt_connlimit,xt_realm,xt_comment,xt_recent,xt_policy,ipt_ULOG,ipt_REJECT,ipt_REDIRECT,ipt_NETMAP,ipt_MASQUERADE,ipt_ECN,ipt_ecn,ipt_CLUSTERIP,ipt_ah,ipt_addrtype,xt_tcpmss,xt_pkttype,xt_physdev,xt_owner,xt_NFQUEUE,xt_NFLOG,xt_multiport,xt_MARK,xt_mark,xt_mac,xt_limit,xt_length,xt_iprange,xt_helper,xt_hashlimit,xt_DSCP,xt_dscp,xt_dccp,xt_conntrack,xt_CONNMARK,xt_connmark,xt_CLASSIFY,ipt_LOG,xt_tcpudp,xt_state,iptable_nat,ip_tables
xen_netfront           17890  0 
xen_blkfront           10665  2 

iptables -L -n -v ouptut:

Chain INPUT (policy DROP 0 packets, 0 bytes)
 pkts bytes target     prot opt in     out     source               destination         
 754K   78M fail2ban-ssh  tcp  --  *      *       0.0.0.0/0            0.0.0.0/0           multiport dports 22 
1526K   96M dynamic    all  --  *      *       0.0.0.0/0            0.0.0.0/0           state INVALID,NEW 
  24M 2925M ACCEPT     all  --  *      *       0.0.0.0/0            0.0.0.0/0           state RELATED,ESTABLISHED 
1286K   82M net2fw     all  --  eth0   *       0.0.0.0/0            0.0.0.0/0           
    0     0 vpn2fw     all  --  tun0   *       0.0.0.0/0            0.0.0.0/0           
 240K   14M ACCEPT     all  --  lo     *       0.0.0.0/0            0.0.0.0/0           
    0     0 Reject     all  --  *      *       0.0.0.0/0            0.0.0.0/0           
    0     0 LOG        all  --  *      *       0.0.0.0/0            0.0.0.0/0           LOG flags 0 level 6 prefix `Shorewall:INPUT:REJECT:' 
    0     0 reject     all  --  *      *       0.0.0.0/0            0.0.0.0/0           [goto] 

Chain FORWARD (policy DROP 0 packets, 0 bytes)
 pkts bytes target     prot opt in     out     source               destination         
    0     0 dynamic    all  --  *      *       0.0.0.0/0            0.0.0.0/0           state INVALID,NEW 
    0     0 ACCEPT     all  --  *      *       0.0.0.0/0            0.0.0.0/0           state RELATED,ESTABLISHED 
    0     0 net2vpn    all  --  eth0   tun0    0.0.0.0/0            0.0.0.0/0           
    0     0 vpn2net    all  --  tun0   eth0    0.0.0.0/0            0.0.0.0/0           
    0     0 Reject     all  --  *      *       0.0.0.0/0            0.0.0.0/0           
    0     0 LOG        all  --  *      *       0.0.0.0/0            0.0.0.0/0           LOG flags 0 level 6 prefix `Shorewall:FORWARD:REJECT:' 
    0     0 reject     all  --  *      *       0.0.0.0/0            0.0.0.0/0           [goto] 

Chain OUTPUT (policy DROP 0 packets, 0 bytes)
 pkts bytes target     prot opt in     out     source               destination         
  16M   42G ACCEPT     all  --  *      *       0.0.0.0/0            0.0.0.0/0           state RELATED,ESTABLISHED 
71152 6791K fw2net     all  --  *      eth0    0.0.0.0/0            0.0.0.0/0           
    0     0 fw2vpn     all  --  *      tun0    0.0.0.0/0            0.0.0.0/0           
 240K   14M ACCEPT     all  --  *      lo      0.0.0.0/0            0.0.0.0/0           
    0     0 Reject     all  --  *      *       0.0.0.0/0            0.0.0.0/0           
    0     0 LOG        all  --  *      *       0.0.0.0/0            0.0.0.0/0           LOG flags 0 level 6 prefix `Shorewall:OUTPUT:REJECT:' 
    0     0 reject     all  --  *      *       0.0.0.0/0            0.0.0.0/0           [goto] 

Chain Drop (0 references)
 pkts bytes target     prot opt in     out     source               destination         
    0     0            all  --  *      *       0.0.0.0/0            0.0.0.0/0           
    0     0 reject     tcp  --  *      *       0.0.0.0/0            0.0.0.0/0           tcp dpt:113 /* Auth */ 
    0     0 dropBcast  all  --  *      *       0.0.0.0/0            0.0.0.0/0           
    0     0 ACCEPT     icmp --  *      *       0.0.0.0/0            0.0.0.0/0           icmp type 3 code 4 /* Needed ICMP types */ 
    0     0 ACCEPT     icmp --  *      *       0.0.0.0/0            0.0.0.0/0           icmp type 11 /* Needed ICMP types */ 
    0     0 dropInvalid  all  --  *      *       0.0.0.0/0            0.0.0.0/0           
    0     0 DROP       udp  --  *      *       0.0.0.0/0            0.0.0.0/0           multiport dports 135,445 /* SMB */ 
    0     0 DROP       udp  --  *      *       0.0.0.0/0            0.0.0.0/0           udp dpts:137:139 /* SMB */ 
    0     0 DROP       udp  --  *      *       0.0.0.0/0            0.0.0.0/0           udp spt:137 dpts:1024:65535 /* SMB */ 
    0     0 DROP       tcp  --  *      *       0.0.0.0/0            0.0.0.0/0           multiport dports 135,139,445 /* SMB */ 
    0     0 DROP       udp  --  *      *       0.0.0.0/0            0.0.0.0/0           udp dpt:1900 /* UPnP */ 
    0     0 dropNotSyn  tcp  --  *      *       0.0.0.0/0            0.0.0.0/0           
    0     0 DROP       udp  --  *      *       0.0.0.0/0            0.0.0.0/0           udp spt:53 /* Late DNS Replies */ 

Chain Reject (7 references)
 pkts bytes target     prot opt in     out     source               destination         
 253K   27M            all  --  *      *       0.0.0.0/0            0.0.0.0/0           
    0     0 reject     tcp  --  *      *       0.0.0.0/0            0.0.0.0/0           tcp dpt:113 /* Auth */ 
 253K   27M dropBcast  all  --  *      *       0.0.0.0/0            0.0.0.0/0           
    0     0 ACCEPT     icmp --  *      *       0.0.0.0/0            0.0.0.0/0           icmp type 3 code 4 /* Needed ICMP types */ 
    0     0 ACCEPT     icmp --  *      *       0.0.0.0/0            0.0.0.0/0           icmp type 11 /* Needed ICMP types */ 
16815  783K dropInvalid  all  --  *      *       0.0.0.0/0            0.0.0.0/0           
    0     0 reject     udp  --  *      *       0.0.0.0/0            0.0.0.0/0           multiport dports 135,445 /* SMB */ 
    0     0 reject     udp  --  *      *       0.0.0.0/0            0.0.0.0/0           udp dpts:137:139 /* SMB */ 
    0     0 reject     udp  --  *      *       0.0.0.0/0            0.0.0.0/0           udp spt:137 dpts:1024:65535 /* SMB */ 
  920 46820 reject     tcp  --  *      *       0.0.0.0/0            0.0.0.0/0           multiport dports 135,139,445 /* SMB */ 
    0     0 DROP       udp  --  *      *       0.0.0.0/0            0.0.0.0/0           udp dpt:1900 /* UPnP */ 
10408  517K dropNotSyn  tcp  --  *      *       0.0.0.0/0            0.0.0.0/0           
    0     0 DROP       udp  --  *      *       0.0.0.0/0            0.0.0.0/0           udp spt:53 /* Late DNS Replies */ 

Chain dropBcast (2 references)
 pkts bytes target     prot opt in     out     source               destination         
 236K   26M DROP       all  --  *      *       0.0.0.0/0            0.0.0.0/0           ADDRTYPE match dst-type BROADCAST 
    0     0 DROP       all  --  *      *       0.0.0.0/0            224.0.0.0/4         

Chain dropInvalid (2 references)
 pkts bytes target     prot opt in     out     source               destination         
 5487  219K DROP       all  --  *      *       0.0.0.0/0            0.0.0.0/0           state INVALID 

Chain dropNotSyn (2 references)
 pkts bytes target     prot opt in     out     source               destination         
    0     0 DROP       tcp  --  *      *       0.0.0.0/0            0.0.0.0/0           tcp flags:!0x17/0x02 

Chain dynamic (2 references)
 pkts bytes target     prot opt in     out     source               destination         

Chain fail2ban-ssh (1 references)
 pkts bytes target     prot opt in     out     source               destination         
 750K   78M RETURN     all  --  *      *       0.0.0.0/0            0.0.0.0/0           

Chain fw2net (1 references)
 pkts bytes target     prot opt in     out     source               destination         
71152 6791K ACCEPT     all  --  *      *       0.0.0.0/0            0.0.0.0/0           

Chain fw2vpn (1 references)
 pkts bytes target     prot opt in     out     source               destination         
    0     0 Reject     all  --  *      *       0.0.0.0/0            0.0.0.0/0           
    0     0 LOG        all  --  *      *       0.0.0.0/0            0.0.0.0/0           LOG flags 0 level 6 prefix `Shorewall:fw2vpn:REJECT:' 
    0     0 reject     all  --  *      *       0.0.0.0/0            0.0.0.0/0           [goto] 

Chain logdrop (0 references)
 pkts bytes target     prot opt in     out     source               destination         
    0     0 DROP       all  --  *      *       0.0.0.0/0            0.0.0.0/0           

Chain logreject (0 references)
 pkts bytes target     prot opt in     out     source               destination         
    0     0 reject     all  --  *      *       0.0.0.0/0            0.0.0.0/0           

Chain net2fw (1 references)
 pkts bytes target     prot opt in     out     source               destination         
    0     0 ACCEPT     udp  --  *      *       0.0.0.0/0            0.0.0.0/0           udp dpt:1723 
 1812  103K ACCEPT     tcp  --  *      *       0.0.0.0/0            0.0.0.0/0           tcp dpt:22 
 4565  260K ACCEPT     tcp  --  *      *       0.0.0.0/0            0.0.0.0/0           tcp dpt:21 
1026K   55M ACCEPT     tcp  --  *      *       0.0.0.0/0            0.0.0.0/0           tcp dpt:80 
  306 15344 ACCEPT     tcp  --  *      *       0.0.0.0/0            0.0.0.0/0           tcp dpt:8080 
 253K   27M Reject     all  --  *      *       0.0.0.0/0            0.0.0.0/0           
10408  517K LOG        all  --  *      *       0.0.0.0/0            0.0.0.0/0           LOG flags 0 level 6 prefix `Shorewall:net2fw:REJECT:' 
10408  517K reject     all  --  *      *       0.0.0.0/0            0.0.0.0/0           [goto] 

Chain net2vpn (1 references)
 pkts bytes target     prot opt in     out     source               destination         
    0     0 Reject     all  --  *      *       0.0.0.0/0            0.0.0.0/0           
    0     0 LOG        all  --  *      *       0.0.0.0/0            0.0.0.0/0           LOG flags 0 level 6 prefix `Shorewall:net2vpn:REJECT:' 
    0     0 reject     all  --  *      *       0.0.0.0/0            0.0.0.0/0           [goto] 

Chain reject (14 references)
 pkts bytes target     prot opt in     out     source               destination         
    0     0 DROP       all  --  *      *       0.0.0.0/0            0.0.0.0/0           ADDRTYPE match src-type BROADCAST 
    0     0 DROP       all  --  *      *       224.0.0.0/4          0.0.0.0/0           
    0     0 DROP       2    --  *      *       0.0.0.0/0            0.0.0.0/0           
11328  564K REJECT     tcp  --  *      *       0.0.0.0/0            0.0.0.0/0           reject-with tcp-reset 
    0     0 REJECT     udp  --  *      *       0.0.0.0/0            0.0.0.0/0           reject-with icmp-port-unreachable 
    0     0 REJECT     icmp --  *      *       0.0.0.0/0            0.0.0.0/0           reject-with icmp-host-unreachable 
    0     0 REJECT     all  --  *      *       0.0.0.0/0            0.0.0.0/0           reject-with icmp-host-prohibited 

Chain shorewall (0 references)
 pkts bytes target     prot opt in     out     source               destination         

Chain smurfs (0 references)
 pkts bytes target     prot opt in     out     source               destination         
    0     0 RETURN     all  --  *      *       0.0.0.0              0.0.0.0/0           
    0     0 LOG        all  --  *      *       0.0.0.0/0            0.0.0.0/0           ADDRTYPE match src-type BROADCAST LOG flags 0 level 6 prefix `Shorewall:smurfs:DROP:' 
    0     0 DROP       all  --  *      *       0.0.0.0/0            0.0.0.0/0           ADDRTYPE match src-type BROADCAST 
    0     0 LOG        all  --  *      *       224.0.0.0/4          0.0.0.0/0           LOG flags 0 level 6 prefix `Shorewall:smurfs:DROP:' 
    0     0 DROP       all  --  *      *       224.0.0.0/4          0.0.0.0/0           

Chain vpn2fw (1 references)
 pkts bytes target     prot opt in     out     source               destination         
    0     0 ACCEPT     all  --  *      *       0.0.0.0/0            0.0.0.0/0           

Chain vpn2net (1 references)
 pkts bytes target     prot opt in     out     source               destination         
    0     0 Reject     all  --  *      *       0.0.0.0/0            0.0.0.0/0           
    0     0 LOG        all  --  *      *       0.0.0.0/0            0.0.0.0/0           LOG flags 0 level 6 prefix `Shorewall:vpn2net:REJECT:' 
    0     0 reject     all  --  *      *       0.0.0.0/0            0.0.0.0/0           [goto] 
share|improve this question

closed as not a real question by MDMarra, mdpc, Ward, Rex, Tim Brigham Jun 7 '13 at 17:02

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.If this question can be reworded to fit the rules in the help center, please edit the question.

    
What linux distribution are you using? –  Tom O'Connor Jun 6 '13 at 15:44
    
Linux Ubuntu @TomO'Connor –  Alessandro Minoccheri Jun 6 '13 at 15:45
    
Command WFM under Ubuntu 13.04. What is the output of lsmod? –  Mark Wagner Jun 6 '13 at 17:11
    
ubuntu 10.04 @MarkWagner –  Alessandro Minoccheri Jun 7 '13 at 9:45
    
update answer with lsmod output @MarkWagner –  Alessandro Minoccheri Jun 7 '13 at 9:47
show 10 more comments

2 Answers

up vote 3 down vote accepted

Look, Alessandro, you told us you typed iptables -A INPUT but when - after much prodding - you finally cut-and-pasted it, it turns out you're typing iptables -A input. These are not the same thing. iptables - like much of UNIX - is case-sensitive.

Try using iptables -A INPUT -p tcp --dport 21 -j DROP and it should work much better.

In addition, this rule you're adding will do nothing, because it will never see ftp traffic. This has already been permitted by rule 3 in chain net2fw. If you want to block incoming ftp connections, you'll need to do iptables -D net2fw 3 instead.

share|improve this answer
    
oh man thanks a lot! you have saved me mine error... sorry but now I have understand well –  Alessandro Minoccheri Jun 7 '13 at 11:04
2  
Next time we ask you to show not tell, well, hopefully you see why we ask this. –  MadHatter Jun 7 '13 at 11:05
add comment

What about this?

iptables -A INPUT -p tcp --dport 21 -j DROP
share|improve this answer
    
same thing sorry –  Alessandro Minoccheri Jun 7 '13 at 10:30
add comment

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