최상단

컨텐츠

IPv6

글 정보

Category
컴퓨터 이야기
2008. 1. 7. 13:43

본문

IPv6를 사용하기 위한 환경 구성

  • 환경 확인
    • [root@si-mrpa1-2p:/etc/sysconfig ] lsmod | grep ipv6
      ipv6                  248160  16  
      위 명령어로 ipv6 모듈이 동작중인지 확인한다. 만약 결과값이 없다면
      modprobe ipv6
      명령을 통해 ipv6 모듈을 동작시킨다.
      ipv6 모듈이 없다고 나올 경우 커널 컴파일을 다시 해야한다.
      IPv6 사용을 위한 커널 컴파일은 이 문서에서 다루지 않는다. 

config 파일을 수정하여 IPv6를 할당하는 방법

  • /etc/sysconfig/network 파일 수정
    • NETWORKING=yes
      HOSTNAME=si-mrpa1-2p
      GATEWAY=172.168.2.33
      // 이상 기존에 설정되어 있는 부분
      // IPv6를 위해 추가되는 부분
      NETWORKING_IPV6=yes
      IPV6_AUTOCONF=no
      IPV6_AUTOTUNNEL=no
      IPV6_TUNNELMODE=IP
  • /etc/sysconfig/network-script/ifcfg-eth* 파일 수정
    • DEVICE=eth1
      ONBOOT=yes
      TYPE=Ethernet
      BOOTPROTO=static
      IPADDR=192.168.22.134
      NETMASK=255.255.255.0
      NETWORK=192.168.22.0
      // 기존에 설정되어 있는 부분
      // IPv6를 위해 추가되는 부분
      IPV6INIT=yes
      IPV6ADDR=2001:2c0:418:1::1
                    // 호스트마다 개별 IP 할당
  • 하나의 인터페이스에 여러 IP를 할당하는 방법
    • /etc/sysconfig/network-script/ifcfg-eth* 파일 수정
    • IPV6ADDR_SECONDARIES="2001:2c0:418:1::2 2001:2c0:418:1::3"
      같은 방식으로 복수의 IP를 추가 가능
  • 설정파일 변경 후
    • /etc/init.d/network restart 혹은
    • ifdown eth0;ifup eth1

수동으로 IPv6할당하는 방법

  • ifconfig eth1 inet6 add 2001:2c0:418:1::1/64
  • ifconfig eth1 inet6 add 2001:2c0:418:1::5/64  

IPv6 설정이 올바르게 되었는지 확인하는 방법

  • ping으로 확인 방법
    • ping sender(2001:2c0:418:1::5)
      • ping6 2001:2c0:418:1::1
        =================== Result ===================
        [si@si-mrpa1-1p:~ ] ping6 2001:2c0:418:1::1
        PING 2001:2c0:418:1::1(2001:2c0:418:1::1) 56 data bytes
        64 bytes from 2001:2c0:418:1::1: icmp_seq=0 ttl=64 time=0.677 ms
        64 bytes from 2001:2c0:418:1::1: icmp_seq=1 ttl=64 time=0.216 ms
        64 bytes from 2001:2c0:418:1::1: icmp_seq=2 ttl=64 time=0.287 ms
        64 bytes from 2001:2c0:418:1::1: icmp_seq=3 ttl=64 time=0.236 ms
        --- 2001:2c0:418:1::1 ping statistics ---
        4 packets transmitted, 4 received, 0% packet loss, time 3000ms
        rtt min/avg/max/mdev = 0.216/0.354/0.677/0.188 ms, pipe 2
        [si@si-mrpa1-1p:~ ] 
    • ping receiver(2001:2c0:418:1::1)
      • tcpdump -vv ip6 
        [root@si-mrpa1-2p:/etc/sysconfig ] tcpdump -i eth1 -vv ip6
        tcpdump: listening on eth1, link-type EN10MB (Ethernet), capture size 96 bytes
        16:59:16.575240 2001:2c0:418:1::5 > ff02::1:ff00:1: [icmp6 sum ok] icmp6: neighbor sol: who has 2001:2c0:418:1::1(src lladdr: 00:30:64:04:b9:69) (len 32, hlim 255)
        16:59:16.584641 2001:2c0:418:1::1 > 2001:2c0:418:1::5: [icmp6 sum ok] icmp6: neighbor adv: tgt is 2001:2c0:418:1::1(SO)(tgt lladdr: 00:30:64:04:b7:e1) (len 32, hlim 255)
        16:59:16.575428 2001:2c0:418:1::5 > 2001:2c0:418:1::1: icmp6: echo request seq 0 (len 64, hlim 64)
        16:59:16.575446 2001:2c0:418:1::1 > 2001:2c0:418:1::5: icmp6: echo reply seq 0 (len 64, hlim 64)
        16:59:17.574946 2001:2c0:418:1::5 > 2001:2c0:418:1::1: icmp6: echo request seq 1 (len 64, hlim 64)
        16:59:17.574969 2001:2c0:418:1::1 > 2001:2c0:418:1::5: icmp6: echo reply seq 1 (len 64, hlim 64)
        16:59:18.574838 2001:2c0:418:1::5 > 2001:2c0:418:1::1: icmp6: echo request seq 2 (len 64, hlim 64)
        16:59:18.574855 2001:2c0:418:1::1 > 2001:2c0:418:1::5: icmp6: echo reply seq 2 (len 64, hlim 64)
        16:59:19.575606 2001:2c0:418:1::5 > 2001:2c0:418:1::1: icmp6: echo request seq 3 (len 64, hlim 64)
        16:59:19.575623 2001:2c0:418:1::1 > 2001:2c0:418:1::5: icmp6: echo reply seq 3 (len 64, hlim 64)
        10 packets captured
        10 packets received by filter
        0 packets dropped by kernel
        [root@si-mrpa1-2p:/etc/sysconfig ]

Default gateway 설정

  • Default Gateway
    • /etc/sysconfig/network file
      • IPV6_DEFAULTGW=IPv6 address[%interface]  추가
  • Default route configuration
    • /etc/sysconfig/static-routes-ipv6
      • eth0   2001::/3    3ffe:ffff:1234:0002::1  추가
  • route 명령어로 추가하기
    • route -A inet6 add 2000::/3 gw 3ffe:ffff:0:f101::1

기타 IPv6에 관련된 명령어들

  • route
    • route는 호스트으 routing 방법을 결정지을 수 있게 도와주는 툴이다. 그러나 이 툴은 기본적으로 ipv4를 기반으로 동작하고 있다. IPv6에 관련된 라우팅테이블을 보고 싶다면
      inet6옵션을 주어 볼 수 있다.
      • [root@si-mrpa1-2p:/etc/sysconfig ] route -A inet6
        Kernel IPv6 routing table
        Destination                                 Next Hop                                Flags Metric Ref    Use Iface
        ::1/128                                     *                                       U     0      7        2 lo    
        2001:2c0:418:1::1/128                       *                                       U     0      114       2 lo    
        2001:2c0:418:1::/64                         *                                       U     256    0        0 eth1  
        fe80::230:64ff:fe04:b7e0/128                *                                       U     0      0        2 lo    
        fe80::230:64ff:fe04:b7e1/128                *                                       U     0      3        2 lo    
        fe80::230:64ff:fe04:b7e4/128                *                                       U     0      0        2 lo    
        fe80::230:64ff:fe04:b7e5/128                *                                       U     0      0        2 lo    
        fe80::/64                                   *                                       U     256    0        0 eth0  
        fe80::/64                                   *                                       U     256    0        0 eth1  
        fe80::/64                                   *                                       U     256    0        0 eth4  
        fe80::/64                                   *                                       U     256    0        0 eth5  
        ff00::/8                                    *                                       U     256    0        0 eth0  
        ff00::/8                                    *                                       U     256    0        0 eth1  
        ff00::/8                                    *                                       U     256    0        0 eth4  
        ff00::/8                                    *                                       U     256    0        0 eth5  
        [root@si-mrpa1-2p:/etc/sysconfig ]
  • /etc/hosts 파일 설정
    • IPv4와 똑같은 방식으로 사용할 수 있다. 
      • /etc/hosts 파일의 가장 끝 부분에
        2001:2c0:418:1::1          ipv6testhost
        를 추가한다.
      • [root@si-mrpa1-1p si]# ping6 ipv6testhost
        PING ipv6testhost(ipv6testhost) 56 data bytes
        64 bytes from ipv6testhost: icmp_seq=0 ttl=64 time=1.92 ms

