Showing posts with label Networking. Show all posts
Showing posts with label Networking. Show all posts

Wednesday 18 October 2017

How to open specific port in firewall in CentOS Linux

Guys, if your organization is behind a firewall, the networking team usually takes care that most unused ports are blocked, unless absolutely necessary. In some cases, you may want to add an exception to the firewall rules though, to open up a specific port to allow incoming and outgoing network traffic.

In today's example, we may want to open up a port 8080 to allow TCP connections for instance. Note that these commands are specifically for the CentOS flavor of Linux. Other flavors of Linux may have different command syntax. Please check accordingly.

Firstly view the existing firewall rules using the following command

firewall-cmd --list-all

Output (Old rules):

public (default, active)
  interfaces: en0
  sources:
  services: dhcpv6-client ssh
  ports: 9005/tcp
  masquerade: no
  forward-ports:
  icmp-blocks:
  rich rules:

As you see from the existing rules, it seems that port 9005 is open. Now let us add the port 8080 to the firewall rules using the below command. If the command is executed fine, it will display "success". Make sure to reload firewall configuration to bring the new rules into effect.

firewall-cmd --zone=public --add-port=8080/tcp --permanent
success

firewall-cmd --reload
success

In order to view the double check the firewall rules, again use the --list-all command.

firewall-cmd --list-all

Output ( Updated rules):

public (default, active)
  interfaces: en0
  sources:
  services: dhcpv6-client ssh
  ports: 8080/tcp 9005/tcp
  masquerade: no
  forward-ports:
  icmp-blocks:
  rich rules:

As you see the port 8080 has been added to the list i.e it has been opened up.

Tuesday 3 October 2017

How to get username from IP address of remote computer

On a network (Home LAN or WiFi or corporate intranet), it is possible to get username from the assigned IP address of a remote machine. Assuming you have a bunch of users using Windows machines on the same network, lets look into the windows command to get the username.

For example, type the following in command prompt :

wmic.exe /node:17.16.15.28 computersystem get username
UserName
IRONCLADZONE\Special.User

Note that this works only for the remote machines which are connected on the same network.

Related Posts Plugin for WordPress, Blogger...
eXTReMe Tracker