Linux Ask!

Linux Ask! is a Q & A web site specific for Linux related questions. Questions are collected, answered and audited by experienced Linux users.

Aug 272010
 

How to kill a TCP connection using tcpkill?

Answer:

You can use the tcpkill program.

tcpkill came with the dsniff in Debian/Ubuntu, you need to install it manually.

# sudo apt-get install dsniff

Usages:

1. Kill all outgoing web (port 80) connection:

# tcpkill -i eth0 port 80

2. Kill all connection by IP

# tcpkill -i eth0 host www.google.com

Jul 282010
 

What is the difference between ip address 0.0.0.0 and 127.0.0.1?

Answer:

Sometimes when using the netstat command, which print out something like

# netstat -ntpl
(No info could be read for "-p": geteuid()=1001 but you should be root.)
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 0.0.0.0:25              0.0.0.0:*               LISTEN      -
...

What is the real meaning of 0.0.0.0?

In fact, this special IP means "all the IP addresses on the local machine". So if you have seen a service listening on 0.0.0.0, it means you can connect to the service using any IP addresses of the machine.

Mar 252010
 

Find out which programs are listening TCP port

Answer:

Use the command: netstat -tlnp

# netstat -tlnp

(Not all processes could be identified, non-owned process info
 will not be shown, you would have to be root to see it all.)
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State
tcp        0      0 0.0.0.0:25              0.0.0.0:*               LISTEN     
tcp        0      0 0.0.0.0:443             0.0.0.0:*               LISTEN     
tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN