Github Page

레이블이 NET-LAN인 게시물을 표시합니다. 모든 게시물 표시
레이블이 NET-LAN인 게시물을 표시합니다. 모든 게시물 표시

3/23/2019

netstat 의 기본이용법 및 network 문제파악

1. netstat의 사용법

netstat를 이용하여 전체 Network 의 상태를 파악이 가능하지만, 세부적인 통신내용을 알기는  어려운 것 같다. 

$ netstat --help
usage: netstat [-vWeenNcCF] [] -r         netstat {-V|--version|-h|--help}
       netstat [-vWnNcaeol] [ ...]
       netstat { [-vWeenNac] -i | [-cWnNe] -M | -s }

        -r, --route              display routing table
        -i, --interfaces         display interface table
        -g, --groups             display multicast group memberships
        -s, --statistics         display networking statistics (like SNMP)
        -M, --masquerade         display masqueraded connections

        -v, --verbose            be verbose
        -W, --wide               don't truncate IP addresses
        -n, --numeric            don't resolve names
        --numeric-hosts          don't resolve host names
        --numeric-ports          don't resolve port names
        --numeric-users          don't resolve user names
        -N, --symbolic           resolve hardware names
        -e, --extend             display other/more information
        -p, --programs           display PID/Program name for sockets
        -c, --continuous         continuous listing

        -l, --listening          display listening server sockets
        -a, --all, --listening   display all sockets (default: connected)
        -o, --timers             display timers
        -F, --fib                display Forwarding Information Base (default)
        -C, --cache              display routing cache instead of FIB

  ={-t|--tcp} {-u|--udp} {-w|--raw} {-x|--unix} --ax25 --ipx --netrom
  =Use '-6|-4' or '-A ' or '--'; default: inet
  List of possible address families (which support routing):
    inet (DARPA Internet) inet6 (IPv6) ax25 (AMPR AX.25) 
    netrom (AMPR NET/ROM) ipx (Novell IPX) ddp (Appletalk DDP) 
    x25 (CCITT X.25) 


1.1  netstat  기본사용법 

사용방법은 Network의 전체 구성인 Routing Table 정보부터 보는 것이 맞을 것 같으며,  관련된 Multicast 와 점점 세부 네트워크로 들어가 분석하는 것이 맞을 것 같다.

  • Routing Table 정보 확인
현재 연결된 Network 의 구성을 알아보자

$ netstat -re  // extened 
or 
$ netstat -r   
Kernel IP routing table
Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface
default         router.asus.com 0.0.0.0         UG        0 0          0 eth0
10.0.0.0        *               255.255.255.0   U         0 0          0 eth0
link-local      *               255.255.0.0     U         0 0          0 usb0
172.17.0.0      *               255.255.0.0     U         0 0          0 docker0
192.168.55.0    *               255.255.255.0   U         0 0          0 l4tbr0
192.168.55.0    *               255.255.255.0   U         0 0          0 usb0


  • Multicast 관련 정보 확인 
  --groups , -g  Display multicast group membership information for IPv4 and IPv6.

$ netstat -g
IPv6/IPv4 Group Memberships
Interface       RefCnt Group
--------------- ------ ---------------------
lo              1      all-systems.mcast.net
eth0            1      224.0.0.251
eth0            1      all-systems.mcast.net
usb0            1      224.0.0.251
usb0            1      all-systems.mcast.net
usb1            1      all-systems.mcast.net
l4tbr0          1      224.0.0.251
l4tbr0          1      all-systems.mcast.net
wlan0           1      all-systems.mcast.net
docker0         1      224.0.0.251
docker0         1      all-systems.mcast.net
lo              1      ff02::1
lo              1      ff01::1
dummy0          1      ff02::1
dummy0          1      ff01::1
eth0            1      ff02::fb
eth0            1      ff02::1:fff4:9ad0
eth0            1      ff02::1
eth0            1      ff01::1
tunl0           1      ff02::1
tunl0           1      ff01::1
usb0            1      ff02::fb
usb0            1      ff02::1:ffe6:405f
usb0            1      ff02::1
usb0            1      ff01::1
usb1            1      ff02::fb
usb1            1      ff02::1:ff72:214
usb1            1      ff02::1
usb1            1      ff01::1
l4tbr0          1      ff02::fb
l4tbr0          1      ff02::1:ff2a:6c1f
l4tbr0          1      ff02::1
l4tbr0          1      ff01::1
wlan0           1      ff02::1
wlan0           1      ff01::1
docker0         1      ff02::1
docker0         1      ff01::1


  • TCP/UDP 관련된 모든 Socket  상태정보 표시
TCP/UDP 관련 Socket 의 정보들 및 상태 정보 와 PID를 확인도 가능하다.
옵션에따라 점점 추가 되며 아래와 같이 파악 가능하다.

$ netstat -atn           # all socket and numeric For tcp
$ netstat -aun           # all socket and numeric For udp
$ netstat -atun          # all socket and numeric For both (TCP,UDP)

// 각 State 와 PID 정보 및 Protocol 과  Recv Q/Send Q 정보 
$ netstat -tulnp          # listening server and numeric and PID for both (TCP,UDP)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 127.0.1.1:53            0.0.0.0:*               LISTEN      -               
tcp        0      0 192.168.55.2:53         0.0.0.0:*               LISTEN      -               
tcp        0      0 127.0.0.1:53            0.0.0.0:*               LISTEN      -               
tcp        0      0 192.168.55.1:53         0.0.0.0:*               LISTEN      -               
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      -               
tcp        0      0 127.0.0.1:631           0.0.0.0:*               LISTEN      -               
tcp        0      0 127.0.0.1:6011          0.0.0.0:*               LISTEN      -               
tcp        0      0 127.0.0.1:6012          0.0.0.0:*               LISTEN      -               
tcp        0      0 127.0.0.1:2947          0.0.0.0:*               LISTEN      -               
tcp6       0      0 fe80::c03:7dff:fea1::53 :::*                    LISTEN      -               
tcp6       0      0 ::1:53                  :::*                    LISTEN      -               
tcp6       0      0 :::22                   :::*                    LISTEN      -               
tcp6       0      0 ::1:631                 :::*                    LISTEN      -               
tcp6       0      0 ::1:6011                :::*                    LISTEN      -               
tcp6       0      0 ::1:6012                :::*                    LISTEN      -               
tcp6       0      0 ::1:2947                :::*                    LISTEN      -               
udp        0      0 0.0.0.0:5353            0.0.0.0:*                           -               
udp   12585600      0 0.0.0.0:1334            0.0.0.0:*                           1695/python     
udp        0      0 0.0.0.0:52316           0.0.0.0:*                           -               
udp        0      0 127.0.1.1:53            0.0.0.0:*                           -               
udp        0      0 192.168.55.2:53         0.0.0.0:*                           -               
udp        0      0 127.0.0.1:53            0.0.0.0:*                           -               
udp        0      0 192.168.55.1:53         0.0.0.0:*                           -               
udp        0      0 0.0.0.0:68              0.0.0.0:*                           -               
udp        0      0 0.0.0.0:631             0.0.0.0:*                           -               
udp        0      0 0.0.0.0:53992           0.0.0.0:*                           -               
udp6       0      0 :::5353                 :::*                                -               
udp6       0      0 :::51705                :::*                                -               
udp6       0      0 fe80::c03:7dff:fea1::53 :::*                                -               
udp6       0      0 ::1:53                  :::*                                -  

  https://askubuntu.com/questions/538208/how-to-check-opened-closed-ports-on-my-computer


  • network Interface의 정보확인  ( Layer 2  분석) 
실제로 Network Driver, Layer 2의  오류파악가능하며, 보통 Ether phy chip(MII) 연결 후, 문제가 있을 경우 
Network TEST를 통해서 기본확인가능하며, Kernel의 Driver에 따라 에러감지가 제대로 되지 않을 수 있으므로 주의하자
만약 에러가 발생하면, ifconfig에서도 쉽게 발견가능

netstat  -i, --interfaces    Display a table of all network interfaces.

$ netstat -i   or netstat -ic // Interface TX/RX Status 
Kernel Interface table
Iface   MTU Met   RX-OK RX-ERR RX-DRP RX-OVR    TX-OK TX-ERR TX-DRP TX-OVR Flg
docker0    1500 0         0      0      0 0             0      0      0      0 BMU
eth0       1500 0   2529153      0      0 0        829553      0      0      0 BMRU
l4tbr0     1500 0    127916      0      0 0        103336      0      0      0 BMRU
lo        65536 0      3462      0      0 0          3462      0      0      0 LRU
usb0       1500 0     33527  33527      0 0         32753      0      0      0 BMRU
usb1       1500 0     94389      0      0 0         70958      0      0      0 BMRU
wlan0      1500 0         0      0      0 0             0      0      0      0 BMU



  1. MTU(Maximum Transfer Unit): default 1500  // ethernet 
  2. Met: 메트릭
  3. RX-OK : 받은 것. 정상 수신 패킷
  4. RX-ERR: 파손 수신 패킷 (상위 usb0은 100% 에러)
  5. RX-DRP: 유실 수신 패킷
  6. RX-OVR: packet overrun(커널에서 처리 하는 인터럽트보다 패킷이 빨리 도착했을때 패킷 유실)
  7. TX-OK : 보낸 것. 정상 송신 패킷.
  8. TX-ERR: 파손 송신 패킷.
  9. TX-DRP: 유실 송신 패킷.
  10. TX-OVR: packet overrun



  • Flg:
  1. B: 브로드케스트 주소 지정
  2. L: 루프백 인터페이스
  3. M: 모든 패킷 수집(promiscuous mode)
  4. O: 인터페이스에 대한 ARP가 off 되어 있음.
  5. P: point-to-point 연결
  6. R: 인터페이스 동작중(Running)
  7. U: 인터페이스 up 인 상태.



2. Network 문제사항 및 에러확인 

Network 관련설정은 처음 booting /etc/sysctrl.conf에 의해서 설정되며 없다면, kernel의 default 값으로 설정된다.

