리눅스 서버의 경우 랜카드가 교체될 경우(Mac주소가 변경시)

ethX의 번호가 다음 번호 변경되는데 특히 가상머신의 경우 OS이미지를 다른 가상머신에서 사용시 기존 가상머신의

MAC주소와 달라 eth0이던게 eth1로 변경됨.. 물론 ifcfg-eth0을 eth1로 변경해도 됨..

 

이 경우는 아래와 같이 기존의 네트워크 카드가 /etc/udev/rules.d/70-persistent-net.rules 에 정의 되어 있어 생기는 현상

아래의 경우는 실제 디바이스는 eth2 이지만 기존에 정의된 eth0과 eth1로 인해 eth2까지 밀린 상황

해결 방법은 파일을 수정(eth1, eth2 내용을 삭제 후 eth0의 mac주소값을 52:54:00:a6:f8:42에서 52:54:00:21:E9:C3 으로 변경 또는

삭제 후 재부팅을 한다. 물론 ifcfg-eth0 파일이 있어야 네트워크를 사용가능함..

 

[root@localhost /]# ifconfig -a
eth2      Link encap:Ethernet  HWaddr 52:54:00:21:E9:C3
          inet addr:192.168.10.108  Bcast:192.168.10.255  Mask:255.255.255.0
          inet6 addr: fe80::5054:ff:fe21:e9c3/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:11724 errors:0 dropped:0 overruns:0 frame:0
          TX packets:2465 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:1016787 (992.9 KiB)  TX bytes:437308 (427.0 KiB)

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)

 

[root@localhost /]# cat /etc/udev/rules.d/70-persistent-net.rules
# This file was automatically generated by the /lib/udev/write_net_rules
# program, run by the persistent-net-generator.rules rules file.
#
# You can modify it, as long as you keep each rule on a single
# line, and change only the value of the NAME= key.

 

# PCI device 0x8086:0x100e (e1000)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="52:54:00:a6:f8:42", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"

 

# PCI device 0x8086:0x100e (e1000)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="52:54:00:5b:a3:8c", ATTR{type}=="1", KERNEL=="eth*", NAME="eth1"

 

# PCI device 0x8086:0x100e (e1000)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="52:54:00:21:e9:c3", ATTR{type}=="1", KERNEL=="eth*", NAME="eth2" 

 

 

[root@localhost /]# rm /etc/udev/rules.d/70-persistent-net.rules
rm: remove regular file `/etc/udev/rules.d/70-persistent-net.rules'? y
[root@localhost /]# ls /etc/udev/rules.d/
60-fprint-autosuspend.rules  60-pcmcia.rules  60-raw.rules  70-persistent-cd.rules  90-alsa.rules  90-hal.rules  98-kexec.rules

 

[root@localhost /]# mv /etc/sysconfig/network-scripts/ifcfg-eth2 /etc/sysconfig/network-scripts/ifcfg-eth0

[root@localhost /]# vi /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth2    // eth0으로 변경
#HWADDR=52:54:00:A6:F8:42
TYPE=Ethernet
#UUID=803a97dd-c983-439e-8d0f-21f85f309062
ONBOOT=yes
NM_CONTROLLED=yes
BOOTPROTO=dhcp

 

[root@localhost /]# reboot

 

[root@localhost /]# ls /etc/udev/rules.d/
60-fprint-autosuspend.rules  60-pcmcia.rules  60-raw.rules  70-persistent-cd.rules  70-persistent-net.rules  90-alsa.rules  90-hal.rules  98-kexec.rules 

// 재부팅 후 70-persistent-net.rules 생성

 

[root@localhost /]# cat /etc/udev/rules.d/70-persistent-net.rules
# This file was automatically generated by the /lib/udev/write_net_rules
# program, run by the persistent-net-generator.rules rules file.
#
# You can modify it, as long as you keep each rule on a single
# line, and change only the value of the NAME= key.

# PCI device 0x8086:0x100e (e1000)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="52:54:00:21:e9:c3", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"

 

+ Recent posts