CentOS 6.2의 정적 IPv4 및 IPv6 구성

CentOS 6.2의 정적 IPv4 및 IPv6 구성

CentOS 6.2에서 정적 IPv4 및 IPv6 구성을 구성하려고 합니다.

다음 구성은 완벽하게 작동합니다.

# ifconfig eth0 x.x.x.x/29
# route add defalt gw x.x.x.y

# ip addr add dev eth0 XXXX:C810:3001:D00::3/56
# ip -6 route add default XXXX:C810:3001:D00::1

그러나 재부팅 후에도 이 구성을 유지하고 싶습니다.

그래서 다음과 같은 구성을 했습니다.

IPv6 활성화

[root@test network-scripts]# cat /etc/sysconfig/network
NETWORKING=yes
HOSTNAME=test.net
NETWORKING_IPV6=yes

인터페이스 구성

[root@test network-scripts]# cat /etc/sysconfig/network-scripts/ifcfg-eth0 
DEVICE="eth0"
BOOTPROTO="static"
ONBOOT="yes"
HWADDR="2C:C3:AC:A8:C3:3E"
IPADDR=x.x.x.x
GATEWAY=x.x.x.x
NETMASK=255.255.255.248
TYPE=Ethernet
IPV6INIT=yes
IPV6ADDR=XXXX:C810:3001:D00::3/56
IPV6_DEFAULTGW=XXXX:C810:3001:D00::1

DNS1=208.67.222.222
DNS2=208.67.220.220
# Only DNS{1,2} according to /usr/share/doc/initscripts-9.03.27/sysconfig.txt
# DNS3=2620:0:ccc::2
# DNS4=2620:0:ccD::2

네트워크를 다시 시작하세요

[root@test network-scripts]# service network restart
Arrêt de l'interface eth0 :  État du périphérique : 3 (déconnecté)
                                                           [  OK  ]
Arrêt de l'interface loopback :                            [  OK  ]
Activation de l'interface loopback :                       [  OK  ]
Activation de l'interface eth0 :  État de connexion active : activation
État de chemin actif : /org/freedesktop/NetworkManager/ActiveConnection/3
état : activé
Connexion activée
                                                           [  OK  ]

[root@test 네트워크 스크립트]# cat /var/log/message

