Linux Network Commands: Difference between revisions

From miki
Jump to navigation Jump to search
(netstat)
(redirect to Linux Commands)
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
#REDIRECT [[Linux Commands]]
;[http://www.dest-unreach.org/socat/doc/socat.html socat]
:command-line utility that establishes two bidirectional byte streams and transfers data between them ([http://wiki.yobi.be/wiki/Bypass_Proxy#Client_side:_using_socat]).
:''socat'' is the more powerful version of ''netcat''.
<source lang="bash">socat -ly 'TCP4-LISTEN:143,reuseaddr,fork' PROXY:ton.imap.server:143|TCP:134.27.168.36:8080
ProxyCommand socat - 'PROXY:%h:%p,proxyauth=user:pass|SSL,verify=0|PROXY:my.server:443,proxyauth=user:pass|TCP:big.brother.proxy:8080' #Using v2.0.0 beta
</source>
;[http://netcat.sourceforge.net/ netcat]
:TCP-IP swiss army knife
:''(equivalent of the telnet program. Check [[wikipedia:netcat]]. Also known as command '''nc''')''.
;[http://en.wikipedia.org/wiki/Netstat netstat]
: Print network connections, routing tables, interface statistics, masqurade connections, and multicast memberships
<source lang="bash">
netstat -atpn #All, tcp, socket program PID, numeric
netstat -rn #Kernel route table, numberic
</source>
When listing sockets (default output), you'll get an output like:
{|
|-
|
% netstat -at
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address Foreign Address State
tcp 0 0 *:time *:* LISTEN
tcp 0 0 localhost:mysql *:* LISTEN
tcp 0 0 andLinux.local:43449 windows-host:x11 ESTABLISHED
|
% netstat -atn
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address Foreign Address State
tcp 0 0 0.0.0.0:37 0.0.0.0:* LISTEN
tcp 0 0 127.0.0.1:3306 0.0.0.0:* LISTEN
tcp 0 0 192.168.11.150:43449 192.168.11.1:6000 ESTABLISHED
|}
:;Local Address
::'''*''' or '''0.0.0.0''' means that the process accepts connection from any interface.
::'''127.0.0.1''' means it only accepts connection on localhost loopback (and so only connection that originates from local PC as well).
::Any other IP address means that the process listen on the given port at the given IP address

Latest revision as of 10:19, 5 November 2008

Redirect to: