顯示具有 IT skill 標籤的文章。 顯示所有文章
顯示具有 IT skill 標籤的文章。 顯示所有文章

星期二, 2月 05, 2013

網路線 RJ45配線圖

RJ45配線圖



Pin
Color
Name/Description
1
 White/Orange
 N/A
2
 Orange
 N/A
3
 White/Green
 Receive+
4
 Blue
 Transmit +
5
 White/Blue
 Transmit -
6
 Green
 Receive -
7
 White/Brown 
 -48VDC (optional)
8
 Brown
 -48VDC Return (optional)

跳線 製作方法
1 , 2 交換
3. 6 交換
==>
Pin
Color
Name/Description
1
 Orange
 N/A
2
 White/Orange
 N/A
3
 Green
 Receive+
4
 Blue
 Transmit +
5
 White/Blue
 Transmit -
6
 White/Green
 Receive -
7
 White/Brown 
 -48VDC (optional)
8
 Brown
 -48VDC Return (optional)

-------------------------------------------------------------------------------------

以前早期設備有分 , Router L3 , Switch L2 , PC L1
 PC 接PC 需要跳線
PC 接  Router 也需要跳線
PC 接Switch 不需要跳線

但現在設備都會自動跳線了 , 所以可以直接對接

星期四, 1月 31, 2013

TCP建立終止連線狀態圖

TCP建立終止連線狀態圖

Ref: http://blog.xuite.net/ahdeng/life/16475480-TCP%E5%BB%BA%E7%AB%8B%2F%E7%B5%82%E6%AD%A2%E9%80%A3%E7%B7%9A%E7%8B%80%E6%85%8B%E5%9C%96(3-way+handshake)

星期二, 4月 24, 2012

測試SMTP relay/MAIL server service的方法

telnet smtp_ip 25 <==這邊smtp 使用的預設port 是25 , 所以直接針對TCP 25 port 連接

220 mail2000pr1 ready Tue, 24 Apr 20
12 15:19:38 +0800 (CST)
mailfrom:sender@domain.net
500 Command unrecognized.
mail from:sender@domain.net
250 Sender <mvasp@ms.emome.net> OK
rcpt to:receiver@domain.net
250 Recipient <jay.chu@hwacom.com> OK
data ==> 先輸入 data,代表要開始輸入 email 的內容了
354 Enter mail, end <CRLF>.<CRLF>
test from smtp client
. #以.作為結尾
250 Message accepted for delivery

在這之後, 就會收到信了~

星期五, 3月 02, 2012

Linux tcp session 處於 ESTABLISHED狀態 且無法釋放

今天在某環境看到

TCP 由webserver(Linux)連到 AP的連線(透過F5) 呈現不對等關係

由webserver端(Linux)看到 連線數正常 為30 - 40個連線ESTABLISHED

由AP 端(Aix)看到 與webserver(Linux)連線數為200多個ESTABLISHED session...

由以下指令來算ESTABLISHED 連線數
 #netstat -an | grep ".5555" | awk '{print $5}'| cut -d '.' -f 1-4 |sort | uniq -c | sort -nr
 291 192.168.xx.1
 281 192.168.xx.2
 255 192.168.xx.3
 214 192.168.xx.4
  43 192.168.xx.5
  27 192.168.xx.6
  10 192.168.xx.7
   8 192.168.xx.8
   6 192.168.xx.9

看了一下網路文章 , 敘述發生在有NAT的環境 , 看起來蠻符合的 , 好像需調整以下TCP timeout參數:

vi /etc/sysctl.conf 
加入以下參數, 修改linux timeout

net.ipv4.netfilter.ip_conntrack_tcp_timeout_established = 432000   ==>預設為五天
to

net.ipv4.netfilter.ip_conntrack_tcp_timeout_established = 1200

再打sysctl -p 即生效
---
Linux NAT 的 ip_conntrack 模組會記錄 tcp 通訊協定的 established connection 記錄, 而且預設 timeout 時間長達五天 (432,000 秒)


查看目前 ip_conntrack buffer 使用狀況指令: 

grep conn /proc/slabinfo

結果實例: ip_conntrack 3024 4090 384 409 409 1 (各值說明如下)
ip_conntrack the cache name
3024 the number of currently active objects
4090 the total number of available objects
384 the size of each object in bytes
409 the number of pages with at least one active object
409 the total number of allocated pages
1 the number of pages per slab are given

man slabinfo 可查詢詳細說明.

查出目前 ip_conntrack 記錄最多的前五名 IP
指令: cat /proc/net/ip_conntrack | cut -d ' ' -f 10 | cut -d '=' -f 2 | sort | uniq -c | sort -nr | head -n 5
結果實例:
    295 192.168.xx.2
     52 210.202.xx.xx
     14 125.231.xx.xx
     13 61.60.xx.xx
     11 61.60.xx.xx

