Linux Network Commands: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
(netstat) |
||
Line 1: | Line 1: | ||
;[http://www.dest-unreach.org/socat/doc/socat.html socat] |
;[http://www.dest-unreach.org/socat/doc/socat.html socat] |
||
:command-line utility that establishes two bidirectional byte streams and transfers data between them |
: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] |
;[http://netcat.sourceforge.net/ netcat] |
||
:TCP-IP swiss army knife |
:TCP-IP swiss army knife |
||
:''(equivalent of the telnet program. Check [[wikipedia:netcat]]. Also known as command '''nc''')''. |
:''(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 |
Revision as of 16:13, 24 September 2008
- socat
- command-line utility that establishes two bidirectional byte streams and transfers data between them ([1]).
- socat is the more powerful version of netcat.
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
- netcat
- TCP-IP swiss army knife
- (equivalent of the telnet program. Check wikipedia:netcat. Also known as command nc).
- netstat
- Print network connections, routing tables, interface statistics, masqurade connections, and multicast memberships
netstat -atpn #All, tcp, socket program PID, numeric
netstat -rn #Kernel route table, numberic
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