How to make an iptables accept an IP address?

How to make an iptables accept an IP address?

To make sure that all connections from or to an IP address are accepted, change -A to -I which inserts the rule at the top of the list: iptables -I INPUT -p tcp -s XXX.XXX.XXX.XXX -j ACCEPT iptables -I OUTPUT -p tcp -d XXX.XXX.XXX.XXX -j ACCEPT`

What does the s stand for in iptables?

-s indicates the source. For OUTPUT you’re going to want it as the destination ( -d ). -A appends. This adds the rule in the end of the rules list, so incoming connection could be dropped by a rule higher in the list.

How to change iptables status for remote server?

EDIT: with your advices i have changed iptables. still i can not connect to remote server. iptables status looks like this: I think you need change one of your -s flags to a -d flag. If your XXX.XXX.XXX.XXX address is outside the firewall, it should be -s indicates the source. For OUTPUT you’re going to want it as the destination ( -d ).

How to set a blacklist on iptables in Linux?

Match with blacklist and drop traffic iptables -I INPUT -m set –match-set blacklist src -j DROP iptables -I FORWARD -m set –match-set blacklist src -j DROP These commands will add the blacklist (or set) to the INPUT and FORWARD chains.

When to use-a or-C in iptables?

-A— Appends the iptablesrule to the end of the specified chain. This is the command used to add a rule when rule order in the chain does not matter. -C— Checks a particular rule before adding it to the user-specified chain.

When to use the outgoing rule in iptables?

The following rules allow outgoing ssh connection. i.e When you ssh from inside to an outside server. Please note that this is slightly different than the incoming rule. i.e We allow both the NEW and ESTABLISHED state on the OUTPUT chain, and only ESTABLISHED state on the INPUT chain. For the incoming rule, it is vice versa. 9.

How is a single connection identified in iptables?

A single connection is identified by the layer 3 and 4 connection information, e.g. the IP address and port respectively. To access this connection information, we use conntrack, which is an iptables module. With conntrack, you can create rules which access the connection of the current packet.