SlideShare a Scribd company logo
1 of 37
Download to read offline
NAT
Traversal
and P2P
Jung-In.Jung
(call518@gmail.com)
1st 2016-02-20
2nd 2020-01-03
1
Background
• UDP 기반의 P2P 애플리케이션과 NAT는 상극
• P2P=피해자 / NAT=가해자
• “NAT 내부의 단말은 외부의 연결요청 수신이 불가능 하다.”
• ex) 대표적 이슈
• 서로 다른 NAT에 속한 2대의 단말이 상호간 직접 통신 불가
• NAT는 내부 네트워크를 추상화
• A→B 커넥션 시도는 B의 NAT-B가 차단
• B→A 커넥션 시도는 A의 NAT-A가 차단
2
NAT-A NAT-B
A B
X
X
?
?
What is NAT
• NAT = Network Address Translation
• Private Network에 위치하는 단말이 Public Network(인터넷)와 통
신이 가능하도록 상호 간에 연결 시켜 주는 기능.
• “Binding Table” & “Filtering Table”
• NAT 종류
• Basic NAT
• IP 변환 (Layer3)
• 1:1 translation (1 = Public IP, 1 = Private IP)
• NAPT (Network Address Port Translation)
• IP/Port 변환 (Layer4)
• 1:N translation (1 = Public IP, N = Private IP)
• 현재 사용되는 대부분의 NAT장비/공유기
3
Mapping
Behavior
NAT Behavior Requirement
4
Mapping Behavior
• Address and Port Mapping
• IP Address Pooling
• Arbitrary (pre Session)
• Paired (pre Host)
• Port Assignment
• Port Preservation
• Port Overloading
• No Port Overloading
• No Port Preservation
• Port Assignment Rule (Port Range)
• Mapping Timer (Binding Refresh Timer)
• Mapping Refresh Behavior
• NAT Outbound refresh behavior of "True“
• NAT Inbound refresh behavior of "True"
5
Address and Port Mapping
EIM (Endpoint-Independent Mapping)
• S-IP, S-Port 정보로 External Port 결정
• 출발지 정보만 동일하면 동일한 Port 할당
6
http://www.netmanias.com/ko/?m=view&id=blog&no=5833
Address and Port Mapping
ADM (Address-Dependent Mapping)
• S-IP, S-Port, D-IP 정보로 External Port 결정
7
http://www.netmanias.com/ko/?m=view&id=blog&no=5833
Address and Port Mapping
APDM (Address and Port-Dependent Mapping)
• S-IP, S-Port, D-IP, D-Port 정보로 External Port 결정
8
http://www.netmanias.com/ko/?m=view&id=blog&no=5833
Filtering
Behavior
NAT Behavior Requirement
9
Filtering Behavior
EIF (Endpoint-Independent Filtering)
• D-IP, D-Port 만 검사하여 ACCEPT 판단
• Inbound패킷과 Binding Entry의 D-IP, D-Port만 일치하면 허용
10
http://www.netmanias.com/ko/?m=view&id=blog&no=5839
Filtering Behavior
ADF (Address-Dependent Filtering)
• D-IP, D-Port, S-IP 만 검사하여 ACCEPT 판단
11
http://www.netmanias.com/ko/?m=view&id=blog&no=5839
Filtering Behavior
APDF (Address and Port-Dependent Filtering)
• D-IP, D-Port, S-IP, S-Port 전체 검사 후 ACCEPT 판단
12
http://www.netmanias.com/ko/?m=view&id=blog&no=5839
9-Tyeps
(4-Types)
NAT Types
13
NAT Types
• by Behavior
14
http://www.netmanias.com/ko/?m=view&id=blog&no=6263
NAT Types
• RFC 3489 (2003년) → RFC 5389 (2008년) → RFC 5780 (2010년)
• Mapping/Filtering Behavior 조합을 통해, 총 9가지 NAT 타입 가능
15
http://www.netmanias.com/ko/?m=view&id=blog&no=5847
Technique
NAT Traversal
16
ITEF Standard for NAT Traversal
ITEF Standard
• STUN (Session Traversal Utilities for NAT)
• 단말 스스로가 NAT의 존재 유무, NAT 타입식별, External IP/Port 정보를
찾아내도록 도와주는 프로토콜이다.
• STUN 서버, STUN 클라이언트(단말)로 구성
• NAT 이슈를 단말이 능동적으로 해결 (NAT Type에 제한적)
• TURN (Traversal Using Relay NAT)
• 단말들은 공중망에 위치한 TURN 서버와 세션을 설정
• TRUN 서버가 단말간 통신을 중계
• Symmetric NAT(APDM+APDF) 환경에서 통신 가능한 유일한 방법
• ICE (Interactive Connectivity Establishment)
• STUN/TURN을 사용할 때 P2P 방식을 통해 최적의 라우팅 제공 기법
• 세션 설정 과정에서 가능한 모든 S-IP를 동원하여 시그널링 시도
• 주소들의 우선순위는 직접 통신 가능한 주소가 우선
• Local Address(Device) > NAT Address(STUN) > Relay Address(TURN)
17
NAT Traversal Technique
Techniques
• Relaying (TURN)
• Connection Reversal
• UDP Hole Punching
18
Relaying (TURN)
• 개념
• 사설 IP 주소를 가지는 두 단말 간에 직접 통신이 불가능하여, 공인 IP
주소를 가지는 외부 서버를 통해 P2P 데이터 패킷을 Relay하는 개념
• 최종 목적지(상대 단말) 정보는 Replay로 보내는 패킷의 Payload로 전
달
• 장점
• NAT Behavior(Mapping/Filtering)와 관계 없이 모두(9-Types) 지원
• 단점
• 모든 P2P 데이터 패킷이 Relay 서버를 경유
• Relay 서버의 부하 증가
• Relay 서버의 네트워크 대역폭 이슈 발생
• Relay 서버가 분산 배치되지 않은 환경에서는 P2P 통신의 지연 발생
19
Relaying (TURN)
20
http://www.netmanias.com/ko/?m=view&id=blog&no=6264
Connection Reversal
• 개념
• P2P통신을 하려는 두 단말 중 하나는 공인 IP를 가지는 경우 적용 가
능
• Private단말→Public단말로의 연결은 문제 없음 (like
Client→WebServer)
• Public단말 →Private단말로의 연결은 NAT에 의해 차단됨
• 외부 Messaging 서버를 통해 Public단말이 Private단말로 하여금 자
신에게 연결을 하도록 유도(Reverse Connection Request in Payload)
하여 NAT에 “Binding/Filtering Table” 테이블 생성
• 장점
• P2P 데이터 패킷이 Messaging 서버를 통하지 않는다
• NAT Behavior(Mapping/Filtering)와 관계 없이 모두(9-Types) 지원
• 단점
• P2P 단말 중 하나는 반드시 공인 IP 주소 필요
21
Connection Reversal
22
http://www.netmanias.com/ko/?m=view&id=blog&no=6264
Connection Reversal
23
http://www.netmanias.com/ko/?m=view&id=blog&no=6264
UDP Hole Punching
• 개념
• 공중망의 Messaging서버를 통해 P2P 단말간 연결 지원
• 특징
• EIM-NAT타입만 지원
• Filtering Behavior은 모두 지원
• EIF과 EDF에 따라 미세한 차이
• 가장 효율적인 NAT Traversal 기법
24
EIF EDF (ADF/APDF)
1. 모든 단말은 Payload를 이용해 자신의 Private/Public 정보를 Messaging 서버에 전송/등록
2. Messaging 서버는 모든 단말의 Private/Public 정보를 보관
3. 각 단말들은 P2P통신을 위해 Messaging 에서 상대방 단말 정보 조회
4. Messaging서버는 Payload를 통해 각 단말에게 통신하고자 하는 상대방의 정보를 리턴
(조회 요청 단말과 조회 당한 단말 모두에게 동시 응답)
5. 각 단말은 리턴 된 Payload의 정보를 이용해 상대 단말로 상호 P2P 연결 시도
6. 연결 성공
6. 먼저 연결 시도된 단말은 1회 실패
7. 늦게 시도된 단말은 정상 연결
8. 1회 실패한 단말은 2회부터 정상 연결
UDP Hole Punching – EIM & EIF
25
http://www.netmanias.com/ko/?m=view&id=blog&no=6263
UDP Hole Punching – EIM & EIF
26
http://www.netmanias.com/ko/?m=view&id=blog&no=6263
UDP Hole Punching – EIM & EIF
27
http://www.netmanias.com/ko/?m=view&id=blog&no=6263
UDP Hole Punching - EIM & EDF
28
http://www.netmanias.com/ko/?m=view&id=blog&no=6263
UDP Hole Punching - EIM & EDF
29
http://www.netmanias.com/ko/?m=view&id=blog&no=6263
UDP Hole Punching - EIM & EDF
30http://www.netmanias.com/ko/?m=view&id=blog&no=6263
UDP Hole Punching - EIM & EDF
31
http://www.netmanias.com/ko/?m=view&id=blog&no=6263
UDP Hole Punching - Summary
32
http://www.netmanias.com/ko/?m=view&id=blog&no=6263
Appendix
33
Hairpinning
Behavior
NAT Behavior Requirement
34
Hairpinning Behavior
External Source IP Address and Port
• 변조된 패킷의 Source IP/Source Port가 External Address/Port
35
http://www.netmanias.com/ko/?m=view&id=blog&no=5839
Hairpinning Behavior
Internal Source IP Address and Port
• 변조된 패킷의 Source IP/Source Port가 Internal Address/Port
36
http://www.netmanias.com/ko/?m=view&id=blog&no=5839
Closing
References
• NAT (Network Address Translation) 소개 (RFC 3022/2663)
• NAT 장비는 이렇게 만들어야 하는데... (RFC 4787) - 1편: Mapping Behavior
• NAT 장비는 이렇게 만들어야 하는데... (RFC 4787) - 2편: Filtering Behavior
• NAT 장비는 이렇게 만들어야 하는데... (RFC 4787) - 3편: Deterministic Properties
• P2P와 NAT: NAT 통과 기법 소개 (RFC 5128) - 1편: Relaying & Connection Reversal
• P2P와 NAT: NAT 통과 기법 소개 (RFC 5128) - 2편: UDP Hole Punching
• STUN(RFC 3489)과 STUN(RFC 5389/5780)의 차이
• STUN(RFC 3489)을 이용한 NAT Behavior Discovery
NETMANIAS 후원
http://www.netmanias.com/ko/?m=view&id=sitenews&no=8335
37