Mar 13 14:32:13 test NetworkManager[8299]: <info> (eth0): device state change: 8 -> 3 (reason 39)
Mar 13 14:32:13 test NetworkManager[8299]: <info> (eth0): deactivating device (reason: 39).
Mar 13 14:32:13 test avahi-daemon[8311]: Withdrawing address record for x.x.x.x on eth0.
Mar 13 14:32:13 test avahi-daemon[8311]: Leaving mDNS multicast group on interface eth0.IPv4 with address x.x.x.x.
Mar 13 14:32:13 test avahi-daemon[8311]: Interface eth0.IPv4 no longer relevant for mDNS.
Mar 13 14:32:14 test kernel: lo: Disabled Privacy Extensions
Mar 13 14:32:14 test NetworkManager[8299]: <info> Activation (eth0) starting connection 'System eth0'
Mar 13 14:32:14 test NetworkManager[8299]: <info> (eth0): device state change: 3 -> 4 (reason 0)
Mar 13 14:32:14 test NetworkManager[8299]: <info> Activation (eth0) Stage 1 of 5 (Device Prepare) scheduled...
Mar 13 14:32:14 test NetworkManager[8299]: <info> Activation (eth0) Stage 1 of 5 (Device Prepare) started...
Mar 13 14:32:14 test NetworkManager[8299]: <info> Activation (eth0) Stage 2 of 5 (Device Configure) scheduled...
Mar 13 14:32:14 test NetworkManager[8299]: <info> Activation (eth0) Stage 1 of 5 (Device Prepare) complete.
Mar 13 14:32:14 test NetworkManager[8299]: <info> Activation (eth0) Stage 2 of 5 (Device Configure) starting...
Mar 13 14:32:14 test NetworkManager[8299]: <info> (eth0): device state change: 4 -> 5 (reason 0)
Mar 13 14:32:14 test NetworkManager[8299]: <info> Activation (eth0) Stage 2 of 5 (Device Configure) successful.
Mar 13 14:32:14 test NetworkManager[8299]: <info> Activation (eth0) Stage 3 of 5 (IP Configure Start) scheduled.
Mar 13 14:32:14 test NetworkManager[8299]: <info> Activation (eth0) Stage 2 of 5 (Device Configure) complete.
Mar 13 14:32:14 test NetworkManager[8299]: <info> Activation (eth0) Stage 3 of 5 (IP Configure Start) started...
Mar 13 14:32:14 test NetworkManager[8299]: <info> (eth0): device state change: 5 -> 7 (reason 0)
Mar 13 14:32:14 test NetworkManager[8299]: <info> Activation (eth0) Stage 4 of 5 (IP4 Configure Get) scheduled...
Mar 13 14:32:14 test NetworkManager[8299]: <info> Activation (eth0) Beginning IP6 addrconf.
Mar 13 14:32:14 test avahi-daemon[8311]: Withdrawing address record for fe80::1ec1:deff:feb8:a2fd on eth0.
Mar 13 14:32:14 test NetworkManager[8299]: <info> Activation (eth0) Stage 3 of 5 (IP Configure Start) complete.
Mar 13 14:32:14 test NetworkManager[8299]: <info> Activation (eth0) Stage 4 of 5 (IP4 Configure Get) started...
Mar 13 14:32:14 test NetworkManager[8299]: <info> Activation (eth0) Stage 4 of 5 (IP4 Configure Get) complete.
Mar 13 14:32:15 test avahi-daemon[8311]: Registering new address record for fe80::1ec1:deff:feb8:a2fd on eth0.*.
Mar 13 14:32:35 test NetworkManager[8299]: <info> (eth0): IP6 addrconf timed out or failed.
Mar 13 14:32:35 test NetworkManager[8299]: <info> Activation (eth0) Stage 4 of 5 (IP6 Configure Timeout) scheduled...
Mar 13 14:32:35 test NetworkManager[8299]: <info> Activation (eth0) Stage 4 of 5 (IP6 Configure Timeout) started...
Mar 13 14:32:35 test NetworkManager[8299]: <info> Activation (eth0) Stage 5 of 5 (IP Configure Commit) scheduled...
Mar 13 14:32:35 test NetworkManager[8299]: <info> Activation (eth0) Stage 4 of 5 (IP6 Configure Timeout) complete.
Mar 13 14:32:35 test NetworkManager[8299]: <info> Activation (eth0) Stage 5 of 5 (IP Configure Commit) started...
Mar 13 14:32:35 test avahi-daemon[8311]: Joining mDNS multicast group on interface eth0.IPv4 with address x.x.x.x.
Mar 13 14:32:35 test avahi-daemon[8311]: New relevant interface eth0.IPv4 for mDNS.
Mar 13 14:32:35 test avahi-daemon[8311]: Registering new address record for x.x.x.x on eth0.IPv4.
Mar 13 14:32:36 test NetworkManager[8299]: <info> (eth0): device state change: 7 -> 8 (reason 0)
Mar 13 14:32:36 test NetworkManager[8299]: <info> Policy set 'System eth0' (eth0) as default for IPv4 routing and DNS.
Mar 13 14:32:36 test NetworkManager[8299]: <info> Activation (eth0) successful, device activated.
Mar 13 14:32:36 test NetworkManager[8299]: <info> Activation (eth0) Stage 5 of 5 (IP Configure Commit) complete.

IPv6 구성이 작동하지 않습니다...

[root@test network-scripts]# ip addr show
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue state UNKNOWN 
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
    link/ether 1c:c1:de:b8:a3:fd brd ff:ff:ff:ff:ff:ff
    inet x.x.x.x/29 brd x.x.x.x scope global eth0
    inet6 fe80::1ec1:deff:feb8:a3fd/64 scope link 
       valid_lft forever preferred_lft forever

확인자의 IPv6 주소는 resolv.conf에도 없습니다!

구성 단계를 놓쳤습니까?

IPv6 설정은 그냥 형식적인거라고 생각했는데..

[root@test network-scripts]# lsb_release -a
LSB Version:    :core-4.0-amd64:core-4.0-noarch:graphics-4.0-amd64:graphics-4.0-noarch:printing-4.0-amd64:printing-4.0-noarch
Distributor ID:    CentOS
Description:    CentOS release 6.2 (Final)
Release:    6.2
Codename:    Final

답변1

Network Manager가 정적 구성 설정을 덮어쓰려고 합니다. 루트 또는 sudo 사용자로 실행:

service NetworkManager stop

서비스가 없으면 다음을 시도해 보세요.

/etc/init.d/NetworkManager stop

또는 NetworkManager가 관리하지 않도록 정적 인터페이스를 설정할 수 있습니다. 이것이 제가 CentOS 구성에서 수행한 작업입니다. 다음 줄을 추가하면 됩니다.

NM_CONTROLLED=no

정적 구성 파일에. 정적 구성 파일에는 해당 줄이 없습니다. 이는 NetworkManager가 이러한 인터페이스를 무시하는 대신 제어하려고 시도한다는 것을 의미합니다.

바라보다참고로 여기NM 비활성화 및/또는 제거 정보.

답변2

이 네트워크 관리자가 정적 네트워크 구성 파일과 충돌합니까? 서버에서 CentOS를 실행하는 경우 Network Manager를 비활성화하면 NM은 바보 같고 "즉시" 네트워크 설정을 변경할 필요가 없습니다.

관련 정보