한국어

네트워킹

온누리070 플레이스토어 다운로드
    acrobits softphone
     온누리 070 카카오 프러스 친구추가온누리 070 카카오 프러스 친구추가친추
     카카오톡 채팅 상담 카카오톡 채팅 상담카톡
    
     라인상담
     라인으로 공유

     페북공유

   ◎위챗 : speedseoul


  
     PAYPAL
     
     PRICE
     

pixel.gif

    before pay call 0088 from app


기본적으로 리눅스의 이더넷 이름은 eth0, eth1 과 같이 eth 를 prefix로 사용했었습니다. 그런데 몇 해 전부터 리눅스 배포판들이 eth0 과 같은 전통적인 ethernet naming을 버리고 em1 이니, p2p1 이니 같은 해괴한(?) 이름을 쓰기 시작하더군요.

이더넷이 하나 뿐인 일반적인 PC 환경에서야 eth0 이든, em1 이든, p2p1 이든 네트워크를 쓸 수 있는 포트가 하나 밖에 없으니 신경 쓸 일이 없습니다.

하지만 서버 환경에서는 상당히 도움이 되었던 모양입니다. 라우터가 되었든지, 아니면 조금만 큰 서버 같은 경우에도 HA 용으로나 network bonding 등의 용도로 이더넷 포트가 몇 개씩 되니까요. 이런 상황이라면 어떤 포트가 eth0 인지, 어떤 포트가 eth1 인지 구분하기가 엄청 곤란해집니다.

심지어 더 옛날에는 커널이 PCI bus를 읽는 순서에 따라 eth0 이 다음번 부팅 때에는 eth1 이 되기도 하는 등 문제가 많았습니다. 그래서 udev 가 도입되자

/etc/udev/rules.d/70-persistent-net.rules

같은 파일을 이용해서 MAC 주소를 특정 이더넷 이름으로 강제로 매핑하는 방법이 많이 사용되었습니다.

그러다가 몇 해 전부터는 아예 이더넷 이름에 물리적인 순서를 박아 넣는 방식이 사용되기 시작합니다. 그게 바로 em1 이니 p2p1 같은 녀석들이죠. em1 은 온보드 이더넷 포트이고, p 로 시작하는 건 PCI NIC 입니다.

p 다음의 첫번째 숫자는 PCI 슬롯의 이름이고, 두번째 p의 다음번 숫자는 그 NIC가 여러 포트를 가지고 있을 때 첫번째 포트를 의미하죠.

이렇게 해 놓으니 편하긴 하지만...

예전에 eth 를 기준으로 하드코딩 했던 몇몇 application 들이 동작하지 않는 경우도 있습니다. 특히 제가 자주 썼던 iptraf 는 eth 만 인식합니다.

그 외에도 상황에 따라 이더넷 이름을 바꾸어야 하는 경우가 있는데. 이 때는 다음 방법을 쓰면 됩니다.

참조 :
http://unix.stackexchange.com/questions/141444/consistent-network-interface-name-ubuntu-using-pci-slot

여기에서 가져왔습니다.

요약하자면,
역시나 /etc/udev/rules.d/70-persistent-net.rules 를 이용하는 방법입니다.

 # vi /etc/udev/rules.d/70-persistent-net.rules
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="88:51:fb:64:40:14", ATTR{dev_id}=="0x0",
ATTR{type}=="1", KERNELS=="0000:00:19.0", NAME="eth0"

와 같이 한 줄로 죽 써 주면 됩니다.

address 는 MAC 주소이고,
KERNELS 는 lspci -D 애서 나오는 PCI 버스의 아이디입니다.

$ lspci -D
0000:00:00.0 Host bridge: Intel Corporation Xeon E3-1200 v2/3rd Gen Core processor DRAM Controller (rev 09)
....
0000:00:19.0 Ethernet controller: Intel Corporation 82579LM Gigabit Network Connection (rev 04)
....

