Questions tagged [iptables]

GENERAL IPTABLES SUPPORT IS OFF-TOPIC. Support questions may be asked on https://superuser.com. An application that allows administrators to configure the packet processing tables provided by the Linux kernel firewall. Use this tag only for questions on programming with iptables. Questions about configuring iptables should be asked on Server Fault (https://serverfault.com/tour).

An application that allows administrators to configure the packet processing tables provided by the Linux kernel firewall. Use this tag only for questions on programming with iptables. Questions about configuring iptables should be asked on Server Fault.

Links:
Linux Firewall Tutorial: IPTables Tables, Chains, Rules Fundamentals
Iptables Essentials: Common Firewall Rules and Commands

2035 questions
37
votes
2 answers

Installing iptables in docker container based on alpinelinux

I am writing a dockerfile and I need IPtables to be installed in docker container. I need to add a rule to the IP table as I am trying to run on "host" network mode and it seems I need install IPtables for this purpose. when I try to include the…
Tharanga
  • 2,007
  • 4
  • 32
  • 50
36
votes
4 answers

How to permanently update iptables

I'm trying to redirect http traffic to port 8080 on the same machine and have the iptables rules below working. iptables -t nat -A PREROUTING -p tcp --dport 80 -j REDIRECT --to-ports 8080 iptables -t nat -A OUTPUT -p tcp --dport 80 -j REDIRECT…
hafichuk
  • 10,351
  • 10
  • 38
  • 53
35
votes
6 answers

iptables in android

Are IPtables inbuilt in android kernel? If they are, how to use them in our android application?
Preetam
  • 5,528
  • 10
  • 32
  • 39
35
votes
5 answers

iptables LOG and DROP in one rule

I am trying to log outgoing connections with iptables. What I want is, drop and accept connection while logging them also. I have found that -j option takes DROP/REJECT/ACCEPT/LOG. But I want to do something like DROP and LOG or ACCEPT and LOG. Is…
Abhay PS
  • 4,015
  • 5
  • 25
  • 32
35
votes
4 answers

How to connect to Docker API from another machine?

I'm trying to use the Docker API to connect to docker daemon from another machine. I am able to do this command successfully: docker -H=tcp://127.0.0.1:4243 images But NOT when I use the real IP address: docker -H=tcp://192.168.2.123:4243…
Victor Lyuboslavsky
  • 9,882
  • 25
  • 87
  • 134
33
votes
1 answer

How to check PREROUTING list from iptable in linux?

I added packet forwarding rule in my iptable sudo iptables -t nat -A PREROUTING -p tcp --dport 1111 -j DNAT --to-destination 10.0.3.126:80 and I can see that the packet coming to port 1111 is correctly forwarded to 10.0.3.126:80. However if I list…
John Doyle
  • 898
  • 2
  • 9
  • 22
33
votes
1 answer

How to do local port forwarding with iptables

I have an application (server) listening on port 8080. I want to be able to forward port 80 to it, such that hitting http://localhost resolves my application (on localhost:8080). This should be generalized for any port mapping (e.g. 80:8080 =>…
jonathan3692bf
  • 1,398
  • 1
  • 12
  • 14
31
votes
3 answers

How can I check the hit count for each rule in iptables?

I want to know how can I find out which rule was accessed and how many times, from the access list I have created using iptables. My firewall has over 1000 input and output rules in iptbales; I want to find how many times each of them were…
apps
  • 413
  • 1
  • 4
  • 6
31
votes
2 answers

iptables FORWARD and INPUT

I have a home network with Linux pc's, which all had iptables running. I think it is easier to put my LAN behind a Linux gateway/firewall, so I've put a pc (with fedora,no gui) between my router and LAN and configured iptables. No problem here,…
user1754764
29
votes
2 answers

Adding a rule in iptables in debian to open a new port

I am trying to open port 3306 in iptables in my Debian System to allow access to MySQL server. For which I entered this command: root@debian:/# sudo iptables -A INPUT -p tcp --dport 3306 ACCEPT root@debian:/# iptables-save I entered the new…
EternallyCurious
  • 2,345
  • 7
  • 47
  • 78
28
votes
5 answers

Trying to connect to remote MySQL host (error 2003)

I have a MySQL instance running on a Debian server and I can connect to it locally with no problems. However, I am unable to connect to it remotely. When I try this from my command line I get the following error: ERROR 2003 (HY000): Can't connect…
hellsgate
  • 5,905
  • 5
  • 32
  • 47
28
votes
10 answers

SSL installed on Apache2 but HTTPS not working

I recently installed an SSL certificate on my Amazon EC2 Ubuntu 12.04(32bit) server running Apache 2. When I attempt to access my site via https, it does not load. When I perform an nmap scan, i see that port 443 is not open. I tried to open port…
rocketas
  • 1,679
  • 3
  • 18
  • 30
27
votes
5 answers

create iptables rule per process/service

is it possible to use iptables in order to permit traffic initiated by a "process", ie using the process name? I would like for example to allow everything that is initiated by ping command.
cateof
  • 6,608
  • 25
  • 79
  • 153
27
votes
7 answers

iptables moving rule in a list

i have 2 rules of iptables iptables -A INPUT -s 5.5.5.5 -j DROP iptables -A INPUT -s 6.5.5.5 -j ACCEPT is there a function or a command that will swap the rules to be like this: iptables -A INPUT -s 6.5.5.5 -j ACCEPT iptables -A INPUT -s 5.5.5.5…
user1814662
  • 281
  • 1
  • 3
  • 5
25
votes
2 answers

Giving a docker container a routable ip address

I am running this on ubuntu 14.04 and have set docker0 to a static ip which is then routed to from the public ip through the firewall. I am trying to set up my backend API to run in a docker container and am confused by a couple things. 1.) How…
robert
  • 819
  • 1
  • 10
  • 24