Network 정보 (TCP / UDP / IP / ICMP) 의 관련된사항들을 기록하였기때문에, 분석이 가능하며, 문제사항을 쉽게 파악이 가능하다.

netstat -s 옵션이외에도 proc 정보로도 확인가능
sysctl -a 설정정보확인가능

netstat -s , --statistics   Display summary statistics for each protocol.

$ netstat -s  // UDP / TCP / ICMP  사용통계 및 문제에러사항 확인 
Ip:
    1807814 total packets received
    0 forwarded
    0 incoming packets discarded
    1188470 incoming packets delivered
    955549 requests sent out
    40 outgoing packets dropped
Icmp:
    100 ICMP messages received
    2 input ICMP message failed.
    ICMP input histogram:
        destination unreachable: 100
    102 ICMP messages sent
    0 ICMP messages failed
    ICMP output histogram:
        destination unreachable: 102
IcmpMsg:
        InType3: 100
        OutType3: 102
Tcp:
    5894 active connections openings
    15 passive connection openings
    4 failed connection attempts
    5748 connection resets received
    6 connections established
    965515 segments received
    952551 segments send out
    146 segments retransmited
    0 bad segments received.
    34 resets sent
Udp:
    59434 packets received
    82 packets to unknown port received.
    0 packet receive errors
    1454 packets sent
    IgnoredMulti: 139426
UdpLite:
TcpExt:
    102 TCP sockets finished time wait in fast timer
    12122 delayed acks sent
    38 delayed acks further delayed because of locked socket
    Quick ack mode was activated 8 times
    404422 packets directly queued to recvmsg prequeue.
    36435935 bytes directly in process context from backlog
    434921871 bytes directly received in process context from prequeue
    152208 packet headers predicted
    344744 packets header predicted and directly queued to user
    1419 acknowledgments not containing data payload received
    284057 predicted acknowledgments
    41 congestion windows recovered without slow start after partial ack
    36 timeouts in loss state
    1 retransmits in slow start
    46 other TCP timeouts
    TCPLossProbes: 2
    4 DSACKs sent for old packets
    12 connections reset due to unexpected data
    3 connections reset due to early user close
    4 connections aborted due to timeout
    IPReversePathFilter: 194
    TCPRcvCoalesce: 104075
    TCPOFOQueue: 2614
    TCPOFOMerge: 3
    TCPChallengeACK: 27
    TCPSpuriousRtxHostQueues: 2
    TCPAutoCorking: 68999
    TCPFromZeroWindowAdv: 15
    TCPToZeroWindowAdv: 22
    TCPWantZeroWindowAdv: 122
    TCPSynRetrans: 4
    TCPOrigDataSent: 561796
    TCPHystartTrainDetect: 3
    TCPHystartTrainCwnd: 50
    TCPACKSkippedChallenge: 31
    TCPKeepAlive: 2
IpExt:
    InNoRoutes: 1
    InMcastPkts: 82733
    OutMcastPkts: 2070
    InBcastPkts: 139441
    OutBcastPkts: 18
    InOctets: 976384465
    OutOctets: 295103139
    InMcastOctets: 8631056
    OutMcastOctets: 99130
    InBcastOctets: 17773399
    OutBcastOctets: 812
    InNoECTPkts: 1819528


  • UDP 만 별도 문제사항확인  
UDP Packet 의  RecvBufffer 의 문제를 알게되었는데, 이 문제를 net.core.rmem_max 변경과 socket option의 RecvBuff Size 올려주면 이를 에러율을 줄이는 것은 가능하다.
혹은 net.core.rmem_maxnet.core.rmem_default 변경을 해주는 것인데, 이것보다는 위의 것이 더 나은 방법인 것 같다.
(/etc/sysctrl.conf 에서 변경가능)

$ netstat -su    //UDP
IcmpMsg:
    InType3: 84
    OutType3: 1411
Udp:
    119049 packets received
    2339998 packets to unknown port received.
    6006884 packet receive errors
    2618 packets sent
    RcvbufErrors: 6006884                    //Recv Buffer Error , cat /proc/net/snmp | grep Udp 값 동일 
    IgnoredMulti: 494148
UdpLite:
IpExt:
    InNoRoutes: 1
    InMcastPkts: 170389
    OutMcastPkts: 6945
    InBcastPkts: 425852
    OutBcastPkts: 18
    InOctets: 14776499147
    OutOctets: 3391504334
    InMcastOctets: 11684052
    OutMcastOctets: 279654
    InBcastOctets: 39906199
    OutBcastOctets: 812
    InNoECTPkts: 12363330


UDP Packet Drop 현상 ( Test1, Test2 의 에러율 확인)
  https://stackoverflow.com/questions/21664950/udp-packet-drop-inerrors-vs-rcvbuferrors


  • Socket Buffer 설정정보확인 (proc)
OS마다 Socket에 할당하는 Memory는 다르며, 각 설정역시 다르기때문에 이 부분은 확인을 해야하며, 이부분도 부팅시 설정이 가능하다.

$ ls /proc/sys/net/core/
busy_poll      dev_weight             max_skb_frags  netdev_budget       netdev_tstamp_prequeue  rmem_max               tstamp_allow_data  wmem_max           xfrm_aevent_rseqth
busy_read      flow_limit_cpu_bitmap  message_burst  netdev_max_backlog  optmem_max              rps_sock_flow_entries  warnings           xfrm_acq_expires   xfrm_larval_drop
default_qdisc  flow_limit_table_len   message_cost   netdev_rss_key      rmem_default            somaxconn              wmem_default       xfrm_aevent_etime

//Socket Recv Buffer (Memory)
$ cat /proc/sys/net/core/rmem_default   //Socket Recv Buffer Default 
229376
$ cat /proc/sys/net/core/rmem_max   // Socket Recv Buffer Max 
16777216
//Socket Write Buffer (Memory)
$ cat /proc/sys/net/core/wmem_default   //Socket Write Buffer Default 
$ cat /proc/sys/net/core/wmem_max   // Socket Write Buffer Max 

  • IP기반의 protocol 정보
proc 정보를 이용하여 network 정보 확인

$ls /proc/sys/net/ipv4/
conf/                              ipfrag_high_thresh                 tcp_fin_timeout                    tcp_reordering
fwmark_reflect                     ipfrag_low_thresh                  tcp_frto                           tcp_retrans_collapse
icmp_echo_ignore_all               ipfrag_max_dist                    tcp_fwmark_accept                  tcp_retries1
icmp_echo_ignore_broadcasts        ipfrag_secret_interval             tcp_invalid_ratelimit              tcp_retries2
icmp_errors_use_inbound_ifaddr     ipfrag_time                        tcp_keepalive_intvl                tcp_rfc1337
icmp_ignore_bogus_error_responses  neigh/                             tcp_keepalive_probes               tcp_rmem
icmp_msgs_burst                    netfilter/                         tcp_keepalive_time                 tcp_sack
icmp_msgs_per_sec                  ping_group_range                   tcp_limit_output_bytes             tcp_slow_start_after_idle
icmp_ratelimit                     route/                             tcp_low_latency                    tcp_stdurg
icmp_ratemask                      tcp_abort_on_overflow              tcp_max_orphans                    tcp_syn_retries
igmp_link_local_mcast_reports      tcp_adv_win_scale                  tcp_max_reordering                 tcp_synack_retries
igmp_max_memberships               tcp_allowed_congestion_control     tcp_max_syn_backlog                tcp_thin_dupack
igmp_max_msf                       tcp_app_win                        tcp_max_tw_buckets                 tcp_thin_linear_timeouts
igmp_qrv                           tcp_autocorking                    tcp_mem                            tcp_timestamps
inet_peer_maxttl                   tcp_available_congestion_control   tcp_min_rtt_wlen                   tcp_tso_win_divisor
inet_peer_minttl                   tcp_base_mss                       tcp_min_tso_segs                   tcp_tw_recycle
inet_peer_threshold                tcp_challenge_ack_limit            tcp_moderate_rcvbuf                tcp_tw_reuse
ip_default_ttl                     tcp_congestion_control             tcp_mtu_probing                    tcp_window_scaling
ip_dynaddr                         tcp_default_init_rwnd              tcp_no_metrics_save                tcp_wmem
ip_early_demux                     tcp_dsack                          tcp_notsent_lowat                  tcp_workaround_signed_windows
ip_forward                         tcp_early_retrans                  tcp_orphan_retries                 udp_mem
ip_forward_use_pmtu                tcp_ecn                            tcp_pacing_ca_ratio                udp_rmem_min
ip_local_port_range                tcp_ecn_fallback                   tcp_pacing_ss_ratio                udp_wmem_min
ip_local_reserved_ports            tcp_fack                           tcp_probe_interval                 vs/
ip_no_pmtu_disc                    tcp_fastopen                       tcp_probe_threshold                xfrm4_gc_thresh

$ cat /proc/sys/net/ipv4/tcp_mem 
94236 125648 188472 


  • SNMP 관련정보 
netstat에서 보는 통계의 값과 유사하며, 네트워크 관리목적으로 사용이 되기 때문에, 추후 세부관리까지 한다면, SNMP를 이용하여 MIB로 정보를 제공하여 관리를 하도록 하자.

- TCP 관련부분 분석

$ cat /proc/net/snmp 
Ip: Forwarding DefaultTTL InReceives InHdrErrors InAddrErrors ForwDatagrams InUnknownProtos InDiscards InDelivers OutRequests OutDiscards OutNoRoutes ReasmTimeout ReasmReqds ReasmOKs ReasmFails FragOKs FragFails FragCreates
Ip: 1 64 12843660 0 0 0 0 0 12843660 22324680 0 0 0 0 0 0 0 0 0
Icmp: InMsgs InErrors InCsumErrors InDestUnreachs InTimeExcds InParmProbs InSrcQuenchs InRedirects InEchos InEchoReps InTimestamps InTimestampReps InAddrMasks InAddrMaskReps OutMsgs OutErrors OutDestUnreachs OutTimeExcds OutParmProbs OutSrcQuenchs OutRedirects OutEchos OutEchoReps OutTimestamps OutTimestampReps OutAddrMasks OutAddrMaskReps
Icmp: 1 0 0 1 0 0 0 0 0 0 0 0 0 0 4 0 4 0 0 0 0 0 0 0 0 0 0
IcmpMsg: InType3 OutType3
IcmpMsg: 1 4
Tcp: RtoAlgorithm RtoMin RtoMax MaxConn ActiveOpens PassiveOpens AttemptFails EstabResets CurrEstab InSegs OutSegs RetransSegs InErrs OutRsts InCsumErrors
Tcp: 1 200 120000 -1 224248 11 2 3 3 12799177 22311554 11 0 15 0
Udp: InDatagrams NoPorts InErrors OutDatagrams RcvbufErrors SndbufErrors InCsumErrors IgnoredMulti
Udp: 8452 3 0 3600 0 0 0 70
UdpLite: InDatagrams NoPorts InErrors OutDatagrams RcvbufErrors SndbufErrors InCsumErrors IgnoredMulti
UdpLite: 0 0 0 0 0 0 0 0 

- UDP RcvBuffErrors 분석

RecvbufErrors가 지속적으로 갑자기 증가되는 문제발생하여 관련된 부분 디버깅

$ netstat -su
IcmpMsg:
    InType3: 88
    OutType3: 88
Udp:
    6404859 packets received
    88 packets to unknown port received.
    2295229 packet receive errors
    1148 packets sent
    RcvbufErrors: 2295229
    IgnoredMulti: 281547
UdpLite:
IpExt:
    InMcastPkts: 10936
    OutMcastPkts: 2477
    InBcastPkts: 275312
    OutBcastPkts: 18
    InOctets: 12773054136
    OutOctets: 240440435
    InMcastOctets: 379933
    OutMcastOctets: 102955
    InBcastOctets: 23165236
    OutBcastOctets: 812
    InNoECTPkts: 9232445

$ cat /proc/net/snmp 
Ip: Forwarding DefaultTTL InReceives InHdrErrors InAddrErrors ForwDatagrams InUnknownProtos InDiscards InDelivers OutRequests OutDiscards OutNoRoutes ReasmTimeout ReasmReqds ReasmOKs ReasmFails FragOKs FragFails FragCreates
Ip: 1 64 7026190 0 1 0 0 0 7025803 300352 40 0 0 0 0 0 0 0 0
Icmp: InMsgs InErrors InCsumErrors InDestUnreachs InTimeExcds InParmProbs InSrcQuenchs InRedirects InEchos InEchoReps InTimestamps InTimestampReps InAddrMasks InAddrMaskReps OutMsgs OutErrors OutDestUnreachs OutTimeExcds OutParmProbs OutSrcQuenchs OutRedirects OutEchos OutEchoReps OutTimestamps OutTimestampReps OutAddrMasks OutAddrMaskReps
Icmp: 88 0 0 88 0 0 0 0 0 0 0 0 0 0 88 0 88 0 0 0 0 0 0 0 0 0 0
IcmpMsg: InType3 OutType3
IcmpMsg: 88 88
Tcp: RtoAlgorithm RtoMin RtoMax MaxConn ActiveOpens PassiveOpens AttemptFails EstabResets CurrEstab InSegs OutSegs RetransSegs InErrs OutRsts InCsumErrors
Tcp: 1 200 120000 -1 37 5 2 6 3 190165 374801 39 0 25 0
Udp: InDatagrams NoPorts InErrors OutDatagrams RcvbufErrors SndbufErrors InCsumErrors IgnoredMulti
Udp: 6155446 88 466455 1007 466455 0 0 206305
UdpLite: InDatagrams NoPorts InErrors OutDatagrams RcvbufErrors SndbufErrors InCsumErrors IgnoredMulti
UdpLite: 0 0 0 0 0 0 0 0

$ cat /proc/1695/net/udp   // RX QUEUE를 Socket으로 6x1024x1024로 설정했지만, 아래와 같이 12x1024x1024로 증가되었음 
  sl  local_address rem_address   st tx_queue rx_queue tr tm->when retrnsmt   uid  timeout inode ref pointer drops             
  229: 00000000:14E9 00000000:0000 07 00000000:00000000 00:00000000 00000000   110        0 33308 2 0000000000000000 0         
  306: 00000000:0536 00000000:0000 07 00000000:00C00300 00:00000000 00000000  1001        0 37343 2 0000000000000000 2295417   //RcvbufErrors 동일값 
 2136: 00000000:CC5C 00000000:0000 07 00000000:00000000 00:00000000 00000000 65534        0 34055 2 0000000000000000 0         
 3121: 0101007F:0035 00000000:0000 07 00000000:00000000 00:00000000 00000000     0        0 34043 2 0000000000000000 0         
 3121: 0237A8C0:0035 00000000:0000 07 00000000:00000000 00:00000000 00000000   111        0 24293 2 0000000000000000 0         
 3121: 0100007F:0035 00000000:0000 07 00000000:00000000 00:00000000 00000000     0        0 29242 2 0000000000000000 0         
 3121: 0137A8C0:0035 00000000:0000 07 00000000:00000000 00:00000000 00000000     0        0 29240 2 0000000000000000 0         
 3136: 00000000:0044 00000000:0000 07 00000000:00000000 00:00000000 00000000     0        0 300750 2 0000000000000000 0        
 3699: 00000000:0277 00000000:0000 07 00000000:00000000 00:00000000 00000000     0        0 321449 2 0000000000000000 0        
 3812: 00000000:D2E8 00000000:0000 07 00000000:00000000 00:00000000 00000000   110        0 33310 2 0000000000000000 0    

$ cat /proc/1695/oom_score 
193

$ netstat -aun
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address           Foreign Address         State      
udp        0      0 0.0.0.0:5353            0.0.0.0:*                          
udp   12585728      0 0.0.0.0:1334            0.0.0.0:*                 //00C00300 : 12583680 과 동일한 수치지만, 지속적으로 증가           
udp        0      0 0.0.0.0:52316           0.0.0.0:*                          
udp        0      0 127.0.1.1:53            0.0.0.0:*                          
udp        0      0 192.168.55.2:53         0.0.0.0:*                          
udp        0      0 127.0.0.1:53            0.0.0.0:*                          
udp        0      0 192.168.55.1:53         0.0.0.0:*                          
udp        0      0 0.0.0.0:68              0.0.0.0:*                          
udp        0      0 0.0.0.0:631             0.0.0.0:*                          
udp        0      0 0.0.0.0:53992           0.0.0.0:*                          
udp6       0      0 :::5353                 :::*                               
udp6       0      0 :::51705                :::*                               
udp6       0      0 fe80::c03:7dff:fea1::53 :::*                               
udp6       0      0 ::1:53                  :::* 


SOCKET의 SO_RCVBUF 설정
  https://serverfault.com/questions/758885/rx-queue-value-in-proc-net-udp-grows-to-twice-the-so-rcvbuf-value

2.1 OS 및 Socket 관련 세부설정  

상위 proc에서 확인된 socket 내부 buffer 설정을 linux에서는 sysctl 명령어로 변경이 가능하며, 이외 buffer 설정이외에도, 다양한 설정이 가능하다. 이부분은 별도의 Manual을 참조하자.
  • Socket 관련된 memory 설정값 확인 
$ sysctl -a | grep mem
sysctl: permission denied on key 'fs.protected_hardlinks'
sysctl: permission denied on key 'fs.protected_symlinks'
sysctl: permission denied on key 'kernel.cad_pid'
sysctl: permission denied on key 'kernel.usermodehelper.bset'
.....
//229376 =  224 * 1024
//6291456 = 6 * 1024 * 1024
//3145728 = 3 * 1024 * 1024
//16777216 = 16 * 1024 *1024
//12583680 = 12 * 1024 * 1024
//26214400 = 25 * 1024*1024
 
net.core.optmem_max = 20480
net.core.rmem_default = 229376         // Byte (UDP/TCP)
net.core.rmem_max = 229376             // Byte (UDP/TCP)
net.core.wmem_default = 229376        // Byte  (UDP/TCP)        
net.core.wmem_max = 229376            // Byte  (UDP/TCP)
net.ipv4.igmp_max_memberships = 20
sysctl: permission denied on key 'net.ipv4.tcp_fastopen_key'
sysctl: permission denied on key 'net.ipv6.conf.all.stable_secret'
net.ipv4.tcp_mem = 94236 125648 188472     // Page(4KB) , min / pressure / max  
net.ipv4.tcp_rmem = 4096 87380 6291456      // Byte         , min / pressure / max     
net.ipv4.tcp_wmem = 4096 16384 4194304     // Byte        , min / pressure / max
net.ipv4.udp_mem = 188472 251297 376944  // Page(4KB)    min / pressure / max
net.ipv4.udp_rmem_min = 4096
net.ipv4.udp_wmem_min = 4096
net.ipv4.vs.amemthresh = 1024
sysctl: permission denied on key 'net.ipv6.conf.default.stable_secret'
sysctl: permission denied on key 'net.ipv6.conf.docker0.stable_secret'
sysctl: permission denied on key 'net.ipv6.conf.dummy0.stable_secret'
sysctl: permission denied on key 'net.ipv6.conf.eth0.stable_secret'
sysctl: permission denied on key 'net.ipv6.conf.l4tbr0.stable_secret'
sysctl: permission denied on key 'net.ipv6.conf.lo.stable_secret'
sysctl: permission denied on key 'net.ipv6.conf.tunl0.stable_secret'
sysctl: permission denied on key 'net.ipv6.conf.usb0.stable_secret'
sysctl: permission denied on key 'net.ipv6.conf.usb1.stable_secret'
sysctl: permission denied on key 'net.ipv6.conf.wlan0.stable_secret'
sysctl: permission denied on key 'vm.mmap_rnd_bits'
sysctl: permission denied on key 'vm.mmap_rnd_compat_bits'
vm.lowmem_reserve_ratio = 256 32
vm.overcommit_memory = 0

  • Kernel의 내부 Socket Buffer 변경
실시간으로 network memory  변경

$ sysctl -w net.core.rmem_default="229376"
$ sysctl -w net.core.wmem_default="229376"
$ sysctl -w net.core.rmem_max="16777216"
$ sysctl -w net.core.wmem_max="16777216"
$ sysctl -w net.ipv4.tcp_rmem="229376 229376 16777216"
$ sysctl -w net.ipv4.tcp_wmem="229376 229376 16777216"

Recvbuffer 만 변경하여 테스트 진행

$ sudo sysctl -w net.core.rmem_default=26214400
$ sudo sysctl -w net.core.rmem_max=26214400

  • /etc/sysctl.conf 에서 기본설정 
상위 설정을 테스트로 하여 초기 부팅시 아래의 설정에서 기본으로 설정으로 정하자.

$ sudo vi /etc/sysctl.conf
........
net.core.rmem_max = 16777216
net.core.wmem_max = 16777216
net.ipv4.tcp_rmem = 4096 229376 16777216
net.ipv4.tcp_wmem = 4096 229376 16777216
........
$ ls /etc/sysctl.d/     // 확인 

man sysctl.conf 참조

/proc 및 /sys 정보관련정보
  https://www.kernel.org/doc/Documentation/sysctl/net.txt


  http://www.ubuntugeek.com/performance-tuning-with-system-control-sysctl-in-ubuntu.html
  https://kensei.co.kr/289
  https://rocksea.tistory.com/64
  https://meetup.toast.com/posts/53
  https://wwwx.cs.unc.edu/~sparkst/howto/network_tuning.php
  https://www.systutorials.com/241303/how-to-enlarge-linux-udp-buffer-size/
  https://m.blog.naver.com/PostView.nhn?blogId=parkjy76&logNo=220874390930&proxyReferer=https%3A%2F%2Fwww.google.com%2F

  https://stackoverflow.com/questions/31546835/tcp-receiving-window-size-higher-than-net-core-rmem-max

  https://m.blog.naver.com/PostView.nhn?blogId=kwoncharlie&logNo=10109682872&proxyReferer=https%3A%2F%2Fwww.google.com%2F



    • watch or shell script 를 이용하여 감시 

    $ sudo watch -d -n0 "netstat -atnp | grep ESTA"     // -d, difference , -n interval second , grep ESTABLISHED 된것을 확인 
    $ man watch // 세부명령어 확인 
    



    TCP 의 Socket 상태도
      https://upload.wikimedia.org/wikipedia/commons/e/e4/Tcp_state_diagram.svg


    1/16/2019

    Jetson TX2 Jetpack3.3 설치 및 USB Device 관련사항

    1. Jetson Tx2 Jetpack 설치 

    회사일을 Jetson Tx2관련일을 하게되어 이에 관련된 일을 간단히 정리하고자 한다.
    그리고, 인터넷에 오픈된 것만 관련하여 간단히 서술한다.

    현재 Ubuntu는 16.04LTS이며, 아래와 같이 Jetpack 3.3 설치를 하며, 설치 방법도 EVM의 영문 매뉴얼을 참조하면 어느정도 이해를 할수 있다.

    • Jetson TX2 Jetpack 설치 정보 
    현재 나의 경우는 JetPack L4T를 설치를 Force Recovery Mode를 이용하여 최종으로 설치한다음 아래와 같이 update와 upgrade를 진행했다.

    $ sudo apt update && sudo apt upgrade -y 

    아래의 부분은 Jetson TX2에서 진행을 했지만, 동작이 되지 않았다.

    $ sudo ./jetson_clocks.sh
    $ cd ~/tegra_multimedia_api/samples/backend
    ./backend 1 ../../data/Video/sample_outdoor_car_1080p_10fps.h264 H264 --trt-deployfile ../../data/Model/GoogleNet_one_class/GoogleNet_modified_oneClass_halfHD.prototxt --trt-modelfile ../../data/Model/GoogleNet_one_class/GoogleNet_modified_oneClass_halfHD.caffemodel --trt-forcefp32 0 --trt-proc-interval 1 -fps 10
    

    관련정보
      https://judo0179.tistory.com/19


    JetPack 3.3 Download
      https://developer.nvidia.com/embedded/jetpack

    JetPack Manual
     https://docs.nvidia.com/jetson/jetpack/index.html
     https://docs.nvidia.com/jetson/jetpack/introduction/index.html
     https://docs.nvidia.com/jetson/jetpack/release-notes/index.html

      https://devblogs.nvidia.com/jetson-tx2-delivers-twice-intelligence-edge/

    2. JetPack 설치 후 USB Device 정보 

    Jetson TX2의 Jetpack 3.3 설치 후 아래와 같이 USB의 설정확인하였으며, 간단히 정리해본다.


    일반적인 USB 정보 알아두자.
      https://ahyuo79.blogspot.com/2014/11/class-descriptor.html
      https://ahyuo79.blogspot.com/search/label/IF-USB

    • Host PC 확인  (JetsonTX2 USB 접속)
    Jetpack 3.3 설치 후 아래와 같이 USB를 확인을 해보면 Nvidia 관련사항을 확인가능
    좀더 자세히 분석하여 알아 보면 다음과 같다.

    Jetson TX2의 USB Device Mode 일경우 지원사항
    1. USB Mass Storage :  USB CDC 관련 Manual 내용 
    2. USB CDC-ACM :  /dev/ttyACM0 으로 Serial로 쉽게 Login 가능 
    3. USB CDC-RNDIS:  USB를 통하여 Window의 RNDIS Ethernet 사용가능 
    4. USB CDC-ether:  USB CDC Ethernet이며 RNDIS와 같이 연동되는 것 같음  
    결론적으로 USB Ethernet이 두개 지원가능하며, Serial도 지원가능 및 Mass Storage도 지원
    Window에서는 Network는 상위 CDC-RNDIS만 지원될 것라고 생각함


    USB CDC-Network Adapters (Kernel Config 사항) 
    ( Device Drivers - Network device support - USB Network Adapters)
    CONFIG_USB_NET_CDCETHER
    CONFIG_USB_NET_RNDIS_HOST
    CONFIG_USB_NET_CDC_EEM
    CONFIG_USB_NET_CDC_MBIM

    USB CDC ACM (Kernel Config 사항)
    ( Device Drivers - USB support)
    CONFIG_USB_ACM

    **CDC-ACM은 Ethernet 기반의 Adapter가 아니므로 별도로 /dev/ttyACMx 존재하지만,
    상위 Network Adapters들의 경우 별도의 /dev는 존재하지 않음 주의   

    USB CDC 관련세부사항 
      https://en.wikipedia.org/wiki/Ethernet_over_USB
      http://processors.wiki.ti.com/index.php/Networking_over_USB


    $ lsusb
    Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
    Bus 001 Device 007: ID 0955:7020 NVidia Corp. 
    Bus 001 Device 003: ID 045e:00cb Microsoft Corp. Basic Optical Mouse v2.0
    Bus 001 Device 002: ID 045e:07f8 Microsoft Corp. Wired Keyboard 600 (model 1576)
    Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
    
    $ lsusb -t  // Host USB 와 Module 관련부분 확인 
    /:  Bus 02.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/6p, 5000M
    /:  Bus 01.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/12p, 480M
        |__ Port 9: Dev 7, If 0, Class=Communications, Driver=rndis_host, 480M
        |__ Port 9: Dev 7, If 1, Class=CDC Data, Driver=rndis_host, 480M
        |__ Port 9: Dev 7, If 2, Class=Communications, Driver=cdc_acm, 480M
        |__ Port 9: Dev 7, If 3, Class=CDC Data, Driver=cdc_acm, 480M
        |__ Port 9: Dev 7, If 4, Class=Mass Storage, Driver=usb-storage, 480M
        |__ Port 9: Dev 7, If 5, Class=Communications, Driver=cdc_ether, 480M
        |__ Port 9: Dev 7, If 6, Class=CDC Data, Driver=cdc_ether, 480M
        |__ Port 11: Dev 2, If 0, Class=Human Interface Device, Driver=usbhid, 1.5M
        |__ Port 11: Dev 2, If 1, Class=Human Interface Device, Driver=usbhid, 1.5M
        |__ Port 12: Dev 3, If 0, Class=Human Interface Device, Driver=usbhid, 1.5M
    
    $ lsusb -d 0955:7020 -v  // Jetson TX2 USB Descriptor 확인 
    
    Bus 001 Device 004: ID 0955:7020 NVidia Corp. 
    Couldn't open device, some information will be missing
    Device Descriptor:
      bLength                18
      bDescriptorType         1
      bcdUSB               2.10
      bDeviceClass          239 Miscellaneous Device
      bDeviceSubClass         2 ?
      bDeviceProtocol         1 Interface Association
      bMaxPacketSize0        64
      idVendor           0x0955 NVidia Corp.
      idProduct          0x7020 
      bcdDevice            0.01
      iManufacturer           1 
      iProduct                2 
      iSerial                 3 
      bNumConfigurations      1
      Configuration Descriptor:
        bLength                 9
        bDescriptorType         2
        wTotalLength          248
        bNumInterfaces          7
        bConfigurationValue     1
        iConfiguration          4 
        bmAttributes         0x80
          (Bus Powered)
        MaxPower                2mA
        Interface Association:
          bLength                 8
          bDescriptorType        11
          bFirstInterface         0
          bInterfaceCount         2
          bFunctionClass          2 Communications
          bFunctionSubClass       6 Ethernet Networking
          bFunctionProtocol       0 
          iFunction               7 
        Interface Descriptor:
    ....
    


    • Host PC에서 관련 Module Driver 확인 
    사용되어지는 Module Driver를 알았으니, Depend를 알아보자.

    $ lsmod        // Host PC Module 사용확인 
    Module                  Size  Used by
    rndis_wlan             57344  0
    rndis_host             16384  1 rndis_wlan
    cfg80211              622592  1 rndis_wlan
    cdc_ether              16384  1 rndis_host
    usbnet                 45056  3 rndis_wlan,rndis_host,cdc_ether
    mii                    16384  1 usbnet
    uas                    24576  0
    usb_storage            69632  2 uas
    cdc_acm                32768  2
    pci_stub               16384  1
    vboxpci                24576  0
    vboxnetadp             28672  0
    vboxnetflt             28672  0
    vboxdrv               471040  3 vboxpci,vboxnetadp,vboxnetflt
    binfmt_misc            20480  1
    nls_iso8859_1          16384  2
    snd_hda_codec_hdmi     49152  1
    intel_rapl             20480  0
    snd_hda_codec_realtek   106496  1
    snd_hda_codec_generic    73728  1 snd_hda_codec_realtek
    x86_pkg_temp_thermal    16384  0
    intel_powerclamp       16384  0
    coretemp               16384  0
    kvm_intel             217088  0
    kvm                   598016  1 kvm_intel
    snd_hda_intel          40960  3
    snd_hda_codec         126976  4 snd_hda_codec_generic,snd_hda_codec_hdmi,snd_hda_intel,snd_hda_codec_realtek
    irqbypass              16384  1 kvm
    snd_hda_core           81920  5 snd_hda_codec_generic,snd_hda_codec_hdmi,snd_hda_intel,snd_hda_codec,snd_hda_codec_realtek
    snd_hwdep              20480  1 snd_hda_codec
    snd_pcm                98304  4 snd_hda_codec_hdmi,snd_hda_intel,snd_hda_codec,snd_hda_core
    crct10dif_pclmul       16384  0
    crc32_pclmul           16384  0
    snd_seq_midi           16384  0
    ghash_clmulni_intel    16384  0
    snd_seq_midi_event     16384  1 snd_seq_midi
    joydev                 24576  0
    pcbc                   16384  0
    input_leds             16384  0
    aesni_intel           188416  0
    aes_x86_64             20480  1 aesni_intel
    snd_rawmidi            32768  1 snd_seq_midi
    crypto_simd            16384  1 aesni_intel
    snd_seq                65536  2 snd_seq_midi,snd_seq_midi_event
    snd_seq_device         16384  3 snd_seq,snd_seq_midi,snd_rawmidi
    glue_helper            16384  1 aesni_intel
    snd_timer              32768  2 snd_seq,snd_pcm
    cryptd                 24576  3 crypto_simd,ghash_clmulni_intel,aesni_intel
    snd                    81920  17 snd_hda_codec_generic,snd_seq,snd_seq_device,snd_hda_codec_hdmi,snd_hwdep,snd_hda_intel,snd_hda_codec,snd_hda_codec_realtek,snd_timer,snd_pcm,snd_rawmidi
    soundcore              16384  1 snd
    intel_cstate           20480  0
    intel_rapl_perf        16384  0
    mei_me                 40960  0
    shpchp                 36864  0
    mei                    90112  1 mei_me
    acpi_pad              180224  0
    mac_hid                16384  0
    parport_pc             36864  1
    ppdev                  20480  0
    lp                     20480  0
    parport                49152  3 parport_pc,lp,ppdev
    autofs4                40960  2
    hid_generic            16384  0
    usbhid                 49152  0
    hid                   118784  2 usbhid,hid_generic
    i915                 1630208  104
    i2c_algo_bit           16384  1 i915
    drm_kms_helper        172032  1 i915
    syscopyarea            16384  1 drm_kms_helper
    e1000e                249856  0
    sysfillrect            16384  1 drm_kms_helper
    sysimgblt              16384  1 drm_kms_helper
    fb_sys_fops            16384  1 drm_kms_helper
    ptp                    20480  1 e1000e
    drm                   401408  6 drm_kms_helper,i915
    pps_core               20480  1 ptp
    ahci                   36864  3
    libahci                32768  1 ahci
    video                  45056  1 i915


    • Udev 관련부분 확인 
    좀 더 자세히 알고 싶다면 USB와 같이 동작되는 Udev 관련부분을 찾아보자.
    이 부분 까지 조사하지 않고 서술만 한다.

    $ ls /lib/udev/rules.d/
    39-usbmuxd.rules                     73-special-net-names.rules
    40-crda.rules                        73-usb-net-by-mac.rules
    40-usb-media-players.rules           75-net-description.rules
    ...
    
    $ ls /sys/class/net/
    enp0s20f0u9  enp0s20f0u9i5  enp0s31f6  lo
    

      https://wiki.archlinux.org/index.php/Android_tethering
      https://unix.stackexchange.com/questions/388300/udev-does-not-rename-usb-ethernet-device

    Udev관련 Rule
      http://fewstreet.com/2015/06/09/ubuntu-udev-naming-rules.html


    • Jetson TX2의 USB-ACM Interface 
    Jetson Manual을 읽어보면, 기본으로 nvidia/nvidia 로 id/pw로 제공을 하며, 두번째 id와 pw는 ubuntu/ubuntu를 제공해준다.


    $ ls /dev/ttyACM0    // USB ACM  Interface 확인 
    /dev/ttyACM0
    $ minicom -s    // JetsonTx2 접속  nvidia:nvidia 
    


    2.1 Jetson의 USB Ethernet 통신 설정 

    Host PC와 Jetson Tx2 USB의 설정을하면 USB를 통하여 Internet 통신이 가능하다.
    이를 이용하여 SSH 와 SFTP 및 추후 GDB까지 기능확장이 가능하다.
    이 관련 Manual은 Mass Storage의 영문 Manual을 참조하자.

    • Host PC의 USB Host 의 Network 설정 
    나의 경우 Host PC 아래와 같이  두 개의 USB Interface가 잡히며, 이를 설정해주자.
    이 관련내용은 Mass Storage의 영문 매뉴얼을 참조하자.

    직접설정

    $ sudo ifconfig enp0s20f0u9 192.168.55.3 netmask 255.255.255.0 up
    $ sudo ifconfig enp0s20f0u9i5 192.168.55.4 netmask 255.255.255.0 up
    

    설정환경

    $ sudo vi /etc/network/interfaces
    auto lo
    iface lo inet loopback
    
    #allow-hotplug enp0s20f0u9
    auto enp0s20f0u9
    iface enp0s20f0u9 inet static
    address 192.168.55.3
    netmask 255.255.255.0
    #gateway 192.168.55.1
    
    $ sudo /etc/init.d/networking restart
    $ sudo ifup enp0s20f0u9 
    
    Network 설정 
      https://wiki.debian.org/NetworkConfiguration

    설정후 확인

    $ ifconfig -a
    enp0s20f0u9 Link encap:Ethernet  HWaddr 86:dd:47:07:ec:e4  
              inet addr:192.168.55.3  Bcast:192.168.55.255  Mask:255.255.255.0
              inet6 addr: fe80::84dd:47ff:fe07:ece4/64 Scope:Link
              UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
              RX packets:761 errors:0 dropped:0 overruns:0 frame:0
              TX packets:1065 errors:0 dropped:0 overruns:0 carrier:0
              collisions:0 txqueuelen:1000 
              RX bytes:95357 (95.3 KB)  TX bytes:229667 (229.6 KB)
    
    enp0s20f0u9i5 Link encap:Ethernet  HWaddr 16:bd:4f:fa:6a:df  
              inet addr:192.168.55.4  Bcast:192.168.55.255  Mask:255.255.255.0
              inet6 addr: fe80::14bd:4fff:fefa:6adf/64 Scope:Link
              UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
              RX packets:800 errors:0 dropped:0 overruns:0 frame:0
              TX packets:1017 errors:0 dropped:0 overruns:0 carrier:0
              collisions:0 txqueuelen:1000 
              RX bytes:98669 (98.6 KB)  TX bytes:178966 (178.9 KB)
    
    enp0s31f6 Link encap:Ethernet  HWaddr 70:85:c2:3e:a8:2b  
              inet addr:10.0.0.107  Bcast:10.0.0.255  Mask:255.255.255.0
              inet6 addr: fe80::725b:9a50:8ca0:81e8/64 Scope:Link
              UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
              RX packets:31853921 errors:0 dropped:0 overruns:0 frame:0
              TX packets:317267 errors:0 dropped:0 overruns:0 carrier:0
              collisions:0 txqueuelen:1000 
              RX bytes:46162303120 (46.1 GB)  TX bytes:35161467 (35.1 MB)
              Interrupt:16 Memory:df000000-df020000 
    
    lo        Link encap:Local Loopback  
              inet addr:127.0.0.1  Mask:255.0.0.0
              inet6 addr: ::1/128 Scope:Host
              UP LOOPBACK RUNNING  MTU:65536  Metric:1
              RX packets:21308 errors:0 dropped:0 overruns:0 frame:0
              TX packets:21308 errors:0 dropped:0 overruns:0 carrier:0
              collisions:0 txqueuelen:1000 
              RX bytes:2903284 (2.9 MB)  TX bytes:2903284 (2.9 MB)
    
    


    • Jetson TX2의 USB Ethernet Device 설정 
    상위의 Serial 프로그램(minicom)을 이용하여 ttyACM0 접속하여  Jetson TX2의 ethernet 환경을 살펴보자

    Jetson Network 환경 확인

    $ ifconfig -a                                              
    docker0   Link encap:Ethernet  HWaddr 02:42:d0:89:67:5a                         
              inet addr:172.17.0.1  Bcast:172.17.255.255  Mask:255.255.0.0          
              UP BROADCAST MULTICAST  MTU:1500  Metric:1                            
              RX packets:0 errors:0 dropped:0 overruns:0 frame:0                    
              TX packets:0 errors:0 dropped:0 overruns:0 carrier:0                  
              collisions:0 txqueuelen:0                                             
              RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)                                
                                                                                    
    dummy0    Link encap:Ethernet  HWaddr 16:34:65:bc:75:19                         
              BROADCAST NOARP  MTU:1500  Metric:1                                   
              RX packets:0 errors:0 dropped:0 overruns:0 frame:0                    
              TX packets:0 errors:0 dropped:0 overruns:0 carrier:0                  
              collisions:0 txqueuelen:1000                                          
              RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)                                
                                                                                    
    eth0      Link encap:Ethernet  HWaddr 00:04:4b:c5:80:6f                         
              inet addr:10.0.0.170  Bcast:10.0.0.255  Mask:255.255.255.0            
              inet6 addr: fe80::9fdc:aa1b:faf4:9ad0/64 Scope:Link                   
              UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1                    
              RX packets:208078 errors:0 dropped:0 overruns:0 frame:0               
              TX packets:1925 errors:0 dropped:0 overruns:0 carrier:0               
              collisions:0 txqueuelen:1000                                          
              RX bytes:20077947 (20.0 MB)  TX bytes:354820 (354.8 KB)               
              Interrupt:42                                                          
                                                                                    
    l4tbr0    Link encap:Ethernet  HWaddr 7a:f3:26:af:7a:49                         
              inet addr:192.168.55.1  Bcast:192.168.55.255  Mask:255.255.255.0      
              inet6 addr: fe80::3851:d0ff:feaa:b4c4/64 Scope:Link                   
              UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1                    
              RX packets:10704 errors:0 dropped:0 overruns:0 frame:0                
              TX packets:101 errors:0 dropped:0 overruns:0 carrier:0                
              collisions:0 txqueuelen:1000                                          
              RX bytes:1739228 (1.7 MB)  TX bytes:10780 (10.7 KB)                   
                                                                                    
    lo        Link encap:Local Loopback                                             
              inet addr:127.0.0.1  Mask:255.0.0.0                                   
              inet6 addr: ::1/128 Scope:Host                                        
              UP LOOPBACK RUNNING  MTU:65536  Metric:1                              
              RX packets:219 errors:0 dropped:0 overruns:0 frame:0                  
              TX packets:219 errors:0 dropped:0 overruns:0 carrier:0                
              collisions:0 txqueuelen:1                                             
              RX bytes:16393 (16.3 KB)  TX bytes:16393 (16.3 KB)                    
                                                                                    
    tunl0     Link encap:IPIP Tunnel  HWaddr                                        
              NOARP  MTU:1480  Metric:1                                             
              RX packets:0 errors:0 dropped:0 overruns:0 frame:0                    
              TX packets:0 errors:0 dropped:0 overruns:0 carrier:0                  
              collisions:0 txqueuelen:1                                             
              RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)                                
                                                                                    
    usb0      Link encap:Ethernet  HWaddr 9e:52:2b:63:ed:f2                         
              inet6 addr: fe80::9c52:2bff:fe63:edf2/64 Scope:Link                   
              UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1                    
              RX packets:5407 errors:5407 dropped:0 overruns:0 frame:5407           
              TX packets:4407 errors:0 dropped:0 overruns:0 carrier:0               
              collisions:0 txqueuelen:1000                                          
              RX bytes:874353 (874.3 KB)  TX bytes:813177 (813.1 KB)                
                                                                                    
    usb1      Link encap:Ethernet  HWaddr 7a:f3:26:af:7a:49                         
              inet6 addr: fe80::78f3:26ff:feaf:7a49/64 Scope:Link                   
              UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1                    
              RX packets:5297 errors:0 dropped:0 overruns:0 frame:0                 
              TX packets:4519 errors:0 dropped:0 overruns:0 carrier:0               
              collisions:0 txqueuelen:1000                                          
              RX bytes:864875 (864.8 KB)  TX bytes:633831 (633.8 KB)                
                                                                                    
    wlan0     Link encap:Ethernet  HWaddr 00:04:4b:c5:80:6d                         
              UP BROADCAST MULTICAST  MTU:1500  Metric:1                            
              RX packets:0 errors:0 dropped:0 overruns:0 frame:0                    
              TX packets:0 errors:0 dropped:0 overruns:0 carrier:0                  
              collisions:0 txqueuelen:1000                                          
              RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)   
    

    usb0 직접 설정 or DHCP 설정

    $ sudo ifconfig usb0 192.168.55.2 netmask 255.255.255.0 up
    or
    $ udhcpc -i usb0   // DHCP Client로 설정 
    

    network 환경설정

    $ sudo vi /etc/network/interfaces
    # interfaces(5) file used by ifup(8) and ifdown(8)
    # Include files from /etc/network/interfaces.d:
    source-directory /etc/network/interfaces.d
    
    auto usb0
    iface usb0 inet static
    netmask 255.255.255.0
    address 192.168.55.2
    
    

    상위와 같이 설정후  Host PC에서 Jetson(192.168.55.2)로 접속가능.(SSH/SFTP/NFS)

    $ ssh nvidia@192.168.55.2   // ID: ubuntu 가능 
    $ sftp nvidia@192.168.55.2  // ID: ubuntu 가능 

    • Jetson 의 NFS지원 
    아래와 같이 Kernel에서 NFS는 지원이 되지만, /sbin/mount의 NFS가 지원이 되지 않아 별도의 package 설치
     
    $ cat /proc/filesystems | grep nfs  // Kernel의 NFS지원확인 
    $ sudo apt-get install nfs-common   // mount nfs 지원 
    $/sbin/mount  // mount 명령어 nfs 지원확인 
    mountall                mount.ecryptfs_private  mount.lowntfs-3g        mount.nfs4              mount.ntfs-3g
    mount.ecryptfs          mount.fuse              mount.nfs               mount.ntfs  
    

    Host PC의 NFS Server 설정 후 아래와 같이 테스트

    $ mount -t nfs -o nolock 192.168.5.3:/home/jhlee/test /home/nvidia/test 


    2.2 USB Storage

    이 부분은 추후 사용하기 위해 만든 것이며, 지금은 자료만 모음

    USB Mass Storage Disable
      https://askubuntu.com/questions/888052/how-to-block-all-usb-storage-devices-in-ubuntu
      https://www.cyberciti.biz/faq/linux-disable-modprobe-loading-of-usb-storage-driver/
      https://help.ubuntu.com/community/Mount/USB

    3.  Flash Jetson TX2

    Host PC에서 USB를 통해 손쉽게 Flash하며, Backup 도 가능하기 때문에 관련 Command를 소개한다.


    • USB Force Recovery Mode



    • flash.sh 기본사용법 
    Host PC와 Jetson의 microUSB 과 연결하여 USB를 통하여 Image를 Write or Read 할 수 있는 기능이다.





    • Host PC USB 연결확인 
    만약 문제가 있다면, 상위 USB Force Recovery Mode로 진입하자.

    $ lsusb  // Host 에서 USB 로 Jetson TX2 연결 후 Connection 확인
    .....
    Bus 001 Device 036: ID 0955:7020 NVidia Corp. 
    

    • Image Flash 방법  (USB 연결확인 후)
    $  cd jetsonTX2/64_TX2/Linux_for_Tegra // JetPack 3.3 설치 위치  
    $ sudo ./flash.sh  jetson-tx2 mmcblk0p1// For Jetson TX2 
    


    • Image Backup 및 Flash 방법 
    $ sudo ./flash.sh -r -k APP -G clone.img jetson-tx2 mmcblk0p1    //기존에 사용하던 Image Backup
    $ ls
    clone.img  clone.img.raw
    $ sudo cp clone.img.raw bootloader/system.img             // 실행전 반드시 bootloader/system.img bakcup  
    $ sudo ./flash.sh -r -k APP jetson-tx2 mmcblk0p1                              // 적용된 이미지로 Flash


    • mount system.img.raw 방법 
    system.img 는 mount가 되지 않으며, system.img.raw만 mount가 되었으며, mount 한 후에 NVIDIA에서 제공하는 SDK가 제대로 설치되었는지 확인하자.

    $ mkdir test   //mount 할 장소 
    $ sudo mount -t ext4 -o loop ./bootloader/system.img.raw ./test    // RAW File Mount
    
    $ ls test/      // Target File System , APP 
    README.txt  bin  boot  dev  etc  home  lib  lost+found  media  mnt  opt  proc  root  run  sbin  snap  srv  sys  tmp  usr  var // Target Filesystem 
    
    $ ls ./test/usr/local/      //CUDA 설치확인 
    bin  etc  games  include  lib  man  sbin  share  src    // 미설치 
    
    $ ls ./test/usr/src/      //tensorrt 설치 확인  /usr/src/tensorrt/bin/   , /usr/src/tensorrt/samples/
    linux-headers-4.4.38-tegra
    
    $ sudo umount test   // 반드시 unmount
    

    • flash.sh 사용법
    $ ./flash.sh -h
    
    Usage: sudo ./flash.sh [options]  
      Where,
     target board: Valid target board name.
     rootdev: Proper root device.
        options:
            -b  --------- nvflash boot control table config file.
            -c  --------- nvflash partition table config file.
            -d  --------- device tree file.
            -e  ------- Target device's eMMC size.
            -f  -------- Path to flash application: nvflash or tegra-rcm.
            -h ------------------- print this message.
            -i ------------------- pass user kernel commandline as-is to kernel.
            -k  ---- partition name or number specified in flash.cfg.
            -m  ----- MTS preboot such as mts_preboot_si.
            -n  -------- Static nfs network assignments
                                   :::
            -o  --------- ODM data.
            -p  --------- Total eMMC HW boot partition size.
            -r ------------------- skip building and reuse existing system.img.
            -s ----- PKC key used for signing and building bl_update_payload.
            -t  ------- tegraboot binary such as nvtboot.bin
            -u  -------- PKC server in @ format.
            -w  --------- warm boot binary such as nvtbootwb0.bin
            -x  --------- Tegra CHIPID. default = 0x18(jetson-tx2)
                                   0x21(jetson-tx1), 0x40(jetson-tk1).
            -y  -------- PKC for secureboot, NS for non-secureboot.
            -z  -------------- Serial Number of target board.
            -B  --------- BoardId.
            -C  --------- Kernel commandline arguments.
                                   WARNING:
                                   Each option in this kernel commandline gets
                                   higher preference over the same option from
                                   fastboot. In case of NFS booting, this script
                                   adds NFS booting related arguments, if -i option
                                   is omitted.
            -F  --------- Flash server such as fastboot.bin.
            -G  ------- Read partition and save image to file.
            -I  ---------- initrd file. Null initrd is default.
            -K  ---------- Kernel image file such as zImage or Image.
            -L  ------ Bootloader such as cboot.bin or u-boot-dtb.bin.
            -M  -------- MTS boot file such as mts_si.
            -N  --------- i.e. :/my/exported/nfs/rootfs.
            -P  -- Primary GPT start address + size of PPT + 1.
            -R  ------ Sample rootfs directory.
            -S  ------------ Rootfs size in bytes. Valid only for internal
                                   rootdev. KiB, MiB, GiB short hands are allowed,
                                   for example, 1GiB means 1024 * 1024 * 1024 bytes.
            -T  -------- ITS file name. Valid only for u-boot.
            --no-flash ----------- perform all steps except physically flashing the board.
                                   This will create a system.img.
            --bup ---------------- Generate bootloader update payload(BUP).
            --multi-spec---------- Enable support for building multi-spec BUP.
            --clean-up------------ Clean up BUP buffer when multi-spec is enabled.
            --usb-instance  -- Specify the USB instance to connect to; integer
                                   ID (e.g. 0, 1), bus/dev (e.g. 003/091), or USB
                                   port path (e.g. 3-14). The latter is best.
    



    • Jetson TX2 Partion 구조 (Jetson TX2 확인)
    Jetson TX2에서 Terminal에 접속후에 MBR이 아닌 GPT 방식 이므로 아래와 같이 확인하자

    $nvidia@tegra-ubuntu:~$ sudo fdisk -l /dev/mmcblk0
    Disk /dev/mmcblk0: 29.1 GiB, 31268536320 bytes, 61071360 sectors
    Units: sectors of 1 * 512 = 512 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes
    Disklabel type: gpt
    Disk identifier: 00000000-0000-0000-0000-000000000000
    
    Device             Start      End  Sectors   Size Type
    /dev/mmcblk0p1      4097 58724352 58720256    28G Microsoft basic data
    /dev/mmcblk0p2  58724353 58732544     8192     4M Microsoft basic data
    /dev/mmcblk0p3  58732545 58740736     8192     4M Microsoft basic data
    /dev/mmcblk0p4  58740737 58741760     1024   512K Microsoft basic data
    /dev/mmcblk0p5  58741761 58742784     1024   512K Microsoft basic data
    /dev/mmcblk0p6  58742785 58743808     1024   512K Microsoft basic data
    /dev/mmcblk0p7  58743809 58744832     1024   512K Microsoft basic data
    /dev/mmcblk0p8  58744833 58750976     6144     3M Microsoft basic data
    /dev/mmcblk0p9  58750977 58757120     6144     3M Microsoft basic data
    /dev/mmcblk0p10 58757121 58761216     4096     2M Microsoft basic data
    /dev/mmcblk0p11 58761217 58762424     1208   604K Microsoft basic data
    /dev/mmcblk0p12 58762425 58763632     1208   604K Microsoft basic data
    /dev/mmcblk0p13 58763633 58764632     1000   500K Microsoft basic data
    /dev/mmcblk0p14 58764633 58765632     1000   500K Microsoft basic data
    /dev/mmcblk0p15 58765633 58769728     4096     2M Microsoft basic data
    /dev/mmcblk0p16 58769729 58773824     4096     2M Microsoft basic data
    /dev/mmcblk0p17 58773825 58786112    12288     6M Microsoft basic data
    /dev/mmcblk0p18 58786113 58798400    12288     6M Microsoft basic data
    /dev/mmcblk0p19 58798401 58802496     4096     2M Microsoft basic data
    /dev/mmcblk0p20 58802497 59064640   262144   128M Microsoft basic data
    /dev/mmcblk0p21 59064641 59326784   262144   128M Microsoft basic data
    /dev/mmcblk0p22 59326785 59392320    65536    32M Microsoft basic data
    /dev/mmcblk0p23 59392321 59457856    65536    32M Microsoft basic data
    /dev/mmcblk0p24 59457857 59588928   131072    64M Microsoft basic data
    /dev/mmcblk0p25 59588929 59720000   131072    64M Microsoft basic data
    /dev/mmcblk0p26 59720001 59721024     1024   512K Microsoft basic data
    /dev/mmcblk0p27 59721025 59722048     1024   512K Microsoft basic data
    /dev/mmcblk0p28 59722049 60246336   524288   256M Microsoft basic data
    /dev/mmcblk0p29 60246337 61071326   824990 402.8M Microsoft basic data
     
    
    
    $nvidia@tegra-ubuntu:~$ sudo gdisk -l /dev/mmcblk0
    GPT fdisk (gdisk) version 1.0.1
    
    Partition table scan:
      MBR: protective
      BSD: not present
      APM: not present
      GPT: present
    
    Found valid GPT with protective MBR; using GPT.
    Disk /dev/mmcblk0: 61071360 sectors, 29.1 GiB
    Logical sector size: 512 bytes
    Disk identifier (GUID): 00000000-0000-0000-0000-000000000000
    Partition table holds up to 29 entries
    First usable sector is 4097, last usable sector is 61071327
    Partitions will be aligned on 1-sector boundaries
    Total free space is 1 sectors (512 bytes)
    
    Number  Start (sector)    End (sector)  Size       Code  Name
       1            4097        58724352   28.0 GiB    0700  APP
       2        58724353        58732544   4.0 MiB     0700  mts-bootpack
       3        58732545        58740736   4.0 MiB     0700  mts-bootpack_b
       4        58740737        58741760   512.0 KiB   0700  cpu-bootloader
       5        58741761        58742784   512.0 KiB   0700  cpu-bootloader_b
       6        58742785        58743808   512.0 KiB   0700  bootloader-dtb
       7        58743809        58744832   512.0 KiB   0700  bootloader-dtb_b
       8        58744833        58750976   3.0 MiB     0700  secure-os
       9        58750977        58757120   3.0 MiB     0700  secure-os_b
      10        58757121        58761216   2.0 MiB     0700  eks
      11        58761217        58762424   604.0 KiB   0700  bpmp-fw
      12        58762425        58763632   604.0 KiB   0700  bpmp-fw_b
      13        58763633        58764632   500.0 KiB   0700  bpmp-fw-dtb
      14        58764633        58765632   500.0 KiB   0700  bpmp-fw-dtb_b
      15        58765633        58769728   2.0 MiB     0700  sce-fw
      16        58769729        58773824   2.0 MiB     0700  sce-fw_b
      17        58773825        58786112   6.0 MiB     0700  sc7
      18        58786113        58798400   6.0 MiB     0700  sc7_b
      19        58798401        58802496   2.0 MiB     0700  FBNAME
      20        58802497        59064640   128.0 MiB   0700  BMP
      21        59064641        59326784   128.0 MiB   0700  BMP_b
      22        59326785        59392320   32.0 MiB    0700  SOS
      23        59392321        59457856   32.0 MiB    0700  SOS_b
      24        59457857        59588928   64.0 MiB    0700  kernel
      25        59588929        59720000   64.0 MiB    0700  kernel_b
      26        59720001        59721024   512.0 KiB   0700  kernel-dtb
      27        59721025        59722048   512.0 KiB   0700  kernel-dtb_b
      28        59722049        60246336   256.0 MiB   0700  CAC
      29        60246337        61071326   402.8 MiB   0700  UDA
     
    



    관련문서는 아래를 참조 혹은 설치시 Start_L4T_Docs.html 부분을 참조

    Jetson_X2_Developer_Kit_User_Guide.pdf
      https://developer.nvidia.com/embedded/dlc/l4t-27-1-jetson-tx2-user-guide

    6/10/2018

    IEEE 802.3 L2 관련사항

    1. IEEE 802.x 관련 내용 

    아래 Wiki 정보를 보면 IEEE802.x에 진행중인 그룹들을 쉽게 알수 있다. IEEE 802.1/3/11를 제외하면 더 이상 신기술이 없을 것 같다.
    이외에 IEEE 802.x 그룹이 있지만, 나에게는 큰 관심거리가 아니라서 아래와 같이 정리한다.

    현재관심은 IEEE 802.3/ 2 / 1 이며, IEEE 802.11 이 어떻게 IEEE 802.3과 호환이 되는지 그부분이 관심사 이다

    NameDescriptionNote
    IEEE 802.1Higher Layer LAN Protocols (Bridging)active
    IEEE 802.2LLCdisbanded
    IEEE 802.3Ethernetactive
    IEEE 802.4Token busdisbanded
    IEEE 802.5Token ring MAC layerdisbanded
    IEEE 802.6MANs (DQDB)disbanded
    IEEE 802.7Broadband LAN using Coaxial Cabledisbanded
    IEEE 802.8Fiber Optic TAGdisbanded
    IEEE 802.9Integrated Services LAN (ISLAN or isoEthernet)disbanded
    IEEE 802.10Interoperable LAN Securitydisbanded
    IEEE 802.11Wireless LAN (WLAN) & Mesh (Wi-Fi certification)active

    그외의 자료는 아래의 Wiki 참고
      https://en.wikipedia.org/wiki/IEEE_802


    1.1 IEEE 802.x 관련정보 

    IEEE 802.3 관련세부정보
      https://en.wikipedia.org/wiki/IEEE_802.3

    IEEE 802.3 (CSMA/CD)
      https://en.wikipedia.org/wiki/Carrier-sense_multiple_access_with_collision_detection

    IEEE 802.11 (CSMA/CA)
      https://en.wikipedia.org/wiki/Carrier-sense_multiple_access_with_collision_avoidance


    2. Ethernet Frame (Layer 2)

    Ethernet은 OSI의 Layer 2에 해당하며, 기존에 가지고 있던 Ethernet 지식으로 Packet을 분석을 해보면 가끔 이해 안될 때 가 있어 이 부분을 좀 더 알아보려 한다.

    정확히 궁금한 부분은 MAC 주소와 다양한 EtherType 부분이며, WLAN과 호환성일 것이다.

    802.3 Ethernet packet and frame structure
    LayerPreambleStart of frame delimiterMAC destinationMAC source802.1Q tag (optional)Ethertype (Ethernet II) or length (IEEE 802.3)PayloadFrame check sequence(32‑bit CRC)Interpacket gap
    octets1 octet6 octets6 octets(4 octets)2 octets46‑1500 octets4 octets12 octets
    Layer 2 Ethernet frame← 64–1522 octets →
    Layer 1 Ethernet packet & IPG← 72–1530 octets →← 12 octets →
    The optional 802.1Q tag consumes additional space in the frame. Field sizes for this option are indicated parenthetically in the table above. IEEE 802.1ad (Q-in-Q) allows for multiple tags in each frame. This option is not illustrated here.


    • VLAN(Virtual LAN, 802.1Q)
    802.1Q은 옵션이기때문에, EtherType과 같은 위치에 존재하므로, 사용해야 한다면 EtherType: 0x8100 설정하고, Layer2 에 802.1Q의 TAG가 삽입되며서 EtherType은 TPID로변경이되어 Layer2가 확장된다.

    802.1Q (Virtual LAN)는 아래 wiki보면 쉽게 이해간다.
    1. EtherType: 0x8100
    2. EtherType: 0x88A8
      https://en.wikipedia.org/wiki/IEEE_802.1Q



    • IEEE 802.2/3 EtherType or Length의 선택 
    기존의 Ethernet은 EtherType을 Length로 사용하여, 46(0x002E) ~ 1500(0x05DC)를 했지만, 이 영역을 피하여,
    Ethernet v2는 1536(0x0600)이상 설정하여 EtherType로 설정한다.


    Ethernet frame differentiation
    Frame typeEthertype or lengthPayload start two bytes
    Ethernet II≥ 1536Any
    Novell raw IEEE 802.3≤ 15000xFFFF
    IEEE 802.2 LLC≤ 1500Other
    IEEE 802.2 SNAP≤ 15000xAAAA


    MTU 관련내용
      https://en.wikipedia.org/wiki/Maximum_transmission_unit


    • Ethernet Type 2 Frame 
    EtherType : 0x0800  IPv4로 사용하면 Payload 역시 1500+14+4 = 1518이지만, 스니핑을 하게되면 CRC는 L2에서 제거되어 Max 1514로 표시




    상세한 내용은 아래 WIKI 정보참고
      https://en.wikipedia.org/wiki/Ethernet_frame


    2.1 MAC Address 

    Layer2의 MAC Address는 기본구성은 6Bytes 이며 8x6=48bit이로 구성이 되었다.
    이를 MAC-48 이라 불렀지만, 구식이되어 이를 EUI-48이라고 호칭하고 있다.
    그리고 이에 나아가 2bytes를 추가한 EUI-64 사용을 장려한다고 한다.

    • MAC-48/EUI-48을 EUI-64 확장방법 
    아래의 Wiki 사이트에 예제뿐만아니라 설명이 잘되어있다.


    • MAC-48 or EUI-48의 기본구조 파악 
    이론상으로 2^48 즉 281,474,976,710,656 가진 경우의 수를 사용할 수 있지만, 다음과 같은 구조로 분리가 되어 제약이 있다.

    우선 3Bytes 두개로 분리되어 다음과 같은 목적으로 사용이 된다.
    1. OUI(Organisationally Unique Identifier) : 기업/기관이 사용으로 번호를 구입
    2. NIC(Network Interface Controller): 구입한 기업/기관이 각각 사용할 있는 번호들 

    앞의 3byte인 OUI를 보면 앞의 1 Byte의 7bit 정보로 UNICAST/MULTICAST이 알수있다.
    1. UNICAST(0)    : 일반적인 통신 
    2. MULTICAST(1) : Multicast 할때 사용 
    3. BROADCAST:  Destination MAC을 전부 (FF:FF:FF:FF:FF:FF)로 설정 
    앞의 3byte인 OUI를 보면 앞의 1 Byte의 6bit 정보로 글로벌/개인용 분리
    1. Globally Unique Address (0)
    2. Locally administered Address(1) 






    OUI
      https://en.wikipedia.org/wiki/Organizationally_unique_identifier

    MAC
      https://en.wikipedia.org/wiki/MAC_address
      https://en.wikipedia.org/wiki/Medium_access_control


    2.2 EtherType

    다양한 EtherType을 정리하는 것이지만, 일반적으로 많이 사용되는 EtherType부터 알아보자.
    • 일반 LAN 관련사항 
    1. 0x0800   : IPv4
    2. 0x86DD  : IPv6
    3. 0x0806   : ARP

    • WLAN 관련사항 
    1. 0x888E  :  EAP over LAN (IEEE 802.1X)
    2. 0x88C7  :  Pre-Authentication

    EtherType values for some notable protocols[8]
    EtherTypeProtocol
    0x0800Internet Protocol version 4 (IPv4)
    0x0806Address Resolution Protocol (ARP)
    0x0842Wake-on-LAN
    0x22F3IETF TRILL Protocol
    0x22EAStream Reservation Protocol
    0x6003DECnet Phase IV
    0x8035Reverse Address Resolution Protocol
    0x809BAppleTalk (Ethertalk)
    0x80F3AppleTalk Address Resolution Protocol (AARP)
    0x8100VLAN-tagged frame (IEEE 802.1Q) and Shortest Path Bridging IEEE 802.1aq with NNI compatibility
    0x8137IPX
    0x8204QNX Qnet
    0x86DDInternet Protocol Version 6 (IPv6)
    0x8808Ethernet flow control
    0x8809Ethernet Slow Protocols
    0x8819CobraNet
    0x8847MPLS unicast
    0x8848MPLS multicast
    0x8863PPPoE Discovery Stage
    0x8864PPPoE Session Stage
    0x886DIntel Advanced Networking Services 
    0x8870Jumbo Frames (Obsoleted draft-ietf-isis-ext-eth-01)
    0x887BHomePlug 1.0 MME
    0x888EEAP over LAN (IEEE 802.1X)
    0x8892PROFINET Protocol
    0x889AHyperSCSI (SCSI over Ethernet)
    0x88A2ATA over Ethernet
    0x88A4EtherCAT Protocol
    0x88A8Provider Bridging (IEEE 802.1ad) & Shortest Path Bridging IEEE 802.1aq
    0x88ABEthernet Powerlink
    0x88B8GOOSE (Generic Object Oriented Substation event)
    0x88B9GSE (Generic Substation Events) Management Services
    0x88BASV (Sampled Value Transmission)
    0x88CCLink Layer Discovery Protocol (LLDP)
    0x88CDSERCOS III
    0x88DCWSMP, WAVE Short Message Protocol
    0x88E1HomePlug AV MME
    0x88E3Media Redundancy Protocol (IEC62439-2)
    0x88E5MAC security (IEEE 802.1AE)
    0x88E7Provider Backbone Bridges (PBB) (IEEE 802.1ah)
    0x88F7Precision Time Protocol (PTP) over Ethernet (IEEE 1588)
    0x88F8NC-SI
    0x88FBParallel Redundancy Protocol (PRP)
    0x8902IEEE 802.1ag Connectivity Fault Management (CFM) Protocol / ITU-T Recommendation Y.1731 (OAM)
    0x8906Fibre Channel over Ethernet (FCoE)
    0x8914FCoE Initialization Protocol
    0x8915RDMA over Converged Ethernet (RoCE)
    0x891DTTEthernet Protocol Control Frame (TTE)
    0x892FHigh-availability Seamless Redundancy (HSR)
    0x9000Ethernet Configuration Testing Protocol
    0x9100VLAN-tagged (IEEE 802.1Q) frame with double tagging

    다양한 EtherType 관련자료
      http://en.wikipedia.org/wiki/EtherType
      http://standards-oui.ieee.org/ethertype/eth.txt
      https://nmap.org/book/nping-man-ethernet-options.html
      https://www.iana.org/assignments/ieee-802-numbers/ieee-802-numbers.xhtml

    2.3 Multicast 사용시 MAC Address 범위와 EtherType

    MAC주소의 OUI에서 Multicast Bit정보를 알았으니, 그 기반으로 사용되어지는 Multicast MAC주소 범위를 알려준다. 

    WLAN(802.11) 도 EtherType: 0x0800 (IPv4) ,EtherType: 0x86DD (IPv6) 동일하게 사용한다고한다.

    Some well known Ethernet multicast addresses
    Ethernet multicast addressType FieldUsage
    01-00-0C-CC-CC-CCCDP (Cisco Discovery Protocol), VTP (VLAN Trunking Protocol), UDLD (Unidirectional Link Detection)
    01-00-0C-CC-CC-CDCisco Shared Spanning Tree Protocol Address
    01-80-C2-00-00-00Spanning Tree Protocol (for bridges) IEEE 802.1D
    01-80-C2-00-00-00, or
    01-80-C2-00-00-03, or 01-80-C2-00-00-0E
    0x88CCLink Layer Discovery Protocol
    01-80-C2-00-00-080x0802Spanning Tree Protocol (for provider bridges) IEEE 802.1ad
    01-80-C2-00-00-010x8808Ethernet flow control (Pause frame) IEEE 802.3x
    01-80-C2-00-00-020x8809Ethernet OAM Protocol IEEE 802.3ah (A.K.A. "slow protocols")
    01-80-C2-00-00-30 - 01-80-C2-00-00-3F0x8902Ethernet CFM Protocol IEEE 802.1ag
    01-00-5E-00-00-00 - 01-00-5E-7F-FF-FF0x0800IPv4 Multicast (RFC 1112), insert the low 23 Bits of the multicast IPv4 Address into the Ethernet Address (RFC 7042 2.1.1.)
    33-33-xx-xx-xx-xx0x86DDIPv6 Multicast (RFC 2464), insert the low 32 Bits of the multicast IPv6 Address into the Ethernet Address (RFC 7042 2.3.1.)
    01-0C-CD-01-00-00 -
    01-0C-CD-01-01-FF
    0x88B8IEC 61850-8-1 GOOSE Type 1/1A
    01-0C-CD-02-00-00 -
    01-0C-CD-02-01-FF
    0x88B9GSSE (IEC 61850 8-1)
    01-0C-CD-04-00-00 -
    01-0C-CD-04-01-FF
    0x88BAMulticast sampled values (IEC 61850 8-1)
    01-1B-19-00-00-00, or
    01-80-C2-00-00-0E
    0x88F7Precision Time Protocol (PTP) version 2 over Ethernet (layer-2)

    이더넷 멀티캐스트
      https://en.wikipedia.org/wiki/Multicast_address


    멀티캐스트
      http://karhem.tistory.com/36