0000:03:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller (rev 06)

그리고 NAME에 원하는 이름을 써 주면 됩니다. 리부팅하면 eth0, eth1 로 이름이 나옵니다.
이상입니다.

아참. 제가 테스트한 환경은 우분투 14.04 입니다. centos 에서도 아마 비슷하게 되지 싶습니다.
참고 부탁드립니다. 감사합니다.



리눅스 서버의 경우 랜카드가 교체될 경우(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"

 


레드햇 계열의 리눅스는 7버전으로 넘어 오면서 많은점이 바뀌었는데 네트워크 디바이스 이름이 틀림

기존 버전과 같이 ifcfg-eth0, eth1..... 과 같은 형태가 아닌 ifcfg-enpXX 형식인데 BIOS에서 디바이스를 보는 형식으로 바뀌었음

예를 들면 아래와 같이 enp0s25와 enp4s0의 디바이스가 있는 경우 enp0s25는 pci 0번 버스의 25번째 슬롯(00:19:0 - 16진수)이며

enp4s0은 pci 4번 버스에 0번 슬롯(04:00:0 - 16진수)을 나타내는 형식

 

[root@localhost ~]# ls /etc/sysconfig/network-scripts/ifcfg-* -alrt
-rw-r--r--. 1 root root 254 Sep 16 20:51 /etc/sysconfig/network-scripts/ifcfg-lo
-rw-r--r--. 1 root root  39 Jan  4 16:33 /etc/sysconfig/network-scripts/ifcfg-enp0s25
-rw-r--r--. 1 root root 288 Jan  4 23:00 /etc/sysconfig/network-scripts/ifcfg-enp4s0

[root@localhost ~]# lspci | grep -i ether
00:19.0 Ethernet controller: Intel Corporation Ethernet Connection I217-LM (rev 05)
04:00.0 Ethernet controller: Intel Corporation I210 Gigabit Network Connection (rev 03)

 

다만 기존의 eth0, eth1으로 변경 하기 원한다면 /etc/default/grub 파일을 열어 GRUB_CMDLINE_LINUX 항목에 net.ifnames=0 biosdevname=0 항목을 추가후 저장..

grub2-mkconfig -o /boot/grub2/grub.cfg 를 통해 grub를 업데이트 하여 아래와 같이 done이 나오면 완료

 

[root@localhost ~]# vi /etc/default/grub
GRUB_TIMEOUT=5
GRUB_DISTRIBUTOR="$(sed 's, release .*$,,g' /etc/system-release)"
GRUB_DEFAULT=saved
GRUB_DISABLE_SUBMENU=true
GRUB_TERMINAL_OUTPUT="console"
GRUB_CMDLINE_LINUX="rd.lvm.lv=centos/swap ...(생략)... net.ifnames=0 biosdevname=0"
GRUB_DISABLE_RECOVERY="true"

 

[root@localhost ~]# grub2-mkconfig -o /boot/grub2/grub.cfg
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-3.10.0-123.el7.x86_64

(생략)

Found initrd image: /boot/initramfs-0-rescue-2a41b98f9b9f48428ee53544d9cf87ef.img
done
[root@localhost ~]#

 

이후 재부팅을 완료하면 네이밍 형식은 바뀌지만 /etc/sysconfig/network-scripts/ 밑에는 기존의 enp형식으로 만 있으면 네트워크를 사용 할수 없어

eth형식의 파일이 필요 하기 때문에 아래와 같이 파일의 이름을 바꿔주고 실제 그 파일 내의 Device 이름도 변경

이후 재부팅하면 모두 적용 되며 2개 이상의 device의 경우는 /etc/udev/rules.d/70-persistent-net.rules 파일을 수정해야 함

 

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

[root@localhost ~]# vi /etc/sysconfig/network-scripts/ifcfg-eth0
HWADDR=D0:50:99:51:91:19
TYPE=Ethernet
BOOTPROTO=dhcp
DEFROUTE=yes
PEERDNS=yes
PEERROUTES=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_PEERDNS=yes
IPV6_PEERROUTES=yes
IPV6_FAILURE_FATAL=no
NAME=enp0s25  // => eth0으로 변경
UUID=466db8ad-a566-4b5d-878c-ab442505c1d3
ONBOOT=no



출처: http://neo-blog.tistory.com/13 [네오블로그]

조회 수 :
92683
등록일 :
2017.08.29
12:33:51 (*.160.88.18)
엮인글 :
http://webs.co.kr/index.php?document_srl=3311354&act=trackback&key=e3d
게시글 주소 :
http://webs.co.kr/index.php?document_srl=3311354
List of Articles
번호 제목 글쓴이 날짜 조회 수
93 윈도우 ssh 접속 프로그램 admin 2017-09-29 31165
92 openvpn Easy Windows Guide admin 2017-09-20 119046
91 OpenVPN - Getting started How-To admin 2017-09-20 66076
90 openssl 을 이용한 인증서 생성 절차를 정리한다. 개인키 CSR SSL 인증서 파일 생성 admin 2017-09-14 22832
89 How to Manually Unblock / Unban IP Address in fail2ban 차단풀기 admin 2017-09-12 148696
88 How To Protect SSH with fail2ban on Debian 7 데비안 ssh 방어 무작위 로그인 admin 2017-09-12 118970
87 SSH 무작위 로그인 시도 막기(With Fail2Ban on CentOS 6/7 + selinux) admin 2017-09-12 23972
86 리눅스 데비안 네트워크 설정 유선랜 무선랜 linux debian network setting 설정 admin 2017-09-07 115372
85 linux debian 계열 network 설정 테트워크 데비안 admin 2017-09-07 21532
84 PUTTY DOWNLOAD - FREE SSH & TELNET CLIENT admin 2017-09-03 173380
83 debian 8.8 download cd1 cd2 cd3 etc admin 2017-09-03 30348
82 Debian Download 데비안 리눅스 다운로드 admin 2017-09-02 26445
81 데비안 리눅스 부팅시에 방화벽 서버에 자동실행 되게 설정 해보자 admin 2017-08-30 22065
80 리눅스 시작시에 부팅시 프로세스 프로그램 자동 실행 설정 admin 2017-08-30 116649
79 리눅스 시작시 부팅 시, 프로그램 자동실행 등록하기 admin 2017-08-30 36184
78 리눅스 부팅시 시작시 프로그램 명령어 실행하기 (Linux Init script) admin 2017-08-30 71797
77 리눅스 부팅시 자동 실행 명령스크립트 실행하기 만들기 이해 linux booting admin 2017-08-30 126534
76 부팅시 자동실행 명령어 스크립트, rc.local admin 2017-08-30 88511
75 the world’s most widely deployed RADIUS server document admin 2017-08-29 116517
» 네트워크 디바이스명 변경 리눅스 eth0 eth1 admin 2017-08-29 92683
73 Cloned VMware CentOS6 Server "device eth0 does not seem to be present, admin 2017-08-29 35538
72 VMWARE VM Error boot loader install grub - install /dev/sda or /dev/hda MBR linux admin 2016-01-27 30272
71 Linux and Unix touch command admin 2015-11-15 28443
70 Configuration of Red Hat 5.4 Xen for SR-IOV Support admin 2015-08-02 28012
69 apt-get install linux-image-2.6.26-2-686-bigmem admin 2015-06-27 46515
68 intel i210 driver install and compile debian admin 2015-06-27 265230
67 Debian / Ubuntu Linux Install Kernel Headers Package admin 2015-06-27 118413
66 mount -t auto /dev/sdb1 /mnt && ls /mnt admin 2015-06-27 25117
65 kali linux 해킹 hacking attack DDOS etc tools admin 2015-06-24 41197
64 sources.list lenny admin 2015-02-03 23915