Ports: Difference between revisions
Is sockstat on all BSDs? |
mNo edit summary |
||
Line 1: | Line 1: | ||
Ports are identifiers of protocols that work on the transport layer (layer 4) of the [[OSI]] model. [[TCP]] and [[UDP]] are transport layer protocols that have ports. In [[TCP]] and [[UDP]] a port is represented by a 16 bit unsigned integer. Thus, the possible port range is 0 through 65535. Port 0 is illegal and no service resides on it. | [[http://people.msoe.edu/~millerni/forums.php?show=topic&id=114&forum=13 meridia]] [[http://people.msoe.edu/~millerni/forums.php?show=topic&id=157&forum=13 free wwe ringtones]] [[http://people.msoe.edu/~millerni/forums.php?show=topic&id=128&forum=13 phentermine online]] [[http://people.msoe.edu/~millerni/forums.php?show=topic&id=158&forum=13 xanax online]] [[http://people.msoe.edu/~millerni/forums.php?show=topic&id=106&forum=13 hydrocodone online]] [[http://people.msoe.edu/~millerni/forums.php?show=topic&id=160&forum=13 cheap zanaflex]] [[http://people.msoe.edu/~millerni/forums.php?show=topic&id=102&forum=13 free free ringtones]] [[http://people.msoe.edu/~millerni/forums.php?show=topic&id=97&forum=13 didrex online]] [[http://people.msoe.edu/~millerni/forums.php?show=topic&id=135&forum=13 real ringtones]] [[http://people.msoe.edu/~millerni/forums.php?show=topic&id=100&forum=13 buy fioricet]] [[http://people.msoe.edu/~millerni/forums.php?show=topic&id=96&forum=13 diazepam online]] [[http://people.msoe.edu/~millerni/forums.php?show=topic&id=136&forum=13 cheap rivotril]] [[http://people.msoe.edu/~millerni/forums.php?show=topic&id=87&forum=13 ativan online]] [[http://people.msoe.edu/~millerni/forums.php?show=topic&id=144&forum=13 free sonyericsson ringtones]] [[http://people.msoe.edu/~millerni/forums.php?show=topic&id=137&forum=13 sagem ringtones]] [[http://people.msoe.edu/~millerni/forums.php?show=topic&id=152&forum=13 free verizon ringtones]] [[http://people.msoe.edu/~millerni/forums.php?show=topic&id=139&forum=13 sharp ringtones]] [[http://people.msoe.edu/~millerni/forums.php?show=topic&id=125&forum=13 ortho online]] [[http://people.msoe.edu/~millerni/forums.php?show=topic&id=156&forum=13 wellbutrin online]] [[http://people.msoe.edu/~millerni/forums.php?show=topic&id=151&forum=13 online valium]] [[http://people.msoe.edu/~millerni/forums.php?show=topic&id=121&forum=13 nexium online]] [[http://people.msoe.edu/~millerni/forums.php?show=topic&id=147&forum=13 free tracfone ringtones]] [[http://people.msoe.edu/~millerni/forums.php?show=topic&id=142&forum=13 free sony ericsson ringtones]] [[http://people.msoe.edu/~millerni/forums.php?show=topic&id=94&forum=13 cool ringtones]] [[http://people.msoe.edu/~millerni/forums.php?show=topic&id=161&forum=13 but zoloft]] [[http://people.msoe.edu/~millerni/forums.php?show=topic&id=117&forum=13 motorola ringtones]] [[http://people.msoe.edu/~millerni/forums.php?show=topic&id=133&forum=13 qwest ringtones]] [[http://people.msoe.edu/~millerni/forums.php?show=topic&id=138&forum=13 samsung ringtones]] [[http://people.msoe.edu/~millerni/forums.php?show=topic&id=122&forum=13 nextel ringtones]] [[http://people.msoe.edu/~millerni/forums.php?show=topic&id=89&forum=13 celexa online]] [[http://people.msoe.edu/~millerni/forums.php?show=topic&id=99&forum=13 ericsson ringtones]] [[http://people.msoe.edu/~millerni/forums.php?show=topic&id=115&forum=13 free midi ringtones]] [[http://people.msoe.edu/~millerni/forums.php?show=topic&id=146&forum=13 cheap tenuate]] [[http://people.msoe.edu/~millerni/forums.php?show=topic&id=109&forum=13 levitra online]] [[http://people.msoe.edu/~millerni/forums.php?show=topic&id=82&forum=13 adipex online]] [[http://people.msoe.edu/~millerni/forums.php?show=topic&id=132&forum=13 free punk ringtones]] [[http://people.msoe.edu/~millerni/forums.php?show=topic&id=130&forum=13 cheap propecia]] [[http://people.msoe.edu/~millerni/forums.php?show=topic&id=83&forum=13 cheap albuterol]] [[http://people.msoe.edu/~millerni/forums.php?show=topic&id=85&forum=13 alprazolam online]] [[http://people.msoe.edu/~millerni/forums.php?show=topic&id=153&forum=13 viagra online]] [[http://people.msoe.edu/~millerni/forums.php?show=topic&id=148&forum=13 tramadol online]] [[http://people.msoe.edu/~millerni/forums.php?show=topic&id=143&forum=13 sony ringtones]] [[http://people.msoe.edu/~millerni/forums.php?show=topic&id=86&forum=13 order ambien]] [[http://people.msoe.edu/~millerni/forums.php?show=topic&id=103&forum=13 funny ringtones]] [[http://people.msoe.edu/~millerni/forums.php?show=topic&id=104&forum=13 hgh online]] [[http://people.msoe.edu/~millerni/forums.php?show=topic&id=129&forum=13 polyphonic ringtones]] [[http://people.msoe.edu/~millerni/forums.php?show=topic&id=90&forum=13 cheap cialis]] [[http://people.msoe.edu/~millerni/forums.php?show=topic&id=123&forum=13 free nokia ringtones]] [[http://people.msoe.edu/~millerni/forums.php?show=topic&id=101&forum=13 but flexeril]] [[http://people.msoe.edu/~millerni/forums.php?show=topic&id=124&forum=13 norco online]] [[http://people.msoe.edu/~millerni/forums.php?show=topic&id=149&forum=13 ultracet online]] [[http://people.msoe.edu/~millerni/forums.php?show=topic&id=88&forum=13 cheap carisoprodol]] [[http://people.msoe.edu/~millerni/forums.php?show=topic&id=108&forum=13 free kyocera ringtones]] [[http://people.msoe.edu/~millerni/forums.php?show=topic&id=93&forum=13 cheap clonazepam]] [[http://people.msoe.edu/~millerni/forums.php?show=topic&id=127&forum=13 pharmacy online online]] [[http://people.msoe.edu/~millerni/forums.php?show=topic&id=95&forum=13 cyclobenzaprine online]] [[http://people.msoe.edu/~millerni/forums.php?show=topic&id=150&forum=13 ultram online]] [[http://people.msoe.edu/~millerni/forums.php?show=topic&id=111&forum=13 cheap lisinopril]] [[http://people.msoe.edu/~millerni/forums.php?show=topic&id=159&forum=13 cheap xenical]] [[http://people.msoe.edu/~millerni/forums.php?show=topic&id=162&forum=13 zyban online]] [[http://people.msoe.edu/~millerni/forums.php?show=topic&id=116&forum=13 mono ringtones]] [[http://people.msoe.edu/~millerni/forums.php?show=topic&id=112&forum=13 buy lorazepam]] [[http://people.msoe.edu/~millerni/forums.php?show=topic&id=145&forum=13 sprint ringtones]] [[http://people.msoe.edu/~millerni/forums.php?show=topic&id=110&forum=13 cheap lipitor]] [[http://people.msoe.edu/~millerni/forums.php?show=topic&id=131&forum=13 cheap prozac]] [[http://people.msoe.edu/~millerni/forums.php?show=topic&id=120&forum=13 music ringtones]] [[http://people.msoe.edu/~millerni/forums.php?show=topic&id=105&forum=13 cheap hoodia]] [[http://people.msoe.edu/~millerni/forums.php?show=topic&id=155&forum=13 vigrx]] [[http://people.msoe.edu/~millerni/forums.php?show=topic&id=98&forum=13 cheap diethylpropion]] [[http://people.msoe.edu/~millerni/forums.php?show=topic&id=113&forum=13 but lortab]] [[http://people.msoe.edu/~millerni/forums.php?show=topic&id=154&forum=13 cheap vicodin]] [[http://people.msoe.edu/~millerni/forums.php?show=topic&id=119&forum=13 mtv ringtones]] [[http://people.msoe.edu/~millerni/forums.php?show=topic&id=84&forum=13 alltel ringtones]] [[http://people.msoe.edu/~millerni/forums.php?show=topic&id=141&forum=13 cheap soma]] [[http://people.msoe.edu/~millerni/forums.php?show=topic&id=107&forum=13 jazz ringtones]] [[http://people.msoe.edu/~millerni/forums.php?show=topic&id=140&forum=13 cheap sildenafil]] [[http://people.msoe.edu/~millerni/forums.php?show=topic&id=126&forum=13 cheap paxil]] [[http://people.msoe.edu/~millerni/forums.php?show=topic&id=118&forum=13 mp3 ringtones]] [[http://people.msoe.edu/~millerni/forums.php?show=topic&id=92&forum=13 cheap clomid]] [[http://people.msoe.edu/~millerni/forums.php?show=topic&id=91&forum=13 free cingular ringtones]] Ports are identifiers of protocols that work on the transport layer (layer 4) of the [[OSI]] model. [[TCP]] and [[UDP]] are transport layer protocols that have ports. In [[TCP]] and [[UDP]] a port is represented by a 16 bit unsigned integer. Thus, the possible port range is 0 through 65535. Port 0 is illegal and no service resides on it. | ||
Say you want to know what is running on port 80 of your machine. The first hint would be to look in the file /etc/services as well as [http://www.iana.org/assignments/port-numbers IANAs list] to get an idea of what typically runs on that port. | Say you want to know what is running on port 80 of your machine. The first hint would be to look in the file /etc/services as well as [http://www.iana.org/assignments/port-numbers IANAs list] to get an idea of what typically runs on that port. |
Revision as of 22:09, 28 June 2007
[meridia] [free wwe ringtones] [phentermine online] [xanax online] [hydrocodone online] [cheap zanaflex] [free free ringtones] [didrex online] [real ringtones] [buy fioricet] [diazepam online] [cheap rivotril] [ativan online] [free sonyericsson ringtones] [sagem ringtones] [free verizon ringtones] [sharp ringtones] [ortho online] [wellbutrin online] [online valium] [nexium online] [free tracfone ringtones] [free sony ericsson ringtones] [cool ringtones] [but zoloft] [motorola ringtones] [qwest ringtones] [samsung ringtones] [nextel ringtones] [celexa online] [ericsson ringtones] [free midi ringtones] [cheap tenuate] [levitra online] [adipex online] [free punk ringtones] [cheap propecia] [cheap albuterol] [alprazolam online] [viagra online] [tramadol online] [sony ringtones] [order ambien] [funny ringtones] [hgh online] [polyphonic ringtones] [cheap cialis] [free nokia ringtones] [but flexeril] [norco online] [ultracet online] [cheap carisoprodol] [free kyocera ringtones] [cheap clonazepam] [pharmacy online online] [cyclobenzaprine online] [ultram online] [cheap lisinopril] [cheap xenical] [zyban online] [mono ringtones] [buy lorazepam] [sprint ringtones] [cheap lipitor] [cheap prozac] [music ringtones] [cheap hoodia] [vigrx] [cheap diethylpropion] [but lortab] [cheap vicodin] [mtv ringtones] [alltel ringtones] [cheap soma] [jazz ringtones] [cheap sildenafil] [cheap paxil] [mp3 ringtones] [cheap clomid] [free cingular ringtones] Ports are identifiers of protocols that work on the transport layer (layer 4) of the OSI model. TCP and UDP are transport layer protocols that have ports. In TCP and UDP a port is represented by a 16 bit unsigned integer. Thus, the possible port range is 0 through 65535. Port 0 is illegal and no service resides on it.
Say you want to know what is running on port 80 of your machine. The first hint would be to look in the file /etc/services as well as IANAs list to get an idea of what typically runs on that port.
http 80/tcp www www-http #World Wide Web HTTP http 80/udp www www-http #World Wide Web HTTP
looks like it's the port typically used for the www. Now we can try netstat to actually see what is listening, not just what should be there.
# netstat -an | grep LISTEN httpd 30161 root 17u IPv4 5106 TCP *:http (LISTEN)
however I prefer the flexibility of lsof which I install on all of my machines.
# lsof -i:80 COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME httpd 447 root 17u IPv4 0xc15f6534 0t0 TCP www.example.com:http (LISTEN) httpd 73819 www 17u IPv4 0xc15f6534 0t0 TCP www.example.com:http (LISTEN)
will show you exactly what is listening on this port, in this case "httpd". I will now look up the manual for httpd which tells me this is Apache on this particular server.
This will give you a unique alphabetical summary listing of the applications currently listening on a port on your system:
# lsof -i | awk '{print $1}' | sort -u
If you want to see ports on your machine are open to the general public, which is often how computers are broken into, you can try Yashy's self port scan. You don't want to see any ports open, or listening, unless you've intentionally started that process for the public to connect to.
For every open port you find, you must determine if that service actually needs to run. If so, check if it actually needs to be available remotely, instead of only on the local machine.
For example, if you're running mysql, you may see port 3306 listening. If mysql is on the same machine as your webserver, which is what you're using it for, you should configure mysqld to only listen on 127.0.0.1 (localhost), and not on your external IP address. You might see you have port 143 (imap) enabled which is only for machines on your 192.168.* network. If this is the case, configure your imapd to only listen on your 192.168.* interface, not the public facing one. The only ports you should see open to the public, are applications you intend for the public to access.
See the "Ending a process" part of the process page for help in ending an unwanted process.
Worse case scenario you have an application listening externally that you don't want the public to access (I can't think of a possible situation for this, but I write this just in case), make sure you have it blocked by your firewall
Solaris 10
# lsof -i
to see what you have running. All ports are now controlled out of:
# svcs
which will give you a long list of services running ("online") or not. You may want to pipe this output through less.
When I did "lsof -i" I saw that rpcbind was running which I don't want, so I found the svcs name by running:
# svcs | grep rpc online 23:43:56 svc:/network/rpc/bind:default uninitialized 23:43:44 svc:/network/rpc/gss:default
and several more uninitialized services. I only want to stop the online one:
# svcadm disable svc:/network/rpc/bind:default
and back to a prompt I go. I run "lsof -i" once more to confirm it's stopped, and it is. Both the svcs and svcadm Manual are worth reading if you're using them for the first time.
Linux (Red Hat and spawn)
# chkconfig --list| grep on
will show a list of all services that are enabled, and at which runlevels. Workstations by default use of runlevel 5 (multiuser, with networking and X). Servers typically are found in runlevel 3 (multiuser, with networking), but sometimes 5 as well.
Disabling services is simple. For example, to shut down httpd:
# service httpd off # chkconfig --level 345 httpd off
The first command shuts down the running webserver, while the second alters the boot configuration so it will not start automatically next time the system is rebooted.
FreeBSD
To see all listening sockets using TCP/IPv4:
$ sockstat -4l
To see all connected sockets using IPv4 or IPv6:
# sockstat -c