Add a port for tcp connection

Support for security such as Firewalls and securing linux
Post Reply
zhshqzyc
Posts: 8
Joined: 2016/03/21 15:55:09

Add a port for tcp connection

Post by zhshqzyc » 2016/03/21 17:20:00

I want to establish a tcp connection from my Windows desktop to a CentOS server. So I added a port by the command

Code: Select all

firewall-cmd --permanent --add-port=5004/tcp
Is it right?

User avatar
TrevorH
Forum Moderator
Posts: 27379
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: Add a port for tcp connection

Post by TrevorH » 2016/03/21 18:19:00

If you run it with --permanent then it only affects the saved configuration not the running one. You need to run it twice, once with and once without --permanent
CentOS 6 will die in November 2020 - migrate sooner rather than later!
CentOS 5 has been EOL for nearly 3 years and should no longer be used for anything!
Full time Geek, part time moderator. Use the FAQ Luke

zhshqzyc
Posts: 8
Joined: 2016/03/21 15:55:09

Re: Add a port for tcp connection

Post by zhshqzyc » 2016/03/21 18:35:14

The second time when I run the command without --permanent. It warns me:
ALREADY_ENABLED

zhshqzyc
Posts: 8
Joined: 2016/03/21 15:55:09

Re: Add a port for tcp connection

Post by zhshqzyc » 2016/03/21 19:07:16

The other thing is even I added the port. It is still rejecting external connection.

gerald_clark
Posts: 10642
Joined: 2005/08/05 15:19:54
Location: Northern Illinois, USA

Re: Add a port for tcp connection

Post by gerald_clark » 2016/03/21 19:16:45

Start the service using that port.

zhshqzyc
Posts: 8
Joined: 2016/03/21 15:55:09

Re: Add a port for tcp connection

Post by zhshqzyc » 2016/03/21 19:24:13

gerald_clark wrote:Start the service using that port.
How? Please advise me a little details.

gerald_clark
Posts: 10642
Joined: 2005/08/05 15:19:54
Location: Northern Illinois, USA

Re: Add a port for tcp connection

Post by gerald_clark » 2016/03/21 19:27:11

How should I know? You are the one wanting to use that port.

zhshqzyc
Posts: 8
Joined: 2016/03/21 15:55:09

Re: Add a port for tcp connection

Post by zhshqzyc » 2016/03/21 19:31:17

Okay. Sorry for misunderstanding. I thought it was something else.

But it still rejects me. Not sure why? Also can I put the port into a configuration file? I don't know which file is for that?

Post Reply

Return to “CentOS 7 - Security Support”