Internet Protocol
(IPv4, IPv6는 모두 현재 페이지로 Redirect된다.)
(Linux 명령어에 대한 내용은 ip_command (또는 ip (linux command), iproute2)을 참조.)
인터넷 프로토콜(IP, Internet Protocol, 문화어: 호상망규약)은 송신 호스트와 수신 호스트가 패킷 교환 네트워크(패킷 스위칭 네트워크, Packet Switching Network)에서 정보를 주고받는 데 사용하는 정보 위주의 규약(프로토콜, Protocol)이며, OSI 네트워크 계층에서 호스트의 주소지정과 패킷 분할 및 조립 기능을 담당한다. 줄여서 아이피(IP)라고도 한다.
IP의 정보는 패킷 혹은 데이터그램이라고 하는 덩어리로 나뉘어 전송된다. IP에서는 이전에 통신한 적 없는 호스트에 패킷을 보낼 때 경로 설정이 필요없다.
IP는 비신뢰성(unreliability)과 비연결성(connectionlessness)이 특징이다. 비신뢰성은 흐름에 관여하지 않기 때문에 보낸 정보가 제대로 갔는지 보장하지 않는다는 뜻이다. 예를 들어 전송과정에서 패킷이 손상될 수도 있고, 같은 호스트에서 전송한 패킷의 순서가 뒤죽박죽이 될 수도 있고, 같은 패킷이 두 번 전송될 수도 있으며, 아예 패킷이 사라질 수도 있다. 패킷 전송과 정확한 순서를 보장하려면 TCP 프로토콜과 같은 IP의 상위 프로토콜을 이용해야 한다.
현재 인터넷에서 사용하는 표준 프로토콜은 인터넷 프로토콜의 4번째 판인 IPv4이다. 그러나 IPv4는 주소공간 고갈 문제를 겪고 있어 조만간 6번째 판인 IPv6가 대중화될 것으로 보인다. 마이크로소프트 윈도 XP, 맥 오에스 텐, 리눅스 등 현재 널리 쓰이고 있는 대부분의 운영 체제는 IPv6 프로토콜을 지원한다.
Categories
Routing schemes
자신의 글로벌 IP 확인
curl ifconfig.me
명령으로 자신의 글로벌 IP를 확인할 수 있다.
IP Address
간혹 혼동할수도 있는데 있는데 IP 번호는 hosts 에 부여되는 것이 아닌, Interfaces(랜카드 혹은 이더넷 카드로 불리워지는)에 부여 되는 것이다. 모든 랜카드는 랜카드 고유의 번호(Ethernet Address) 를 가지고 있으며, 이 이더넷 번호에 IP 번호를 매핑시키는 방식으로 각각의 이더넷에 IP 번호를 부여하게 된다.
Special-use addresses
The Internet Engineering Task Force (IETF) and the Internet Assigned Numbers Authority (IANA) have restricted from general use various reserved IP addresses for special purposes. Some are used for maintenance of routing tables, for multicast traffic, operation under failure modes, or to provide addressing space for public, unrestricted uses on private networks.
Address block | Address range | Number of addresses | Scope | Description |
0.0.0.0/8 | 0.0.0.0–0.255.255.255 | 16777216 | Software | Current network (only valid as source address). |
10.0.0.0/8 | 10.0.0.0–10.255.255.255 | 16777216 | Private network | Used for local communications within a private network. |
100.64.0.0/10 | 100.64.0.0–100.127.255.255 | 4194304 | Private network | Shared address space for communications between a service provider and its subscribers when using a carrier-grade NAT. |
127.0.0.0/8 | 127.0.0.0–127.255.255.255 | 16777216 | Host | Used for loopback addresses to the local host. |
169.254.0.0/16 | 169.254.0.0–169.254.255.255 | 65536 | Subnet | Used for link-local addresses between two hosts on a single link when no IP address is otherwise specified, such as would have normally been retrieved from a DHCP server. |
172.16.0.0/12 | 172.16.0.0–172.31.255.255 | 1048576 | Private network | Used for local communications within a private network. |
192.0.0.0/24 | 192.0.0.0–192.0.0.255 | 256 | Private network | IETF Protocol Assignments. |
192.0.2.0/24 | 192.0.2.0–192.0.2.255 | 256 | Documentation | Assigned as TEST-NET-1, documentation and examples. |
192.88.99.0/24 | 192.88.99.0–192.88.99.255 | 256 | Internet | Reserved. Formerly used for IPv6 to IPv4 relay (included IPv6 address block 2002::/16). |
192.168.0.0/16 | 192.168.0.0–192.168.255.255 | 65536 | Private network | Used for local communications within a private network. |
198.18.0.0/15 | 198.18.0.0–198.19.255.255 | 131072 | Private network | Used for benchmark testing of inter-network communications between two separate subnets. |
198.51.100.0/24 | 198.51.100.0–198.51.100.255 | 256 | Documentation | Assigned as TEST-NET-2, documentation and examples. |
203.0.113.0/24 | 203.0.113.0–203.0.113.255 | 256 | Documentation | Assigned as TEST-NET-3, documentation and examples. |
224.0.0.0/4 | 224.0.0.0–239.255.255.255 | 268435456 | Internet | In use for IP multicast. (Former Class D network). |
240.0.0.0/4 | 240.0.0.0–255.255.255.254 | 268435456 | Internet | Reserved for future use. (Former Class E network). |
255.255.255.255/32 | 255.255.255.255 | 1 | Subnet | Reserved for the "limited broadcast" destination address. |
Private networks
Of the approximately four billion addresses defined in IPv4, three ranges are reserved for use in private networks. Packets addresses in these ranges are not routable in the public Internet, because they are ignored by all public routers. Therefore, private hosts cannot directly communicate with public networks, but require network address translation at a routing gateway for this purpose.
Name | CIDR block | Address range | Number of addresses | Classful description |
24-bit block | 10.0.0.0/8 | 10.0.0.0 – 10.255.255.255 | 16777216 | Single Class A. |
20-bit block | 172.16.0.0/12 | 172.16.0.0 – 172.31.255.255 | 1048576 | Contiguous range of 16 Class B blocks. |
16-bit block | 192.168.0.0/16 | 192.168.0.0 – 192.168.255.255 | 65536 | Contiguous range of 256 Class C blocks. |
자세한 내용은 Private network 항목 참조.
비교
Name | IPv4 | IPv6 | Description |
Loopback Address | | | - |
Unspecified Address | | | 바인드 주소(Source Address)만 가능하다. 이렇게 하면, 어떤 인터페이스 주소로든 가능한 연결을 할 수 있다. |
IPv4
IPv4 구성 단위 (클래스)
IPv4 에서 루프백이 127.0.0.0/8 인 이유
- Why is there more than one loopback IP address?
- Why are there so many loopback addresses? - 역사적 이유가 설명됨.
127/8 (shorthand for 127.0.0.0/8) is reserved by IANA.
- Historical limitation: there is no MASK in the first implementation of tcpip, that means network nodes use the first number to distinguish network size and host ID. moreover, since class A is determined by its first octet, the higher-order bit is 0, so 127.x.x.x (01111111.x.x.x) is the latest segement of class A addresses. people often use all zero or all one numbers for special usages, reserving a class A segment is for maximum flexibility.
- Easy implementation: as what I say above, there was no MASK concept in early days, segment address 01111111.00000000.00000000.00000000 is easy to be determined by AND/XOR operations quickly and easily. Even nowadays, such pattern is still easy for matching subnets by applying XOR operation.
- Reserved for future use: class A has 16,777,216 hosts, so it allows people have more space to divide it into a lot of reasonable zones for specific usages, different devices, systems and applications.
IPv6
IPv4 사용자를 IPv6 자습서
Hello IPv6 : IPv4 사용자를 위한 최소한의 자습서
- IPv6가 단순히 더 많은 주소를 주는 것은 맞지만, 우리가 IPv4에서 배운 많은 것들이 IPv6에서는 변경되거나 사라짐
- 집 또는 작은 사무실에서 사용하는 사람들을 위한 가이드
- ARP, DHCP, NAT 등이 어떻게 IPv6에서 동작하는지
- IPv6는 다른 이더넷 프레임 타입을 가짐 : 0x0800 (v4) vs. 0x86DD (v6)
- IPv6 주소는 128-bit(16 bytyes) = 64-bit (network) prefix + 64-bit interface id
- IPv6는 ARP(Address Resolution Protocol)가 아닌 NDP(Neighbor Discovery Protocol)
- IPv6는 broadcast 주소 컨셉이 없음. 일부 multicast 주소들이 이 기능을 수행
- IPv6는 DHCPv4처럼 동적으로 설정 가능하지만, DHCPv6, RA, PD, SLAAC을 이용 해서, 더 자주, 상태를 유지하는 것 없이 설정이 가능.
- IPv6 에서는 NAT는 필요 없음. 만약 보안을 위해 필요하다면 랜덤/임시 IPv6주소를 사용 가능
IP 충돌시 확인 방법
자신의 주소에 대한 ARP 요청 또는 이웃 요청을 보낼 수 있습니다. 답장을 받으면 주소가 중복된 것입니다.
IPv6의 경우 자동으로 수행됩니다. ip addr
을 실행하고 주소 플래그를 살펴보십시오.
- 현재 확인 중인 주소에는
tentative
" 플래그가 있고 - 충돌하는 주소에는
dadfailed
가 있습니다.
ndisc6을 사용하여 수동 확인/질의를 수행하십시오. 예를 들어:
IPv4에는 자동 중복 확인이 필요하지 않았지만 일부 시스템에서는 그렇게 합니다. 예를 들어 Windows는 중복에 대해 즉시 알려줍니다.
많은 DHCP 서버는 임대를 발행하기 전에 ARP 검사도 수행하므로 DHCP를 사용했다면 걱정할 필요가 없습니다.
해당 IPv4 도구는 arping입니다:
서로 다른 대역의 IP끼리 통신하도록 설정하는 방법
예컨데 192.168.0.xxx
와 10.0.0.xxx
와 같은 ...
방법1. PC의 랜카드 2개 사용
How_to_set_up_communication_between_IPs_of_different_bands-1.png
이 경우는 소켓 생성시 Binding Address 를 0.0.0.0
으로 하지 않도록 주의한다.
방법2. 랜카드에 IP2개를 할당
How_to_set_up_communication_between_IPs_of_different_bands-2.png
하나의 인터페이스에 어러 개의 아이피를 할당한다:
또는 /etc/network/interfaces
의 설정 파일에 저장할 경우:
방법3. 공유기의 Routing Table 등록
How_to_set_up_communication_between_IPs_of_different_bands-3.png
스크린샷과 같은 경우 공유기 설정 페이지 들어가서 라우팅 테이블 추가:
- Target: 10.10.10.0
- Mask: 255.255.255.0
- Gateway: 192.168.0.1
See also
- Time to live (TTL)
- Classless Inter-Domain Routing (사이더; CIDR) 클래스 없는 도메인 간 라우팅 기법.
192.168.0.0/16
와 같이 표기한다. - Internet protocol suite
- TCP
- Port
- 네트워크 클래스 (Network class)
- Loopback
- Routing table
- Private network
- Classful network
- Subnetwork/SubnetMask
- Network address translation (NAT)
- DHCP
- Medium access control (MAC)
- ipcalc - IP 계산기. 호스트 범위, 넷마스크 등 계산해 준다.
Favorite site
- Wikipedia (en) IP에 대한 설명
- Special IP Addresses 2
- TCP/IP A, B, C 네트워크 클래스
- IP Header IP 헤더, IP 패킷 헤더, IPv4 헤더
- (Network is Fun!) 통신을 위한 주소(MAC Address/IP Address)