Score:1

How can I set the destination to "anywhere" in the iptables?

us flag

As far as i understood with the following rule:

ACCEPT     tcp  --  anywhere             172.17.0.4           tcp dpt:25565

ubuntu allows connection via port 25565 but only to 172.17.0.4, but i want it to be reachable from anywhere. Ive tried something like

sudo iptables -A INPUT -p tcp --dport 25565 -j ACCEPT -d anywhere

but that doesn't work. Am I missing something? Maybe im totally wrong i don't know much about networking. My server i want to reach runs in a docker container if that makes any differences.

Score:1
us flag

You can omit the "-d ...", but INPUT is just to your local device.

When your destination is in another network (even if it is a virtual network) you need forwarding:

echo 1 > /proc/sys/net/ipv4/ip_forward

And the FORWARD chain is the right place to put your rules (but "ACCEPT" should already be the default)

Hint: iptables -S outputs the rules in the command-format

mangohost

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.