Archive for the tag 'Port'

Get exim to listen on another port other than 25

Some ISP’s are now blocking outgoing port 25 which prevents user from using smtp via their server. The workaround is to get exim to listen on another port other than 25 to bypass the ISP’s block.

For example, to get exim to listen on both port 25 and port 587, you’d add the following code to the very top of the /etc/exim.conf file:

daemon_smtp_ports = 25 : 587

Once saved, restart exim:
Redhat:
/sbin/service exim restart

FreeBSD:
/usr/local/etc/rc.d/exim restart

More
: http://www.exim.org/exim-html-4.40/doc/html/spec_13.html#SECT13.5

How to check if the port is associated with the official list of known services.

Example:

cat /etc/services | grep 834

This command returns no output. This indicates that while the port is in the reserved range (meaning 0 through 1023) and requires root access to open, it is not associated with a known service.

Next, check for information about the port using netstat or lsof. To check for port 834 using netstat, use the following command:

netstat -anp | grep 834

The lsof command reveals similar information since it is also capable of linking open ports to services:

lsof -i | grep 834

These tools reveal a great deal about the status of the services running on a machine. These tools are flexible and can provide a wealth of information about network services and configuration. Consulting the man pages for lsof, netstat, nmap, and services is therefore highly recommended.

SBDavid

How to redirect port using IPTABLES

How to redirect port using IPTABLES

You can redirect the port in IPTABLES using the prerouting parameter.

Following is the command you can use to redirect the traffic of port 8080 to port 80.

$ /sbin/iptables -t nat -I PREROUTING -p tcp –dport 8080 -j REDIRECT –to-port 80
$ /etc/init.d/iptables save
$ /etc/init.d/iptables restart

You can change the ports in the above command according to your need.

SBDavid

How to redirect port using IPTABLES

How to redirect port using IPTABLES

You can redirect the port in IPTABLES using the prerouting parameter.

Following is the command you can use to redirect the traffic of port 8080 to port 80.

$ /sbin/iptables -t nat -I PREROUTING -p tcp –dport 8080 -j REDIRECT –to-port 80
$ /etc/init.d/iptables save
$ /etc/init.d/iptables restart

You can change the ports in the above command according to your need.

SBDavid

Use a Non-Standard SSH Port

Use a Non-Standard SSH Port

By default, ssh listens for incoming connections on port 22. For a hacker to determine ssh is running on your machine, he’ll most likely scan port 22 to determine this. An effective method is to run ssh on a non-standard port. Any unused port will do, although one above 1024 is preferable. Many people choose 2222 as an alternative port (as it’s easy to remember), just as 8080 is often known as the alternative HTTP port. For this very reason, it’s probably not the best choice, as any hacker scanning port 22 will likely also be scanning port 2222 just for good measure. It’s better to pick some random high port that’s not used for any known services. To make the change, add a line like this to your /etc/ssh/sshd_config file:

# Run ssh on a non-standard port:
Port 2345 #Change me

and restart the sshd service. Don’t forget to then make any necessary changes to port forwarding in your router and any applicable firewall rules.

Because ssh is no longer listening for connections on the standard port, you will need to tell your client what port to connect on. Using the ssh client from the command line, we may specify the port using the -p switch:

$ ssh -p 2345 myserver

« Prev - Next »