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
11
votes
5 answers

Linux Bash: Setting iptables rules to allow both active and passive FTP

I have a PC on which I have a FTP server installed. I want to set the iptables rules to allow both active and passive FTP. I've tried the following code that people report is working, but it seems to block all traffic for me (pages won't load…
user573382
  • 343
  • 3
  • 10
  • 22
10
votes
1 answer

iptable rule to drop packet with a specific substring in payload

I am trying to write rules to drop any packet, irrespective if it is outgoing, incoming or being forwarded, which has a specific sub string in the TCP or UDP payload. How am I suppose to do that?
Kazoom
  • 5,659
  • 16
  • 56
  • 69
10
votes
2 answers

How to get original destination port of redirected UDP message?

Using this thing I can obtain original destination IP address of socket(PF_INET, SOCK_DGRAM, 0) socket. How to get original destination port?
Vi.
  • 37,014
  • 18
  • 93
  • 148
10
votes
2 answers

ELB, Proxy Protocol and iptables

I have a setup where a server is front-ended by AWS ELB. I would like to filter traffic based on the source ip address using iptables possibly. I have enabled the proxy protocol on ELB. Is it possible to use iptables in conjunction with Proxy…
Cheezo
  • 761
  • 9
  • 24
10
votes
2 answers

Python port forwarding/multiplexing server

I would like to make server that listen on UDP port 162 (SNMP trap) and then forwards this traffic to multiple clients. Also important is that the source port & address stays same (address spoofing). I guess that best tool for this would be Twisted…
Ib33X
  • 6,764
  • 4
  • 28
  • 30
10
votes
3 answers

Copy IP Tables rules from one server to another

I have a server with iptables rules setup. I want to use the same rules on a new server. Can I somehow copy/paste them or download/re-upload them using terminal? I'm on Ubuntu.
Jared Eitnier
  • 7,012
  • 12
  • 68
  • 123
10
votes
3 answers

best way to check if a iptables userchain exist

I am trying to programmatically create user chains and delete them in iptables. I was wondering what is the best way to check if a user chain exist and if it does not create it.
nashr rafeeg
  • 779
  • 3
  • 12
  • 31
9
votes
1 answer

How to configure firewalld with docker 20.10

I realized that recently docker add integration with firewalld and I just want to setup my server using firewalld instead of iptables boring rules and chains. This is my docker zone output: root@test:~# sudo firewall-cmd --zone=docker --list-all…
Masoud Tavakkoli
  • 950
  • 13
  • 34
9
votes
1 answer

Retrieving original destination from iptables after REDIRECT

I'm writing an application proxy for generic use. I want to use this as a transparent proxy, where my original plan is to use iptables with a REDIRECT rule forward all connections to my application proxy. The problem here is of course, that my…
9
votes
8 answers

Accessing a mysql database from external host/ip? (ie: mysql workbench)

I have a mysql server running on x.x.x.x, and can access it internally no problem (of course). However when attempting to connect externally, ie using mysql workbench, or even from an external server, I get the error message "Host 'bla.bla.bla' is…
Jon
  • 115
  • 1
  • 1
  • 4
9
votes
1 answer

Docker expose a port only to localhost

I want to restrict my database access to 127.0.0.1, so I executed the following command: docker run -it mysql:5.5 -p 127.0.0.1:3306:3306 -name db.mysql But I have some confusion... You can see here that only the port of 127.0.0.1 will be…
KInGcC
  • 372
  • 1
  • 2
  • 9
9
votes
5 answers

linux: suspend process at startup

I would like to spawn a process suspended, possibly in the context of another user (e.g. via sudo -u ...), set up some iptables rules for the spawned process, continue running the process, and remove the iptable rules when the process exists. Is…
hanshans
  • 91
  • 1
  • 2
9
votes
2 answers

Large number of Port forwarding in nginx

I'm trying to add mapping for 20K Ports (range [40k-60k]) in the nginx configuration. This config is added to nginx.conf stream{ server { listen 40000; listen 40001; . . . listen 60000; …
Abhishek
  • 551
  • 2
  • 5
  • 22
9
votes
2 answers

How can I redirect a single port in a docker container to the container's host?

To make development easier for a project, I've put a couple of services it depends on in docker containers. This makes 'localhost' in the project's config mean something different when it is passed to one of the containers. edit To be clear, I'm…
JivanAmara
  • 1,065
  • 2
  • 10
  • 20
9
votes
2 answers

Packet Redirection on Windows

We currently run windows on all of our machines due to software limitation. Within this however, we are needing to redirect certain packets that come into an IP and Port to a different Port (same IP). We have software listening on the "Proxy…