More Related Content

What's hot

Presto Summit 2018 - 09 - Netflix Iceberg
Presto Summit 2018  - 09 - Netflix IcebergPresto Summit 2018  - 09 - Netflix Iceberg
Presto Summit 2018 - 09 - Netflix Icebergkbajda
 
SparkSQL: A Compiler from Queries to RDDs
SparkSQL: A Compiler from Queries to RDDsSparkSQL: A Compiler from Queries to RDDs
SparkSQL: A Compiler from Queries to RDDsDatabricks
 
Accelerating Apache Spark Shuffle for Data Analytics on the Cloud with Remote...
Accelerating Apache Spark Shuffle for Data Analytics on the Cloud with Remote...Accelerating Apache Spark Shuffle for Data Analytics on the Cloud with Remote...
Accelerating Apache Spark Shuffle for Data Analytics on the Cloud with Remote...Databricks
 
Lisa 2015-gluster fs-hands-on
Lisa 2015-gluster fs-hands-onLisa 2015-gluster fs-hands-on
Lisa 2015-gluster fs-hands-onGluster.org
 
Emr spark tuning demystified
Emr spark tuning demystifiedEmr spark tuning demystified
Emr spark tuning demystifiedOmid Vahdaty
 
Lisa 2015-gluster fs-introduction
Lisa 2015-gluster fs-introductionLisa 2015-gluster fs-introduction
Lisa 2015-gluster fs-introductionGluster.org
 
Changelog Stream Processing with Apache Flink
Changelog Stream Processing with Apache FlinkChangelog Stream Processing with Apache Flink
Changelog Stream Processing with Apache FlinkFlink Forward
 
DevConf 2014 Kernel Networking Walkthrough
DevConf 2014   Kernel Networking WalkthroughDevConf 2014   Kernel Networking Walkthrough
DevConf 2014 Kernel Networking WalkthroughThomas Graf
 
Building Reliable Lakehouses with Apache Flink and Delta Lake
Building Reliable Lakehouses with Apache Flink and Delta LakeBuilding Reliable Lakehouses with Apache Flink and Delta Lake
Building Reliable Lakehouses with Apache Flink and Delta LakeFlink Forward
 
Streaming Event Time Partitioning with Apache Flink and Apache Iceberg - Juli...
Streaming Event Time Partitioning with Apache Flink and Apache Iceberg - Juli...Streaming Event Time Partitioning with Apache Flink and Apache Iceberg - Juli...
Streaming Event Time Partitioning with Apache Flink and Apache Iceberg - Juli...Flink Forward
 
The Parquet Format and Performance Optimization Opportunities
The Parquet Format and Performance Optimization OpportunitiesThe Parquet Format and Performance Optimization Opportunities
The Parquet Format and Performance Optimization OpportunitiesDatabricks
 
A Deep Dive into Query Execution Engine of Spark SQL
A Deep Dive into Query Execution Engine of Spark SQLA Deep Dive into Query Execution Engine of Spark SQL
A Deep Dive into Query Execution Engine of Spark SQLDatabricks
 
NAT64 and DNS64 in 30 minutes
NAT64 and DNS64 in 30 minutesNAT64 and DNS64 in 30 minutes
NAT64 and DNS64 in 30 minutesIvan Pepelnjak
 
Apache Spark Streaming: Architecture and Fault Tolerance
Apache Spark Streaming: Architecture and Fault ToleranceApache Spark Streaming: Architecture and Fault Tolerance
Apache Spark Streaming: Architecture and Fault ToleranceSachin Aggarwal
 
[ACNA2022] Hadoop Vectored IO_ your data just got faster!.pdf
[ACNA2022] Hadoop Vectored IO_ your data just got faster!.pdf[ACNA2022] Hadoop Vectored IO_ your data just got faster!.pdf
[ACNA2022] Hadoop Vectored IO_ your data just got faster!.pdfMukundThakur22
 
Data Source API in Spark
Data Source API in SparkData Source API in Spark
Data Source API in SparkDatabricks
 
Data Engineering Efficiency @ Netflix - Strata 2017
Data Engineering Efficiency @ Netflix - Strata 2017Data Engineering Efficiency @ Netflix - Strata 2017
Data Engineering Efficiency @ Netflix - Strata 2017Michelle Ufford
 
Exactly-Once Financial Data Processing at Scale with Flink and Pinot
Exactly-Once Financial Data Processing at Scale with Flink and PinotExactly-Once Financial Data Processing at Scale with Flink and Pinot
Exactly-Once Financial Data Processing at Scale with Flink and PinotFlink Forward
 
uReplicator: Uber Engineering’s Scalable, Robust Kafka Replicator
uReplicator: Uber Engineering’s Scalable,  Robust Kafka ReplicatoruReplicator: Uber Engineering’s Scalable,  Robust Kafka Replicator
uReplicator: Uber Engineering’s Scalable, Robust Kafka ReplicatorMichael Hongliang Xu
 
Stream processing using Kafka
Stream processing using KafkaStream processing using Kafka
Stream processing using KafkaKnoldus Inc.
 

What's hot (20)

Presto Summit 2018 - 09 - Netflix Iceberg
Presto Summit 2018  - 09 - Netflix IcebergPresto Summit 2018  - 09 - Netflix Iceberg
Presto Summit 2018 - 09 - Netflix Iceberg
 
SparkSQL: A Compiler from Queries to RDDs
SparkSQL: A Compiler from Queries to RDDsSparkSQL: A Compiler from Queries to RDDs
SparkSQL: A Compiler from Queries to RDDs
 
Accelerating Apache Spark Shuffle for Data Analytics on the Cloud with Remote...
Accelerating Apache Spark Shuffle for Data Analytics on the Cloud with Remote...Accelerating Apache Spark Shuffle for Data Analytics on the Cloud with Remote...
Accelerating Apache Spark Shuffle for Data Analytics on the Cloud with Remote...
 
Lisa 2015-gluster fs-hands-on
Lisa 2015-gluster fs-hands-onLisa 2015-gluster fs-hands-on
Lisa 2015-gluster fs-hands-on
 
Emr spark tuning demystified
Emr spark tuning demystifiedEmr spark tuning demystified
Emr spark tuning demystified
 
Lisa 2015-gluster fs-introduction
Lisa 2015-gluster fs-introductionLisa 2015-gluster fs-introduction
Lisa 2015-gluster fs-introduction
 
Changelog Stream Processing with Apache Flink
Changelog Stream Processing with Apache FlinkChangelog Stream Processing with Apache Flink
Changelog Stream Processing with Apache Flink
 
DevConf 2014 Kernel Networking Walkthrough
DevConf 2014   Kernel Networking WalkthroughDevConf 2014   Kernel Networking Walkthrough
DevConf 2014 Kernel Networking Walkthrough
 
Building Reliable Lakehouses with Apache Flink and Delta Lake
Building Reliable Lakehouses with Apache Flink and Delta LakeBuilding Reliable Lakehouses with Apache Flink and Delta Lake
Building Reliable Lakehouses with Apache Flink and Delta Lake
 
Streaming Event Time Partitioning with Apache Flink and Apache Iceberg - Juli...
Streaming Event Time Partitioning with Apache Flink and Apache Iceberg - Juli...Streaming Event Time Partitioning with Apache Flink and Apache Iceberg - Juli...
Streaming Event Time Partitioning with Apache Flink and Apache Iceberg - Juli...
 
The Parquet Format and Performance Optimization Opportunities
The Parquet Format and Performance Optimization OpportunitiesThe Parquet Format and Performance Optimization Opportunities
The Parquet Format and Performance Optimization Opportunities
 
A Deep Dive into Query Execution Engine of Spark SQL
A Deep Dive into Query Execution Engine of Spark SQLA Deep Dive into Query Execution Engine of Spark SQL
A Deep Dive into Query Execution Engine of Spark SQL
 
NAT64 and DNS64 in 30 minutes
NAT64 and DNS64 in 30 minutesNAT64 and DNS64 in 30 minutes
NAT64 and DNS64 in 30 minutes
 
Apache Spark Streaming: Architecture and Fault Tolerance
Apache Spark Streaming: Architecture and Fault ToleranceApache Spark Streaming: Architecture and Fault Tolerance
Apache Spark Streaming: Architecture and Fault Tolerance
 
[ACNA2022] Hadoop Vectored IO_ your data just got faster!.pdf
[ACNA2022] Hadoop Vectored IO_ your data just got faster!.pdf[ACNA2022] Hadoop Vectored IO_ your data just got faster!.pdf
[ACNA2022] Hadoop Vectored IO_ your data just got faster!.pdf
 
Data Source API in Spark
Data Source API in SparkData Source API in Spark
Data Source API in Spark
 
Data Engineering Efficiency @ Netflix - Strata 2017
Data Engineering Efficiency @ Netflix - Strata 2017Data Engineering Efficiency @ Netflix - Strata 2017
Data Engineering Efficiency @ Netflix - Strata 2017
 
Exactly-Once Financial Data Processing at Scale with Flink and Pinot
Exactly-Once Financial Data Processing at Scale with Flink and PinotExactly-Once Financial Data Processing at Scale with Flink and Pinot
Exactly-Once Financial Data Processing at Scale with Flink and Pinot
 
uReplicator: Uber Engineering’s Scalable, Robust Kafka Replicator
uReplicator: Uber Engineering’s Scalable,  Robust Kafka ReplicatoruReplicator: Uber Engineering’s Scalable,  Robust Kafka Replicator
uReplicator: Uber Engineering’s Scalable, Robust Kafka Replicator
 
Stream processing using Kafka
Stream processing using KafkaStream processing using Kafka
Stream processing using Kafka
 

Similar to NAT Traversal and P2P

글로벌 모바일 네트워크 환경 이해 Understanding global mobile network situation
글로벌 모바일 네트워크 환경 이해 Understanding global mobile network situation글로벌 모바일 네트워크 환경 이해 Understanding global mobile network situation
글로벌 모바일 네트워크 환경 이해 Understanding global mobile network situationJonghyon Sohn
 
GOTHAM 오픈소스 메쉬 네트워킹 소프트웨어 패키지
GOTHAM 오픈소스 메쉬 네트워킹 소프트웨어 패키지GOTHAM 오픈소스 메쉬 네트워킹 소프트웨어 패키지
GOTHAM 오픈소스 메쉬 네트워킹 소프트웨어 패키지Kyunghee Univ
 
웹기반원격감시제어 2010 CPD
웹기반원격감시제어 2010 CPD웹기반원격감시제어 2010 CPD
웹기반원격감시제어 2010 CPD활 김
 
Private cloud network architecture (2018)
Private cloud network architecture (2018)Private cloud network architecture (2018)
Private cloud network architecture (2018)Gasida Seo
 
소켓프로그래밍 기초요약
소켓프로그래밍 기초요약소켓프로그래밍 기초요약
소켓프로그래밍 기초요약세빈 정
 
[OpenStack Days Korea 2016] Track2 - How to speed up OpenStack network with P...
[OpenStack Days Korea 2016] Track2 - How to speed up OpenStack network with P...[OpenStack Days Korea 2016] Track2 - How to speed up OpenStack network with P...
[OpenStack Days Korea 2016] Track2 - How to speed up OpenStack network with P...OpenStack Korea Community
 