由此可知, 192.168.xx.xx 佔用了絕大多數的 buffer, 推斷這個 IP 的 AP 可能request大量連線.

--
最後回到AP Server :

找出使用5555 port 的socket
#netstat -Aan|grep ".5555"|more
f10000f0076f3358 tcp4       0      0  192.168.xx.xx.5555 192.168.xx.xx.4077 ESTA
BLISHED

用Aix 的kdb 指令 分析有使用到的socket.
#kdb

(0)> sockinfo f10000f0076f3358 tcpcb |grep -E "KEEP|opts"
    t_timer....... 00000000 (TCPT_KEEP)  ==> keep-alive對應的timer(TCPT_KEEP)數值為0,表示沒有設置timer時間
    opts........ 0004 (REUSEADDR)
(0)>

#rmsock f10000f0076f3358 tcpcb
 The socket 0x7946000 is being held by proccess 376864 (xxxx_srv).

#在Aix 下以下指令,找出所有被使用的port 的socket , 反查AP pid分析

接著使用shell scripts 找到所有的ESTABLISHED 連線, check socket 到底被誰占用
netstat -Aan |grep ".5555" |awk '{print $1}' > a.lst
for a in `cat a.lst`
do
rmsock $a tcpcb  >>a.log
done
cat a.log

發現所有的socket 都被AP server占用 ( pid 376864 )

The socket 0x7946000 is being held by proccess 376864 (xxxx_srv).
The socket 0x7946000 is being held by proccess 376864 (xxxx_srv).
.
.
這只是結果現象, 但究竟成因為何?

挑了另一台AP (Solaris) , 使用snoop指令可以撈取TCP neogiation.

正常連線如下

192.168.xx.xx -> server4         TCP D=5555 S=51760 Syn Seq=117012684 Len=0 Win=5840 Options=
        server4          -> 192.168. xx.xx  TCP D=51760 S=5555 Syn Ack=117012685 Seq=3082196059 Len=0 Win=49248 Options=2834143267 3777258114,mss 1460,nop,wscale 0,nop,nop,sackOK>
192.168.xx.xx  ->  server4          TCP D=5555 S=51760 Ack=3082196060 Seq=117012685 Len=0 Win=46 Options=2834143267>
192.168.xx.xx  ->  server4          TCP D=5555 S=51760 Push Ack=3082196060 Seq=117012685 Len=251 Win=46 Options=2834143267>
         server4          -> 192.168.xx.xx  TCP D=51760 S=5555 Ack=117012936 Seq=3082196060 Len=0 Win=48997 Options=2834143267 3777258116>
         server4          -> 192.168.xx.xx  TCP D=51760 S=5555 Push Ack=117012936 Seq=3082196060 Len=28 Win=48997 Options=2834143268 3777258116>
192.168.xx.xx  ->  server4          TCP D=5555 S=51760 Ack=3082196088 Seq=117012936 Len=0 Win=46 Options=2834143268>


而出問題的TCP連線 , 主要是DB 與Server之間...沒有收到 FIN ACK (goodbye) 封包...跟客戶聯繫後...請他們改AP程式要能夠主動closing釋放socket...觀察兩個禮拜後 就正常了....結案...原來DBA也要會分析網路...XD


192.168.xx.xx -> server4         TCP D=5555 S=54587 Ack=3375666357 Seq=1217496740 Len=0 Win=46 Options=2834248185>
192.168.xx.xx -> server4         TCP D=5555 S=54587 Fin Ack=3375666357 Seq=1217496740 Len=0 Win=46 Options=2834248185>
         server4          -> 192.168.xx.xx TCP D=54587 S=5555 Ack=1217496741 Seq=3375666357 Len=0 Win=48628 Options=2834248185 3778307603>
         server4          -> 192.168.xx.xx TCP D=54587 S=5555 Fin Ack=1217496741 Seq=3375666357 Len=0 Win=48628 Options=2834248185 3778307603>

Configuring TCP KeepAlive Parameters[轉載]

Configuring TCP KeepAlive Parameters

Last Update: 19 June 2008
Product: StarLicense for Windows/UNIX 
Version: 1.07 or later 
Article ID: SQV00SL002

Abstract

The StarLicense server uses the settings for the TCP KeepAlive parameter to clean up connections from clients that have disconnected without releasing a license that has been checked out. You can change the TCP KeepAlive parameter if you need the abandoned license checkouts to be cleaned up more frequently.

Solution

