How To Check Which Port Is Listern or Open on Linux
For some security reason you may configure SSH or any other protocol using different kind of port number on Linux server. Sometimes it’s important to know which ports are listern or open to the system network, it may open for network instruction or hacking.
Basically there are few methods to see which ports are open on Linux.
“How to check and open ports in Linux”
Option 1:
Check /etc/services file
planetmy:/ # cat /etc/services | grep xxx (xxx = port number)
If the command return no output mean no port configure to listen on the particular port number. For port SSH/22, you should be able to see:
ssh 22/tcp # SSH Remote Login Protocol
ssh 22/udp # SSH Remote Login Protocol
Option 2:
Use netstat command – Print network connections, routing tables, interface statistics, masquerade connections, and multicast memberships.
planetmy:/ # netstat -nan | grep 22
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 7110/sshd
If the command output return ‘LISTEN’, mean the particular port is open or listen on network.
Option 3:
use lsof command – list open files
planetmy:/ # lsof -i -n -P|grep 631
cupsd 17934 lp 0u IPv4 56540196 TCP *:631 (LISTEN)
cupsd 17934 lp 2u IPv4 56540197 UDP *:631
Read more
Possibly Related Posts:
- Google Public DNS Down?
- lppasswd: Unable to open passwd file: Permission denied
- Missing /var/log/lastlog
- Telnet service_limit error
- Google accounts on Twitter
ESX Host Currently Has No Management Network Redundancy Error
After upgraded to virtual center version 2.5 recently, I found an error message "host ESXhostname currently has no management network redundancy" when I tried to create a new cluster with 2 ESX hosts.
My test setup has one service console & one VMkernel connected to vswitch0 with single network card for both ESX host. The funny part is the problem only happen in one of the ESX host instead of both. I believe somehow this is due to my network design/setup in my test environment.
Again the similar error posted in VMware Communities forum solved my problem.
Possibly Related Posts:
- Google Public DNS Down?
- Missing /var/log/lastlog
- Telnet service_limit error
- Google accounts on Twitter
- How To Capture PUTTY Session Log
Server/Network Uptime statistic
I believe when you searching or looking for any web [tag]hosting[/tag] company or packages, you must look at their services, support, features, server/network uptime and etc.
So do you have any idea how is the [tag]server[/tag]/network uptime statistics counting nines?
Possibly Related Posts:
- Apple iPhone in Malaysia
- Airline Announcement
- Links From External Page in AWSTAT
- SPAM Comment
- New Cigarette?
OpenSUSE Linux Bridging Network
I had a OpenSUSE Linux 10.2 network bridge setup with 2 network card(eth0 & eth1) recently.
Below is the automated script that I use to start my network bridging services:
#!/bin/bash
PATH="/sbin:/usr/sbin:/usr/local/sbin";
slaveIfs="1 2 3 4 6 7 8 9 10";
cmd="$1";
[ -z "$cmd" ] && cmd="start";
case "$cmd" in
start)
brctl addbr br0;
brctl stp br0 on;
brctl addif br0 eth0;
brctl addif br0 eth1;
(ifdown eth0 1>/dev/null 2>&1;);
(ifdown eth1 1>/dev/null 2>&1;);
ifconfig eth0 0.0.0.0 up;
ifconfig eth1 0.0.0.0 up;
dhclient br0 ### Adapt to your needs.
for file in br0 eth0 eth1;
do
echo "1" > /proc/sys/net/ipv4/conf/${file}/proxy_arp;
echo "1" > /proc/sys/net/ipv4/conf/${file}/forwarding;
done;
echo "1" > /proc/sys/net/ipv4/ip_forward;
;;
stop)
brctl delif br0 eth0;
brctl delif br0 eth1;
ifconfig br0 down;
brctl delbr br0;
#ifup eth0; ### Adapt to your needs.
#ifup eth1; ### Adapt to your needs.
;;
restart,reload)
$0 stop;
sleep 3;
$0 start;
;;
status)
brctl show;
;;
esac;
Possibly Related Posts:
- lppasswd: Unable to open passwd file: Permission denied
- Missing /var/log/lastlog
- Leklai
- Telnet service_limit error
- How to Add Date And Time To Your Bash History on SuSE Linux
Linux Networking Tips
Linux Networking Tips:
1. ping – Test Network Connection
– ping google.com
2. ifconfig – View/Configure Network Adapter Configuration
– ifconfig -a
3. netstat – displays information for all active sockets, including the port numbers associated with each type of network service.
a. List of listening network ports (TCP and UDP sockets):
– /bin/netstat -tulp
b. Display LISTEN PORT:
– /bin/netstat -nap |grep LISTEN
c. Display Open Port:
– /usr/bin/nmap localhost OR /bin/netstat -a OR /bin/fuser -n tcp [port]
4. lsof – list open files
a. Display all of the TCP and UDP sockets to which programs are listening:
– /usr/bin/lsof -i -n | egrep ‘COMMAND|LISTEN|UDP’
Read more
Possibly Related Posts:
- Google Public DNS Down?
- Missing /var/log/lastlog
- Telnet service_limit error
- Google accounts on Twitter
- How To Capture PUTTY Session Log