IPv6 Address Space

  • IPv6 Prefix           Allocation              Reference      Note
    -----------           ----------              ---------      ----
    0000::/8              Reserved by IETF        [RFC4291]      [1] [5]
    0100::/8              Reserved by IETF        [RFC4291]
    0200::/7              Reserved by IETF        [RFC4048]      [2]
    0400::/6              Reserved by IETF        [RFC4291]
    0800::/5              Reserved by IETF        [RFC4291]
    1000::/4              Reserved by IETF        [RFC4291]
    2000::/3              Global Unicast          [RFC4291]      [3]
    4000::/3              Reserved by IETF        [RFC4291]
    6000::/3              Reserved by IETF        [RFC4291]
    8000::/3              Reserved by IETF        [RFC4291]
    A000::/3              Reserved by IETF        [RFC4291]
    C000::/3              Reserved by IETF        [RFC4291]
    E000::/4              Reserved by IETF        [RFC4291]
    F000::/5              Reserved by IETF        [RFC4291]
    F800::/6              Reserved by IETF        [RFC4291]
    FC00::/7              Unique Local Unicast    [RFC4193]
    FE00::/9              Reserved by IETF        [RFC4291]
    FE80::/10             Link Local Unicast      [RFC4291]
    FEC0::/10             Reserved by IETF        [RFC3879]      [4]

    FF00::/8              Multicast               [RFC4291]
  • Notes:
    [0]  The IPv6 address management function was formally delegated to IANA in December 1995 [RFC1881].
    [1]  The "unspecified address", the "loopback address", and the IPv6 Addresses with Embedded IPv4 Addresses are assigned out of the 0000::/8 address block.
    [2]  0200::/7 was previously defined as an OSI NSAP-mapped prefix set [RFC4548]. This definition has been deprecated as of December 2004 [RFC4048].
    [3]  The IPv6 Unicast space encompasses the entire IPv6 address range with the exception of FF00::/8. [RFC4291] IANA unicast address assignments are currently limited to the IPv6 unicast address range of 2000::/3. IANA assignments from this block are registered in the IANA registry: iana-ipv6-unicast-address-assignments.
    [4]  FEC0::/10 was previously defined as a Site-Local scoped address prefix. This definition has been deprecated as of September 2004 [RFC3879].
    [5]  0000::/96 was previously defined as the "IPv4-compatible IPv6 address" prefix.  This definition has been deprecated by [RFC4291].
  • RFC4291 : http://www.ietf.org/rfc/rfc4291.txt
  • 참고 : http://www.iana.org/assignments/ipv6-address-space

IPv4와 IPv6와의 설정상의 차이점

  • 하나의 인터페이스에 여러 IP를 할당하는 방법 차이
    • IPv4
      • eth0:1, eth0:2 와 같은 가상인터페이스를 만들어 여러개의 IP를 할당하였음
      • eth0:2  Link encap:Ethernet  HWaddr 00:30:64:04:87:AC  
                 inet addr:192.168.20.132  Bcast:192.168.20.255  Mask:255.255.255.0
                 UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
                 Base address:0x8000 Memory:df000000-df020000
    • IPv6
      • 가상 인터페이스 없이 add 명령으로 여러개의 IP를 할당 가능
      • eth4    Link encap:Ethernet  HWaddr 00:30:64:04:87:B0  
                 inet addr:192.168.11.132  Bcast:192.168.11.255  Mask:255.255.255.0
                  inet6 addr: fe80::230:64ff:fe04:87b0/64 Scope:Link
                 
        inet6 addr: fec0::c0a8:b84/64 Scope:Site
                  inet6 addr: fec0::ac10:584/64 Scope:Site
                  UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
                  RX packets:75332133 errors:0 dropped:0 overruns:0 frame:0
                  TX packets:4215200 errors:0 dropped:0 overruns:0 carrier:0
                  collisions:0 txqueuelen:1000
                  RX bytes:789617192 (753.0 MiB)  TX bytes:914611326 (872.2 MiB)
                  Base address:0x9000 Memory:df100000-df120000

트랙백과 댓글 여닫기

TOP