The StarLicense server uses the system TCP/IP KeepAlive parameter settings to clean up connections from clients that have disconnected from the network without releasing the StarQuest product license that was checked out by the computer. The default values for the KeepAlive parameter should be sufficient for most users, but you can change them if necessary, such as to clean up abandoned license connections more frequently. The KeepAlive parameter names vary by operating system but generally specify:
  • the interval to wait before probing the idle connection (on most platforms the default is 2 hours)
  • the interval to wait before retrying the probe after an initial failure to respond
  • the maximum number of times to retry the probe
Modifying the KeepAlive parameter settings may affect the operation of other applications on the computer. You also may want to set additional TCP/IP parameters that affect TCP connections, depending on the overall impact to other TCP/IP parameters after you modify the KeepAlive settings.
The method of changing the KeepAlive parameter settings varies by operating system, so refer to your system documentation for details. This technical document describes the general steps for displaying and modifying the KeepAlive parameter for the platforms on which the StarLicense server supports.
The following table shows the names of the KeepAlive parameters for each supported operating system.
Table 1: Keepalive Parameters by Operating System
Operating System
Parameter wait time before probing the connection
Parameter interval between retry probes
Parameter maximum retry probes
Unit of measure
AIX
tcp_keepidle
tcp_keepintvl
n/a
half-seconds
FreeBSD
TCPTV_KEEP_IDLE
TCPTV_KEEPINTVL
TCPTV_KEEPCNT 
seconds
HP-UX 11i
tcp_time_wait_interval
tcp_keepalive_interval
tcp_keepalives_kill (1)
milliseconds
Linux
tcp_keepalive_time
tcp_keepalive_intvl
tcp_keepalive_probes
seconds
Solaris
tcp_time_wait_interval
tcp_keepalive_interval
n/a
milliseconds
Windows
KeepAliveTime
KeepAlive Interval
TcpMaxDataRetransmission
milliseconds
(1): tcp_keepalives_kill cannot be modified on HP. It is set to 1.

Displaying and Modifying KeepAlive Values

Follow these steps to modify the values.
1.       Log in as root on a UNIX-based computer or as an Administrator on a Windows computer.
2.       Refer to the information for the operating system you are using, as suggested in the following table, to display information about the network tuning parameters.
Platform
Operating System Command
AIX
no -a
HP-UX 11i
ndd -h supported
FreeBSD
Examine /usr/src/sys/netinet/tcp_timer.h and tcp_timer.c
Linux
sysctl -h
Sun Solaris
ndd /dev/tcp \?
Windows
3.       Display the current KeepAlive settings, replacing <tcp_parameter> with the names shown in Table 1 for each platform.
Platform
Operating System Command
AIX
no -o<tcp_parameter>
FreeBSD
Examine /usr/src/sys/netinet/tcp_timer.h and tcp_timer.c
HP-UX 11i
ndd -get /dev/tcp <tcp_parameter>
Linux
sysctl net.ipv4.<tcp_parameter>
Sun Solaris
ndd -get /dev/tcp <tcp_parameter>
Windows
From the Start menu, choose Run and enter regedit to view the parameter located in the Registry file HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\Tcpip\Parameters
4.       Display the range of available settings.
Platform
Operating System Command
AIX
This option is not available.
FreeBSD
This option is not available.
HP-UX 11i
ndd -h <tcp_parameter>
Linux
This option is not available.
Sun Solaris
This option is not available.
Windows
5.       Modify the KeepAlive values as desired.
Platform
Operating System Command
AIX
no -o <tcp_parameter>= <tcp _value>
FreeBSD
Modify /usr/src/sys/netinet/tcp_timer.h and rebuild the kernel.
HP-UX 11i
ndd -set /dev/tcp <tcp_parameter> <tcp_value>
Linux
To set the value temporarily until the computer is restarted: 
sysctl -w net.ipv4.<tcp_parameter> = <tcp_value> 
To make the change permanently:
Update /etc/sysctl.conf with net.ipv4.<tcp_parameter> = <tcp_value> and issue one of the following commands, depending on which version of Linux you are running:
Red Hat: chkconfig sysctl on
Suse: chkconfig boot.sysctl on
Sun Solaris
ndd -set /dev/tcp <tcp_parameter> <tcp_value>
Windows
Run regedit to edit the Windows Registry key located in the pathHKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\Tcpip\Parameters.
After you change the Registry value you must restart the computer for the change to take affect.


DISCLAIMER

The information in technical documents comes without any warranty or applicability for a specific purpose. The author(s) or distributor(s) will not accept responsibility for any damage incurred directly or indirectly through use of the information contained in these documents. The instructions may need to be modified to be appropriate for the hardware and software that has been installed and configured within a particular organization.  The information in technical documents should be considered only as an example and may include information from various sources, including IBM, Microsoft, and other organizations.

LinkWithin-相關文件

Related Posts Plugin for WordPress, Blogger...