Netmanias L2,L3 Training (1) L2 Ethernet
Netmanias L2,L3 Training (1) L2 EthernetNetmanias L2,L3 Training (1) L2 Ethernet
Netmanias L2,L3 Training (1) L2 EthernetChris Changmo Yoo
 
[MeetUp][2nd] 오리뎅이의_쿠버네티스_네트워킹_v1.2
[MeetUp][2nd] 오리뎅이의_쿠버네티스_네트워킹_v1.2[MeetUp][2nd] 오리뎅이의_쿠버네티스_네트워킹_v1.2
[MeetUp][2nd] 오리뎅이의_쿠버네티스_네트워킹_v1.2InfraEngineer
 
Network virtualization for the better understanding of Data Center Network
Network virtualization for the better understanding of Data Center NetworkNetwork virtualization for the better understanding of Data Center Network
Network virtualization for the better understanding of Data Center NetworkInho Kang
 
Solaris11 기초 자료
Solaris11 기초 자료Solaris11 기초 자료
Solaris11 기초 자료Dong-Hwa jung
 
Opendaylight beryllium
Opendaylight berylliumOpendaylight beryllium
Opendaylight berylliumCheolmin Lee
 
[MeetUp][1st] 오리뎅이의_쿠버네티스_네트워킹
[MeetUp][1st] 오리뎅이의_쿠버네티스_네트워킹[MeetUp][1st] 오리뎅이의_쿠버네티스_네트워킹
[MeetUp][1st] 오리뎅이의_쿠버네티스_네트워킹InfraEngineer
 
TCP/IP Protocol - JAVA
TCP/IP Protocol - JAVATCP/IP Protocol - JAVA
TCP/IP Protocol - JAVAcooddy
 
오픈스택 멀티노드 설치 후기
오픈스택 멀티노드 설치 후기오픈스택 멀티노드 설치 후기
오픈스택 멀티노드 설치 후기영우 김
 
Solaris 11 network virtualization & Server Virtualization for cloud
Solaris 11 network virtualization & Server Virtualization for cloudSolaris 11 network virtualization & Server Virtualization for cloud
Solaris 11 network virtualization & Server Virtualization for cloudsuk kim
 
ONF Atrium 분석
ONF Atrium 분석ONF Atrium 분석
ONF Atrium 분석jungbh
 
Before OTD EDU Assignments
Before OTD EDU AssignmentsBefore OTD EDU Assignments
Before OTD EDU AssignmentsBeom Lee
 
2nd SDN Interest Group Seminar-Session3 (121218)
2nd SDN Interest Group Seminar-Session3 (121218)2nd SDN Interest Group Seminar-Session3 (121218)
2nd SDN Interest Group Seminar-Session3 (121218)NAIM Networks, Inc.
 
[2018] 오픈스택 5년 운영의 경험
[2018] 오픈스택 5년 운영의 경험[2018] 오픈스택 5년 운영의 경험
[2018] 오픈스택 5년 운영의 경험NHN FORWARD
 
[오픈소스컨설팅] Open stack kilo with DVR_CEPH_v1.1
[오픈소스컨설팅] Open stack kilo with DVR_CEPH_v1.1[오픈소스컨설팅] Open stack kilo with DVR_CEPH_v1.1
[오픈소스컨설팅] Open stack kilo with DVR_CEPH_v1.1Ji-Woong Choi
 

Similar to NAT Traversal and P2P (20)

글로벌 모바일 네트워크 환경 이해 Understanding global mobile network situation
글로벌 모바일 네트워크 환경 이해 Understanding global mobile network situation글로벌 모바일 네트워크 환경 이해 Understanding global mobile network situation
글로벌 모바일 네트워크 환경 이해 Understanding global mobile network situation
 
GOTHAM 오픈소스 메쉬 네트워킹 소프트웨어 패키지
GOTHAM 오픈소스 메쉬 네트워킹 소프트웨어 패키지GOTHAM 오픈소스 메쉬 네트워킹 소프트웨어 패키지
GOTHAM 오픈소스 메쉬 네트워킹 소프트웨어 패키지
 
웹기반원격감시제어 2010 CPD
웹기반원격감시제어 2010 CPD웹기반원격감시제어 2010 CPD
웹기반원격감시제어 2010 CPD
 
Private cloud network architecture (2018)
Private cloud network architecture (2018)Private cloud network architecture (2018)
Private cloud network architecture (2018)
 
소켓프로그래밍 기초요약
소켓프로그래밍 기초요약소켓프로그래밍 기초요약
소켓프로그래밍 기초요약
 
[OpenStack Days Korea 2016] Track2 - How to speed up OpenStack network with P...
[OpenStack Days Korea 2016] Track2 - How to speed up OpenStack network with P...[OpenStack Days Korea 2016] Track2 - How to speed up OpenStack network with P...
[OpenStack Days Korea 2016] Track2 - How to speed up OpenStack network with P...
 
Netmanias L2,L3 Training (1) L2 Ethernet
Netmanias L2,L3 Training (1) L2 EthernetNetmanias L2,L3 Training (1) L2 Ethernet
Netmanias L2,L3 Training (1) L2 Ethernet
 
[MeetUp][2nd] 오리뎅이의_쿠버네티스_네트워킹_v1.2
[MeetUp][2nd] 오리뎅이의_쿠버네티스_네트워킹_v1.2[MeetUp][2nd] 오리뎅이의_쿠버네티스_네트워킹_v1.2
[MeetUp][2nd] 오리뎅이의_쿠버네티스_네트워킹_v1.2
 
Network virtualization for the better understanding of Data Center Network
Network virtualization for the better understanding of Data Center NetworkNetwork virtualization for the better understanding of Data Center Network
Network virtualization for the better understanding of Data Center Network
 
Solaris11 기초 자료
Solaris11 기초 자료Solaris11 기초 자료
Solaris11 기초 자료
 
Opendaylight beryllium
Opendaylight berylliumOpendaylight beryllium
Opendaylight beryllium
 
[MeetUp][1st] 오리뎅이의_쿠버네티스_네트워킹
[MeetUp][1st] 오리뎅이의_쿠버네티스_네트워킹[MeetUp][1st] 오리뎅이의_쿠버네티스_네트워킹
[MeetUp][1st] 오리뎅이의_쿠버네티스_네트워킹
 
TCP/IP Protocol - JAVA
TCP/IP Protocol - JAVATCP/IP Protocol - JAVA
TCP/IP Protocol - JAVA
 
오픈스택 멀티노드 설치 후기
오픈스택 멀티노드 설치 후기오픈스택 멀티노드 설치 후기
오픈스택 멀티노드 설치 후기
 
Solaris 11 network virtualization & Server Virtualization for cloud
Solaris 11 network virtualization & Server Virtualization for cloudSolaris 11 network virtualization & Server Virtualization for cloud
Solaris 11 network virtualization & Server Virtualization for cloud
 
ONF Atrium 분석
ONF Atrium 분석ONF Atrium 분석
ONF Atrium 분석
 
Before OTD EDU Assignments
Before OTD EDU AssignmentsBefore OTD EDU Assignments
Before OTD EDU Assignments
 
2nd SDN Interest Group Seminar-Session3 (121218)
2nd SDN Interest Group Seminar-Session3 (121218)2nd SDN Interest Group Seminar-Session3 (121218)
2nd SDN Interest Group Seminar-Session3 (121218)
 
[2018] 오픈스택 5년 운영의 경험
[2018] 오픈스택 5년 운영의 경험[2018] 오픈스택 5년 운영의 경험
[2018] 오픈스택 5년 운영의 경험
 
[오픈소스컨설팅] Open stack kilo with DVR_CEPH_v1.1
[오픈소스컨설팅] Open stack kilo with DVR_CEPH_v1.1[오픈소스컨설팅] Open stack kilo with DVR_CEPH_v1.1
[오픈소스컨설팅] Open stack kilo with DVR_CEPH_v1.1
 

More from JungIn Jung

Ceph Durability and Replica Data Lost - PG Numbers / Replica Failure
Ceph Durability and Replica Data Lost - PG Numbers / Replica FailureCeph Durability and Replica Data Lost - PG Numbers / Replica Failure
Ceph Durability and Replica Data Lost - PG Numbers / Replica FailureJungIn Jung
 
Eywa - Cloud Network Architecture 20180625(20150907)(compact)
Eywa - Cloud Network Architecture 20180625(20150907)(compact)Eywa - Cloud Network Architecture 20180625(20150907)(compact)
Eywa - Cloud Network Architecture 20180625(20150907)(compact)JungIn Jung
 
EYEA HA Workflow
EYEA HA WorkflowEYEA HA Workflow
EYEA HA WorkflowJungIn Jung
 
EYWA Presentation v0.1.27
EYWA Presentation v0.1.27EYWA Presentation v0.1.27
EYWA Presentation v0.1.27JungIn Jung
 
Virtualized Datacenter as a Service (vDCaaS)
Virtualized Datacenter as a Service (vDCaaS)Virtualized Datacenter as a Service (vDCaaS)
Virtualized Datacenter as a Service (vDCaaS)JungIn Jung
 
Limitation of Cloud Networking & Eywa virtual network model for full HA and LB
Limitation of Cloud Networking & Eywa virtual network model for full HA and LBLimitation of Cloud Networking & Eywa virtual network model for full HA and LB
Limitation of Cloud Networking & Eywa virtual network model for full HA and LBJungIn Jung
 
About VXLAN (2013)
About VXLAN (2013)About VXLAN (2013)
About VXLAN (2013)JungIn Jung
 
Qemu & KVM Guide #1 (intro & basic)
Qemu & KVM Guide #1 (intro & basic)Qemu & KVM Guide #1 (intro & basic)
Qemu & KVM Guide #1 (intro & basic)JungIn Jung
 

More from JungIn Jung (9)

Ceph Durability and Replica Data Lost - PG Numbers / Replica Failure
Ceph Durability and Replica Data Lost - PG Numbers / Replica FailureCeph Durability and Replica Data Lost - PG Numbers / Replica Failure
Ceph Durability and Replica Data Lost - PG Numbers / Replica Failure
 
Eywa - Cloud Network Architecture 20180625(20150907)(compact)
Eywa - Cloud Network Architecture 20180625(20150907)(compact)Eywa - Cloud Network Architecture 20180625(20150907)(compact)
Eywa - Cloud Network Architecture 20180625(20150907)(compact)
 
EYEA HA Workflow
EYEA HA WorkflowEYEA HA Workflow
EYEA HA Workflow
 
EYWA Presentation v0.1.27
EYWA Presentation v0.1.27EYWA Presentation v0.1.27
EYWA Presentation v0.1.27
 
Virtualized Datacenter as a Service (vDCaaS)
Virtualized Datacenter as a Service (vDCaaS)Virtualized Datacenter as a Service (vDCaaS)
Virtualized Datacenter as a Service (vDCaaS)
 
SDN TEST Suite
SDN TEST SuiteSDN TEST Suite
SDN TEST Suite
 
Limitation of Cloud Networking & Eywa virtual network model for full HA and LB
Limitation of Cloud Networking & Eywa virtual network model for full HA and LBLimitation of Cloud Networking & Eywa virtual network model for full HA and LB
Limitation of Cloud Networking & Eywa virtual network model for full HA and LB
 
About VXLAN (2013)
About VXLAN (2013)About VXLAN (2013)
About VXLAN (2013)
 
Qemu & KVM Guide #1 (intro & basic)
Qemu & KVM Guide #1 (intro & basic)Qemu & KVM Guide #1 (intro & basic)
Qemu & KVM Guide #1 (intro & basic)
 

NAT Traversal and P2P

  • 2. Background • UDP 기반의 P2P 애플리케이션과 NAT는 상극 • P2P=피해자 / NAT=가해자 • “NAT 내부의 단말은 외부의 연결요청 수신이 불가능 하다.” • ex) 대표적 이슈 • 서로 다른 NAT에 속한 2대의 단말이 상호간 직접 통신 불가 • NAT는 내부 네트워크를 추상화 • A→B 커넥션 시도는 B의 NAT-B가 차단 • B→A 커넥션 시도는 A의 NAT-A가 차단 2 NAT-A NAT-B A B X X ? ?
  • 3. What is NAT • NAT = Network Address Translation • Private Network에 위치하는 단말이 Public Network(인터넷)와 통 신이 가능하도록 상호 간에 연결 시켜 주는 기능. • “Binding Table” & “Filtering Table” • NAT 종류 • Basic NAT • IP 변환 (Layer3) • 1:1 translation (1 = Public IP, 1 = Private IP) • NAPT (Network Address Port Translation) • IP/Port 변환 (Layer4) • 1:N translation (1 = Public IP, N = Private IP) • 현재 사용되는 대부분의 NAT장비/공유기 3
  • 5. Mapping Behavior • Address and Port Mapping • IP Address Pooling • Arbitrary (pre Session) • Paired (pre Host) • Port Assignment • Port Preservation • Port Overloading • No Port Overloading • No Port Preservation • Port Assignment Rule (Port Range) • Mapping Timer (Binding Refresh Timer) • Mapping Refresh Behavior • NAT Outbound refresh behavior of "True“ • NAT Inbound refresh behavior of "True" 5
  • 6. Address and Port Mapping EIM (Endpoint-Independent Mapping) • S-IP, S-Port 정보로 External Port 결정 • 출발지 정보만 동일하면 동일한 Port 할당 6 http://www.netmanias.com/ko/?m=view&id=blog&no=5833
  • 7. Address and Port Mapping ADM (Address-Dependent Mapping) • S-IP, S-Port, D-IP 정보로 External Port 결정 7 http://www.netmanias.com/ko/?m=view&id=blog&no=5833
  • 8. Address and Port Mapping APDM (Address and Port-Dependent Mapping) • S-IP, S-Port, D-IP, D-Port 정보로 External Port 결정 8 http://www.netmanias.com/ko/?m=view&id=blog&no=5833
  • 10. Filtering Behavior EIF (Endpoint-Independent Filtering) • D-IP, D-Port 만 검사하여 ACCEPT 판단 • Inbound패킷과 Binding Entry의 D-IP, D-Port만 일치하면 허용 10 http://www.netmanias.com/ko/?m=view&id=blog&no=5839
  • 11. Filtering Behavior ADF (Address-Dependent Filtering) • D-IP, D-Port, S-IP 만 검사하여 ACCEPT 판단 11 http://www.netmanias.com/ko/?m=view&id=blog&no=5839
  • 12. Filtering Behavior APDF (Address and Port-Dependent Filtering) • D-IP, D-Port, S-IP, S-Port 전체 검사 후 ACCEPT 판단 12 http://www.netmanias.com/ko/?m=view&id=blog&no=5839
  • 14. NAT Types • by Behavior 14 http://www.netmanias.com/ko/?m=view&id=blog&no=6263
  • 15. NAT Types • RFC 3489 (2003년) → RFC 5389 (2008년) → RFC 5780 (2010년) • Mapping/Filtering Behavior 조합을 통해, 총 9가지 NAT 타입 가능 15 http://www.netmanias.com/ko/?m=view&id=blog&no=5847
  • 17. ITEF Standard for NAT Traversal ITEF Standard • STUN (Session Traversal Utilities for NAT) • 단말 스스로가 NAT의 존재 유무, NAT 타입식별, External IP/Port 정보를 찾아내도록 도와주는 프로토콜이다. • STUN 서버, STUN 클라이언트(단말)로 구성 • NAT 이슈를 단말이 능동적으로 해결 (NAT Type에 제한적) • TURN (Traversal Using Relay NAT) • 단말들은 공중망에 위치한 TURN 서버와 세션을 설정 • TRUN 서버가 단말간 통신을 중계 • Symmetric NAT(APDM+APDF) 환경에서 통신 가능한 유일한 방법 • ICE (Interactive Connectivity Establishment) • STUN/TURN을 사용할 때 P2P 방식을 통해 최적의 라우팅 제공 기법 • 세션 설정 과정에서 가능한 모든 S-IP를 동원하여 시그널링 시도 • 주소들의 우선순위는 직접 통신 가능한 주소가 우선 • Local Address(Device) > NAT Address(STUN) > Relay Address(TURN) 17
  • 18. NAT Traversal Technique Techniques • Relaying (TURN) • Connection Reversal • UDP Hole Punching 18
  • 19. Relaying (TURN) • 개념 • 사설 IP 주소를 가지는 두 단말 간에 직접 통신이 불가능하여, 공인 IP 주소를 가지는 외부 서버를 통해 P2P 데이터 패킷을 Relay하는 개념 • 최종 목적지(상대 단말) 정보는 Replay로 보내는 패킷의 Payload로 전 달 • 장점 • NAT Behavior(Mapping/Filtering)와 관계 없이 모두(9-Types) 지원 • 단점 • 모든 P2P 데이터 패킷이 Relay 서버를 경유 • Relay 서버의 부하 증가 • Relay 서버의 네트워크 대역폭 이슈 발생 • Relay 서버가 분산 배치되지 않은 환경에서는 P2P 통신의 지연 발생 19
  • 21. Connection Reversal • 개념 • P2P통신을 하려는 두 단말 중 하나는 공인 IP를 가지는 경우 적용 가 능 • Private단말→Public단말로의 연결은 문제 없음 (like Client→WebServer) • Public단말 →Private단말로의 연결은 NAT에 의해 차단됨 • 외부 Messaging 서버를 통해 Public단말이 Private단말로 하여금 자 신에게 연결을 하도록 유도(Reverse Connection Request in Payload) 하여 NAT에 “Binding/Filtering Table” 테이블 생성 • 장점 • P2P 데이터 패킷이 Messaging 서버를 통하지 않는다 • NAT Behavior(Mapping/Filtering)와 관계 없이 모두(9-Types) 지원 • 단점 • P2P 단말 중 하나는 반드시 공인 IP 주소 필요 21
  • 24. UDP Hole Punching • 개념 • 공중망의 Messaging서버를 통해 P2P 단말간 연결 지원 • 특징 • EIM-NAT타입만 지원 • Filtering Behavior은 모두 지원 • EIF과 EDF에 따라 미세한 차이 • 가장 효율적인 NAT Traversal 기법 24 EIF EDF (ADF/APDF) 1. 모든 단말은 Payload를 이용해 자신의 Private/Public 정보를 Messaging 서버에 전송/등록 2. Messaging 서버는 모든 단말의 Private/Public 정보를 보관 3. 각 단말들은 P2P통신을 위해 Messaging 에서 상대방 단말 정보 조회 4. Messaging서버는 Payload를 통해 각 단말에게 통신하고자 하는 상대방의 정보를 리턴 (조회 요청 단말과 조회 당한 단말 모두에게 동시 응답) 5. 각 단말은 리턴 된 Payload의 정보를 이용해 상대 단말로 상호 P2P 연결 시도 6. 연결 성공 6. 먼저 연결 시도된 단말은 1회 실패 7. 늦게 시도된 단말은 정상 연결 8. 1회 실패한 단말은 2회부터 정상 연결
  • 25. UDP Hole Punching – EIM & EIF 25 http://www.netmanias.com/ko/?m=view&id=blog&no=6263
  • 26. UDP Hole Punching – EIM & EIF 26 http://www.netmanias.com/ko/?m=view&id=blog&no=6263
  • 27. UDP Hole Punching – EIM & EIF 27 http://www.netmanias.com/ko/?m=view&id=blog&no=6263
  • 28. UDP Hole Punching - EIM & EDF 28 http://www.netmanias.com/ko/?m=view&id=blog&no=6263
  • 29. UDP Hole Punching - EIM & EDF 29 http://www.netmanias.com/ko/?m=view&id=blog&no=6263
  • 30. UDP Hole Punching - EIM & EDF 30http://www.netmanias.com/ko/?m=view&id=blog&no=6263
  • 31. UDP Hole Punching - EIM & EDF 31 http://www.netmanias.com/ko/?m=view&id=blog&no=6263
  • 32. UDP Hole Punching - Summary 32 http://www.netmanias.com/ko/?m=view&id=blog&no=6263
  • 35. Hairpinning Behavior External Source IP Address and Port • 변조된 패킷의 Source IP/Source Port가 External Address/Port 35 http://www.netmanias.com/ko/?m=view&id=blog&no=5839
  • 36. Hairpinning Behavior Internal Source IP Address and Port • 변조된 패킷의 Source IP/Source Port가 Internal Address/Port 36 http://www.netmanias.com/ko/?m=view&id=blog&no=5839
  • 37. Closing References • NAT (Network Address Translation) 소개 (RFC 3022/2663) • NAT 장비는 이렇게 만들어야 하는데... (RFC 4787) - 1편: Mapping Behavior • NAT 장비는 이렇게 만들어야 하는데... (RFC 4787) - 2편: Filtering Behavior • NAT 장비는 이렇게 만들어야 하는데... (RFC 4787) - 3편: Deterministic Properties • P2P와 NAT: NAT 통과 기법 소개 (RFC 5128) - 1편: Relaying & Connection Reversal • P2P와 NAT: NAT 통과 기법 소개 (RFC 5128) - 2편: UDP Hole Punching • STUN(RFC 3489)과 STUN(RFC 5389/5780)의 차이 • STUN(RFC 3489)을 이용한 NAT Behavior Discovery NETMANIAS 후원 http://www.netmanias.com/ko/?m=view&id=sitenews&no=8335 37