E D R S I H C RSS
ID
Password
Join
λ³‘μ›μΉ¨λŒ€λž€ μ •μ§€ν•΄ μžˆλŠ”λ°λ„ μš”κΈˆλ―Έν„°κΈ°κ°€ 마ꡬ λŒμ•„κ°€λŠ” νƒμ‹œμ™€ 같은 것. ―G.M.

ο»Ώ * 원문링크 : [http]http://www.alumni.caltech.edu/~dank/peer-nat.html
  • ν”νžˆ μ–˜κΈ°ν•˜λŠ” UDP λ¦΄λ ˆμ΄μ— κ΄€ν•œ κΈ€μž…λ‹ˆλ‹€. κ²½ν—˜μ μΈ μ–˜κΈΈ ν•΄μ£Όμ‹  λ ˆμ΄μ˜·λ‹˜κ»˜ κ°μ‚¬λ“œλ¦½λ‹ˆλ‹€. :)

Peer-to-peer is a style of networking in which a group of computers communicate directly with each other, rather than through a central server. This is often used for multiplayer online games, such as Activision's Battlezone, to avoid the expense and delay of handling all that traffic at the server. However, this style of networking often has problems dealing with Network Address Translators (NATs). In this page, I describe a way to solve these problems. Products that use this technique now work properly through several commercial NATs.

The situation #

The Internet is based on 32-bit IP (Internet Protocol) addresses, which means the theoretical maximum number of computers on the Internet is 4 billion or so. The practical limit is much lower, due to inefficiences in how IP addresses are used. In fact, the Internet may be only a few years away from running out of IP addresses. As IP addresses become scarce, a technique known as Network Address Translation, or NAT, was developed to allow the use of a single IP address for a whole network of computers.

A NAT sits inbetween the public Internet and the network it serves, and works by rewriting IP addresses and port numbers in IP headers on the fly so the packets all appear to be coming from (or going to) the single public IP address of the NAT device instead of the actual source or destination.

NAT is now commonly employed in small home-office routers and in software used by consumers to connect several personal computers to a single cable modem. It is even used by some Internet Service providers.

(NAT is not the only possible solution; proxy servers are also commonly used, but require more configuration, and sometimes require custom client software. Eventually, we'll all switch to IPv6, which will have 128-bit addresses, and will solve the problem once and for all, but that's probably not going to be commonplace for many years.)

Some Protocols Aren't NAT-Friendly #

Some applications send IP addresses or port numbers hidden inside their datapackets, where NAT can't properly rewrite them - so those applications don't work when you try to use them on computers behind NATs. Some NATs, for security reasons, only allow incoming traffic from an outside address if an outgoing packet has already been sent to that outside address. This means that two people behind different NATs can't open up connections to each other in the usual way - ever!

ν•΄κ²°μ±… #

Peer-to-peer protocols that wish to be NAT-friendly must be aware that any addresses they embed in their data packets may be invalid once the packets pass through the NAT, and compensate accordingly. 이것을 μ‹€ν–‰ν•˜κΈ° μœ„ν•œ 방법은 λ‹€μŒκ³Ό κ°™μŠ΅λ‹ˆλ‹€:

ν”Όμ–΄κ°„ λͺ¨λ“  νŠΈλž˜ν”½μ€ λ‹¨ν•˜λ‚˜μ˜ UDP 포트λ₯Ό ν†΅ν•˜μ—¬ μ‹€ν–‰λ©λ‹ˆλ‹€. μš°μ„  NAT뒀에 λ†“μ—¬μžˆμ§€ μ•Šμ€ μ£Όμ†Œ μ„œλ²„κ°€ μžˆμ–΄μ•Όν•©λ‹ˆλ‹€. μ‚¬μš©μžλ“€μ€ λ¨Όμ € μ£Όμ†Œ μ„œλ²„μ— μ—°κ²°ν•œλ‹€μŒ, μ‚¬μš©μž μžμ‹ λ“€μ΄ λ³΄μœ ν•˜κ³  μžˆλ‹€κ³  μƒκ°ν•˜λŠ” IP μ£Όμ†Œλ₯Ό μ „μ†‘ν•©λ‹ˆλ‹€; μ„œλ²„λŠ” UDP ν—€λ”μ•ˆμ— μžˆλŠ” μ£Όμ†Œμ™€ νŒ¨ν‚·μ•ˆμ— 적어놓은 μ£Όμ†Œ λͺ¨λ‘λ₯Ό κΈ°λ‘ν•΄λ‘‘λ‹ˆλ‹€. κ·Έλ‹€μŒ μ„œλ²„λŠ” λ‹€λ₯Έ ν”Όμ–΄λ“€μ—κ²Œ 이 2개의 μ£Όμ†Œμ •λ³΄λ“€μ„ μ „μ†‘ν•©λ‹ˆλ‹€. 이 μ‹œμ μ—μ„œ, λͺ¨λ“  μ‚¬λžŒμ€ 각자의 μ£Όμ†Œλ“€μ„ μ•Œκ³  μžˆκ²Œλ©λ‹ˆλ‹€.

P2P 연결을 μ—΄κΈ° μœ„ν•΄μ„œ, λͺ¨λ“  κΈ°μ‘΄ 피어듀은 μ‹ κ·œ ν”Όμ–΄μ—κ²Œ UDP νŒ¨ν‚·μ„ μ „μ†‘ν•˜λ©°, μ‹ κ·œ ν”Όμ–΄λŠ” κΈ°μ‘΄ ν”Όμ–΄λ“€ κ°κ°μ—κ²Œ UDP νŒ¨ν‚·μ„ λ³΄λƒ…λ‹ˆλ‹€. λ§¨μ²˜μŒμ— λ™μΌν•œ NAT뒀에 λ†“μ—¬μžˆλŠ”μ§€ μ—¬λΆ€λ₯Ό μ•„λŠ” μ‚¬λžŒμ€ μ—†κΈ° λ•Œλ¬Έμ—, 맨 처음 νŒ¨ν‚·μ€ μ–Έμ œλ‚˜ public, private μ£Όμ†Œ μ–‘μͺ½ λͺ¨λ‘λ₯Ό μ „μ†‘ν•΄μ•Όλ§Œ ν•©λ‹ˆλ‹€.

μ΄λ ‡κ²Œ ν•˜λ©΄ λͺ¨λ“  μ‚¬μš©μžλ“€μ˜ NATλŠ” μ‚¬μš©ν•  UDP νŠΈλž˜ν”½μ˜ μ–‘λ°©ν–₯ ꡬ멍을 μ—΄κ²Œ λ©λ‹ˆλ‹€. 처음 각각의 ν”Όμ–΄λ“€λ‘œλΆ€ν„° 응닡이 ν•œλ²ˆ λ„μ°©ν•˜κ²Œ 되면, μ „μ†‘μžλŠ” μ‚¬μš©ν•  μ£Όμ†Œκ°€ μ–΄λ–€ 것인지λ₯Ό μ•Œκ²Œ 되고, μ΄μ€‘μœΌλ‘œ μ£Όμ†Œλ₯Ό μ „μ†‘ν•˜λŠ” 것을 멈좜 수 μžˆμŠ΅λ‹ˆλ‹€.

이 방법이 ν˜Έν™˜λ˜λŠ”λ° ν•„μš”ν•œ 사항 #

κΈ°μ‘΄ NAT RFCλ¬Έμ„œμ— λ”°λ₯΄λ©΄, μ΄λŸ¬ν•œ κ°œλ…μ΄ μ‚¬μš©κ°€λŠ₯ν•˜κΈ°λ₯Ό μ›ν•˜λŠ” NAT μž₯μΉ˜λŠ” λ‹€μŒκ³Ό 같은 νŠΉμ§•μ„ κ°€μ§€κ³  μžˆμ–΄μ•Όλ§Œ ν•©λ‹ˆλ‹€:

NATλŠ” νŒ¨ν‚· 전솑에 μ‚¬μš©λ  UDP 포트의 개수λ₯Ό λ³€κ²½ν•˜μ§€ μ•Šμ•„μ•Ό ν•©λ‹ˆλ‹€.

관련사항:

NAT뒀에 μžˆλŠ” ν˜ΈμŠ€νŠΈκ°€ ν•˜λ‚˜μ˜ UDP ν¬νŠΈλ‘œλΆ€ν„° νŒ¨ν‚·λ“€μ„ μ „μ†‘ν•œλ‹€λ©΄, NAT에 μ˜ν•΄ λ¦΄λ ˆμ΄λ˜λŠ” νŒ¨ν‚·λ“€ λ˜ν•œ ν•˜λ‚˜μ˜ ν˜ΈμŠ€νŠΈμ™€ UDP ν¬νŠΈλ‘œλΆ€ν„° μ „μ†‘λœ κ²ƒμ²˜λŸΌ 보일 수 μžˆμŠ΅λ‹ˆλ‹€.

Valid XHTML 1.0! Valid CSS! powered by MoniWiki
last modified 2010-10-28 12:42:52
Processing time 0.4325 sec