I am trying to add a rule which looks like:
Chain DOCKER (2 references)
target prot opt source destination
ACCEPT tcp -- anywhere 172.18.0.8 tcp dpt:21102
I am using the following command:
sudo iptables -A DOCKER -t tcp -s anywhere -d 172.18.0.8 --dport 21102 -j ACCEPT
However, I am getting the following error:
table 'tcp' does not exist
Perhaps iptables or your kernel needs to be upgraded.
Can someone please guide me where am I going wrong ?
-t
: Specifies the packet matching table such as nat, filter, raw.etc
-p
: Sets the IP protocol for the rule, which can be either icmp, tcp, udp, or all.
So the command should be:
sudo iptables -A DOCKER -p tcp -s {source_ip} -d 172.18.0.8 --dport 21102 -j ACCEPT