How to alter ACCEPT to DROP with specific destination in iptables

in flag

I have this entry in iptables ACCEPT tcp -- anywhere tcp dpt:4210. I want to alter ACCEPT to DROP. I tried using sudo /sbin/iptables -A DOCKER -p tcp -d --destination-port 4210 -j DROP but it only creates another version of entry with DROP in target column. However, 4210 still worked after tables was saved. How could I alter target column and not create a new entry? Basically, I need that to work in python script,therefore, I don't want to use replace with -R because of need of index.


Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.