48
votes
Accepted
How to remove access to a port using firewall on Centos7?
Solution: Do not forget the --runtime-to-permanent
$ firewall-cmd --zone=public --remove-port=10050/tcp
$ firewall-cmd --runtime-to-permanent
$ firewall-cmd --reload
45
votes
Accepted
What happens if two local systems download the same resource on same port?
A TCP connection (which underlies HTTP and many other protocols) is uniquely (at a given point in time) defined by 4 parameters:
The local IP
The local port
The remote IP
The remote port
Even if you ...
41
votes
Accepted
SElinux error :ValueError: Port tcp/5000 already defined
So I found that another service had a defined status for TCP port 5000.
But by replacing the -a option with -m for modify, added tcp port 5000 to http_port_t
So the command that worked was:
# ...
37
votes
How to check if a port is blocked on a Windows machine?
Since PowerShell 4.0 you can use the command Test-NetConnection
If you want to test Port 3306 as in your example the command is
Test-NetConnection -ComputerName localhost -Port 3306
TechNet Test-...
33
votes
How to check if a port is blocked on a Windows machine?
NETSTAT will tell you if the port is listening but it will not tell you if the port is open to the outside world. What I mean by this is that NETSTAT may show that the 0.0.0.0 is LISTENING on port ...
30
votes
Is it a good idea to open up a database port for everyone?
Do not make your database publicly accessible. One bug in the database or weak passwords and someone deletes / steals / changes everything.
Your mobile app shouldn't access the database directly, it ...
29
votes
Prevent port change on redirect in nginx
In my case, nginx listens to port 80 inside a docker container, but it's mapped to port 8080 (or any random port) outside the container. There is no reverse proxy in-between that can add proper ...
29
votes
Accepted
Preventing other applications from binding to port 80 and 443
You can't prevent a port from being bound by the wrong service. In your case, just remove apache from autostart and you should be good.
For 16.04 and newer:
sudo systemctl disable apache2
For older ...
27
votes
Preventing other applications from binding to port 80 and 443
If you really aren't using apache2, and it's PHP 7.0 that's requiring it, then it looks like you have libapache2-mod-php7.0 installed. That package is useless without Apache. Since you're using nginx, ...
24
votes
Check if port is open or closed on a Linux server?
I use the combo of netstat and lsof:
netstat -an | grep <portnumber>
lsof -i:<portnumber>
To see if the port is being used, and what is using it.
23
votes
When specifying a "host name", do we still need to specify a port?
Host names do not correspond to an {ipaddress,port} tuple. A host name is only the name of a server, which should be resolvable to one or more IP addresses. Ports have nothing to do with host names at ...
19
votes
netstat shows a listening port with no pid but lsof does not
Based on hint from @user202173 and others I have been able to use the following to track down the process that owns a port even when it is listed as - in netstat.
Here was my starting situation. sudo ...
15
votes
What is the maximum port number in Linux?
Although 1-65535 are legit TCP ports and it is true that 1-1023 are for well known port services. You may run into random issues with your own services if they are started after an ephemeral port is ...
15
votes
Multiport Server NIC ports?
These devices are typically seen in the OS as four separate network devices and they can be used just like the four separate NICs you had before.
15
votes
Accepted
SSH: What's the difference between -L and -R?
It's right there, in the man page:
-L
Specifies that connections to the given TCP port or Unix socket on the local (client) host are to be forwarded to the given host and port, or Unix socket, on the ...
14
votes
How do you free up a port being held open by dead process?
Open command prompt as admin
C:\WINDOWS\system32>netstat -ano | findstr :7895
*** Repeat step 2 until there are no more child process
C:\WINDOWS\system32>wmic process where (ParentProcessId=1091 ...
14
votes
Accepted
Setting sub domain DNS to route default port 80 to custom port
For general HTTP purposes (web browsing, etc.), DNS cannot be used to direct a browser to use a specific port. Browsers are hard-codes to assume 80 for HTTP and 443 for HTTPS.
You "could" host ...
14
votes
Accepted
How do I specify a port other than 80 when adding SSL certificate using Certbot?
There is no way to specify a different port than defaults (80/443).
I recommend you to use the acme-dns validation. I use it and it works fine.
More details here : https://www.digitalocean.com/...
13
votes
How to remove access to a port using firewall on Centos7?
# firewall-cmd --zone=public --remove-port=12345/tcp --permanent
# firewall-cmd --reload
Replace 12345 with the port you want to remove.
12
votes
Accepted
Non standard ssh port: should I edit /etc/services?
I don't think it makes sense to edit /etc/services in such a case. The world will not change ssh ports with you, and all programs that look up service names to port numbers on your machine would get ...
11
votes
SElinux error :ValueError: Port tcp/5000 already defined
On the systems I have to hand (C6, C7 and F24), tcp port 5000 has an SELinux context of commplex_port_t. This will be why, when you try to add it you get the error message
/usr/sbin/semanage: Port ...
11
votes
What happens if two local systems download the same resource on same port?
The NAT table knows that the source port on each client is different, so it won't accidentally send the wrong packet to the wrong internal client. The NAT device also assigns different outbound ports, ...
11
votes
Is it a good idea to open up a database port for everyone?
Is it a good idea to open up a database port for everyone?
... this feels like it's not a good practice.
No it isn't.
Access control and security are of course big issues there.
From an application ...
10
votes
Accepted
How can I set the source port for an SSH command-line client?
You have to use nc as ProxyCommand. SSH only supports to specify the bind address of the SSH client.
ssh -o 'ProxyCommand nc -p 2345 %h %p' $MY_SERVER
Something like this should work.
10
votes
Accepted
Make wireguard listen on multiple port
Something like this should do the trick
iptables -t nat -I PREROUTING -i eth0 -d <yourIP/32> -p udp -m multiport --dports 53,80,4444 -j REDIRECT --to-ports 15351
9
votes
Check if port is open or closed on a Linux server?
If you need to script such a test, the solution by Serhii Popov (see comment to question) is probably the best since nc is capable of searching the TCP stack for an open port³ instead of attempting an ...
9
votes
Non standard ssh port: should I edit /etc/services?
The file /etc/services contains the IANA assigned port numbers and there is not a single technical requirement to modify that file to be able to you run your services on a non-standard port. When you ...
9
votes
When specifying a "host name", do we still need to specify a port?
A "virtual host" is simply a feature of a piece of software which takes advantage of extra context in a request to act differently.
An important thing to note is that TCP/IP itself does not know ...
8
votes
Why do netcat scans for UDP ports always succeed?
UDP is a "connectionless" protocol. If you send a packet and you don't get a rejection (via ICMP), regardless of whether you get a reply or not, it's considered successful. Something quite ...
8
votes
Accepted
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
port × 1707linux × 219
firewall × 207
iptables × 168
networking × 158
ssh × 121
apache-2.2 × 111
ubuntu × 110
port-forwarding × 103
windows × 95
nginx × 80
tcp × 79
centos × 68
security × 64
ip × 59
forwarding × 53
http × 47
ssl × 44
iis × 42
netstat × 40
debian × 38
domain-name-system × 36
ftp × 36
web-server × 35
windows-server-2008 × 34