노드별로 접근이 가능하면 본격적인 설치전에 사전작업을 한다.

일단 hostname 및 ip hosts 설정을 한다.

ip 설정은 management network쪽도 원래 설정해야 하지만 해당 가이드에선 host 시스템에서 dhcp로 설정해주었으니 생략하고

public network쪽만 설정하겠음 public network는 아키텍처에서 보이는 것 처럼 컨트롤러 노드와 컴퓨트 노드만 설정함

추가로 원활한 설정을 위해 모든 노드의 방화벽을 중지 및 부팅시 시작 서비스에서 제외시킨다.

 

 

### controller 노드 ###

[root@localhost ~]# ssh 10.0.0.11
Last login: *** *** ** **:**:** 2016

[root@localhost ~]# hostnamectl set-hostname controller

[root@localhost ~]# vi /etc/sysconfig/network-scripts/ifcfg-eth1

DEVICE=eth1

TYPE=Ethernet
ONBOOT=yes
BOOTPROTO=none

 

[root@localhost ~]# systemctl stop firewalld
[root@localhost ~]# systemctl disable firewalld
Removed symlink /etc/systemd/system/basic.target.wants/firewalld.service.
Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.

[root@localhost ~]# sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config

[root@localhost ~]# exit

logout
Connection to 10.0.0.11 closed.

 

### compute 노드 ###

[root@localhost ~]# ssh 10.0.0.31
Last login: *** *** ** **:**:** 2016
[root@localhost ~]# hostnamectl set-hostname compute

[root@localhost ~]# vi /etc/sysconfig/network-scripts/ifcfg-eth1

DEVICE=eth1
TYPE=Ethernet
ONBOOT=yes
BOOTPROTO=none

[root@localhost ~]# systemctl stop firewalld
[root@localhost ~]# systemctl disable firewalld
Removed symlink /etc/systemd/system/basic.target.wants/firewalld.service.
Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.

[root@localhost ~]# sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config

[root@localhost ~]# exit

logout
Connection to 10.0.0.31 closed.

 

### block1 노드 ###

[root@localhost ~]# ssh 10.0.0.41
Last login: *** *** ** **:**:** 2016
[root@localhost ~]# hostnamectl set-hostname block1

[root@localhost ~]# systemctl stop firewalld
[root@localhost ~]# systemctl disable firewalld
Removed symlink /etc/systemd/system/basic.target.wants/firewalld.service.
Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.

[root@localhost ~]# sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config

[root@localhost ~]# exit

logout
Connection to 10.0.0.41 closed.

 

### object1 노드 ###

[root@localhost ~]# ssh 10.0.0.51
Last login: *** *** ** **:**:** 2016
[root@localhost ~]# hostnamectl set-hostname object1

[root@localhost ~]# systemctl stop firewalld
[root@localhost ~]# systemctl disable firewalld
Removed symlink /etc/systemd/system/basic.target.wants/firewalld.service.
Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.

[root@localhost ~]# sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config

[root@localhost ~]# exit

logout
Connection to 10.0.0.51 closed.

 

### object2 노드 ###

[root@localhost ~]# ssh 10.0.0.52
Last login: *** *** ** **:**:** 2016
[root@localhost ~]# hostnamectl set-hostname object2

[root@localhost ~]# systemctl stop firewalld
[root@localhost ~]# systemctl disable firewalld
Removed symlink /etc/systemd/system/basic.target.wants/firewalld.service.
Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.

[root@localhost ~]# sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config

[root@localhost ~]# exit

logout
Connection to 10.0.0.51 closed.

 

 

[root@localhost ~]# vi /etc/hosts

### 아래의 내용 추가 후 저장###

10.0.0.11       controller
10.0.0.31       compute
10.0.0.41       block1
10.0.0.51       object1
10.0.0.52       object2

 

[root@localhost ~]# scp /etc/hosts controller:/etc/hosts
The authenticity of host 'controller (10.0.0.11)' can't be established.
ECDSA key fingerprint is **:**:**:**:**:**:**:**:**:**:**:**:**:**:**:**:.

Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'controller' (ECDSA) to the list of known hosts.
hosts                                         100%  252     0.3KB/s   00:00
[root@localhost ~]# scp /etc/hosts compute:/etc/hosts
The authenticity of host 'compute (10.0.0.31)' can't be established.
ECDSA key fingerprint is **:**:**:**:**:**:**:**:**:**:**:**:**:**:**:**:.

Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'compute,10.0.0.31' (ECDSA) to the list of known hosts.
hosts                                         100%  252     0.3KB/s   00:00
[root@localhost ~]# scp /etc/hosts block1:/etc/hosts
The authenticity of host 'block1 (10.0.0.41)' can't be established.
ECDSA key fingerprint is **:**:**:**:**:**:**:**:**:**:**:**:**:**:**:**:.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'block1,10.0.0.41' (ECDSA) to the list of known hosts.
hosts                                         100%  252     0.3KB/s   00:00
[root@localhost ~]# scp /etc/hosts object1:/etc/hosts
The authenticity of host 'object1 (10.0.0.51)' can't be established.
ECDSA key fingerprint is **:**:**:**:**:**:**:**:**:**:**:**:**:**:**:**:.

Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'object1,10.0.0.51' (ECDSA) to the list of known hosts.
hosts                                         100%  252     0.3KB/s   00:00
[root@localhost ~]# scp /etc/hosts object2:/etc/hosts
The authenticity of host 'object2 (10.0.0.52)' can't be established.
ECDSA key fingerprint is **:**:**:**:**:**:**:**:**:**:**:**:**:**:**:**:.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'object2,10.0.0.52' (ECDSA) to the list of known hosts.
hosts                                         100%  252     0.3KB/s   00:00

 

 

 

 

NTP 설정

- 우선 controller 노드부터

[root@controller ~]# yum install chrony -y
Loaded plugins: fastestmirror
Repodata is over 2 weeks old. Install yum-cron? Or run: yum makecache fast
base                                                     | 3.6 kB     00:00
extras                                                   | 3.4 kB     00:00
updates                                                  | 3.4 kB     00:00
(1/2): extras/7/x86_64/primary_db                          | 101 kB   00:00
(2/2): updates/7/x86_64/primary_db                         | 3.1 MB   00:00

...(중략)...

Installed:
  chrony.x86_64 0:2.1.1-1.el7.centos

Complete!
[root@controller ~]# vi /etc/chrony.conf

### 아래의 내용처럼 추가 ###

server 10.0.0.1 iburst              # 외부 NTP 서버의 IP를 설정, 기존의 "server 1.centos.pool.ntp.org iburst"등은 주석 처리 또는 삭제

 

allow 10.0.0.0/24                   # 다른 노드들이 접근을 허용할수 있게 해당 내용 추가

 

### 서비스 등록 및 활성화 ###

[root@controller ~]# systemctl enable chronyd.service
[root@controller ~]# systemctl start chronyd.service

### sync가 잘되었는지 확인 ###

[root@controller ~]# chronyc sources                 
210 Number of sources = 1
MS Name/IP address         Stratum Poll Reach LastRx Last sample
===============================================================================
^? 10.0.0.1                      0   8     0   10y     +0ns[   +0ns] +/-    0ns

 

- controller 외의 노드들은 공통

[root@compute ~]# yum install chrony -y
Loaded plugins: fastestmirror
Repodata is over 2 weeks old. Install yum-cron? Or run: yum makecache fast

...(중략)...

Installed:
  chrony.x86_64 0:2.1.1-1.el7.centos

Complete!
 [root@compute ~]# vi /etc/chrony.conf

### 아래의 내용처럼 추가 ###

server controller iburst           # controller 노드의 시간과 sync 시킨다. 기존의 "server 1.centos.pool.ntp.org iburst"등은 주석 처리 또는 삭제

 

### 서비스 등록 및 활성화 ###

[root@compute ~]# systemctl enable chronyd.service
[root@compute ~]# systemctl start chronyd.service

### sync가 잘되었는지 확인 ###

[root@compute ~]# chronyc sources
210 Number of sources = 1
MS Name/IP address         Stratum Poll Reach LastRx Last sample
===============================================================================
^? controller                    0   8     0   10y     +0ns[   +0ns] +/-    0ns 


 

리눅스 history에서 시간 보기

export HISTTIMEFORMAT="[%F %T]"

=> history에서 시간 보기

export HISTTIMEFORMAT=""

=> 원상복구 

 

부팅시 자동 적용되게 하려면 rc.local에 등록

centos7에서는 systemd로 부팅이 되면서 rc.local이 실행되지 않음

 

chmod u+x /etc/rc.d/rc.local

systemctl start rc.local

 

위 명령어를 수행하면 됨

 

리눅스 history 삭제

해당 유저의 홈폴더의 .bash_history 파일을 수정 또는 삭제

메모리에 기억되어있는 현재 세션의 명령어들은

unset HISTFILE 을 통해 삭제 가능

 

삭제방지를 방지 하려면 /etc/bashrc 이나 /etc/profile 밑에
declare -r HISTFILE 를 입력해준다.

 

 

 

 

http://people.freedesktop.org/~teuf/spice-doc/html/ch02.html

 

spice 설정 자료

 

http://www.spice-space.org/download.html

spice 관련 다운로드 링크

'virtualization' 카테고리의 다른 글

esxi 6 드라이버 업그레이드  (0) 2016.11.30
KVM nested virualization  (0) 2016.01.11
PCI passthrough on KVM  (0) 2015.08.07
kvm 설치 centos  (0) 2015.04.03
CentOS 6, KVM에 guest OS bridge 네트워크 설정법  (0) 2015.04.03

출처 : https://www.lesstif.com/pages/viewpage.action?pageId=6979667

 

 

개요

yum 은 Yellowdog Updater Modified 의 약자로 대화형 패키지 관리 시스템이다. wikipedia 에 따르면 Duke 대학교의 물리학과에서 사용하는 Red Hat Linux 시스템의 관리를 편하게 하기 위해 만들어 졌다고 한다.

Slackware 때 사용하던 .tgz 패키지에 비해 rpm 은 의존성 관리와 버전 관리라는 장점이 있었지만 실제 rpm 으로 Linux 시스템을 관리할 경우 다음과 같은 문제가 있었다.

  • 특정 rpm 에 의존성 있는 패키지가 있을 경우 일일이 다운받아서 의존성 있는 rpm을 설치해야 함.
  • rpm 이 update 됐을 경우  update 됐다는 사실을 알기가 어려움(패키지마다 직접 확인 필요)

yum 은 central repository 를 통해 rpm 을 배포하고 의존성 관리를 하므로 손쉽게 패키지를 관리할수 있다.

 

주요 명령어와 옵션

yum 은 command 와 option 으로 구성되어 있다. yum --help 로 전체 명령어와 옵션을 확인할 수 있다.

많이 쓰이는 options 는 다음과 같다.

--enablerepo=[repo] 여러개의 yum repository가 있을 경우 사용할 repos 를 지정한다. * 같은 wildcard를 사용할 수 있다.
--disablerepo=[repo] 사용하지 않을 repos 를 지정한다. wildcard 사용 가능
--nogpgcheck GPG 서명검증을 사용하지 않는다. 해당 repos 의 공개키가 없어서 서명검증에 실패할 경우에 사용한다.
-d [debug level] debugging level을 지정한다. 0 - 10 까지 가능하며 숫자가 클수록 자세한 정보를 출력한다.
-y, --assumeyes yum 진행중 나오는 질문을 모두 yes 로 처리한다. 삭제할 경우에는 의존성있는 모든 패키지까지 삭제되므로 주의해야 한다.

 

install

패키지를 설치한다. 의존성있는 패키지까지 같이 설치해 준다.

update 

yum update httpd 와 같이 패키지명이 주어질 경우 해당 패키지의 새 버전이 있으면 update 한다. 패키지명이 없을 경우 전체 시스템에서 update 될 패키지를 확인후 update 한다. -y 옵션을 줄 경우 묻지 않고 업데이트하므로 주의해야 한다.

전체 update 수행시 배포본의 minor 버전이 변경될 수 있다. Ex: RHEL 6.1 -> 6.4

check-update

update 될 패키지의 목록을 출력한다.

clean

The following are the ways which you can invoke yum in clean mode. Note that "all files" in the commands below means "all files in currently enabled repositories". If you want to also clean any (temporarily) disabled repositories you need to use --enablerepo=’*’ option.


check

check Checks the local rpmdb and produces information on any problems it finds. You can pass the check command the arguments "dependencies" or "duplicates", to limit the checking that is performed (the default is "all" which does both).

The info command can also take ranges of transaction ids, of the form start..end, which will then display a merged history as if all the transactions in the range had happened at once.

Eg. "history info 1..4" will merge the first four transactions and display them as a single transaction. help Produces help, either for all commands or if given a command name then the help for that particular command.


repolist

현재 등록된 repossitory list 를 출력한다. repository 설정은 /etc/yum.repos.d/ 에서 확인할 수 있다.

yum search string

패키지명 및 description 에 "string" 들어간 패키지들을 출력한다. 

provides

yum search path-string

패키지에 포함된 파일명이 string 과 일치하는 패키지들을 출력한다.  예로 다음 명령어는 httpd.conf 란 파일이 있는 모든 패키지를 출력한다.

yum provides '*/httpd.conf'
 
389-admin-1.1.29-1.el6.i686 : 389 Administration Server (admin)
Repo        : epel
Matched from:
Filename    : /etc/dirsrv/admin-serv/httpd.conf
piranha-0.8.6-2.el6_4.1.x86_64 : Cluster administation tools
Repo        : updates
Matched from:
Filename    : /etc/sysconfig/ha/conf/httpd.conf

위와 같이 /etc/dirsrv/admin-serv/에 있는 httpd.conf 도 출력이 된다. /etc/httpd/ 밑에 httpd.conf 가 있는 패키지만 출력하고 싶다면 다음과 같이 경로를 지정한다.

yum provides '/etc/http*/httpd.conf'
 
httpd-2.2.15-28.el6.centos.x86_64 : Apache HTTP Server
Repo        : updates
Matched from:
Filename    : /etc/httpd/conf/httpd.conf

 

localinstall

yum repository 를 제공하지 않고 rpm 으로만 제공하는 패키지가 있을 경우 (Ex: MySQL) 유용한 명령어다.

rpm 을 로컬에 다운로드하고 yum localinstall 로 설치하면 된다.

rpm -ivh 로 설치할 수도 있지만 yum  으로 작업하면 transaction 기록이 남으므로 yum history 를 사용하여 rollback 이 가능하다.

rpm 제작사의 서명이 없어서 에러가 날수 있으므로 --nogpgcheck 옵션을 추가해야 할 경우도 있다.

yum plugin

yum 은 plugin 으로 기능을 확장할 수 있다. 사용가능한 전체 플러그인 목록은 "yum search yum-plugin" 명령어로 볼수 있다.

yum 을 실행하면 다음과 같이 현재 기동된 plugin 목록을 표시한다.

Loaded plugins: fastestmirror, presto, refresh-packagekit

 

유용한 플러그인은 다음과 같다.

downloadonly plugin

package 를 설치하지 않고 rpm 을 다운로드만 해주는 플러그인이다.

plugin 설치는 다음 yum 명령으로 설치하자.

yum install yum-downloadonly

 

download 시에는 --downloadonly 옵션을 붙여서 yum 을 실행하면 된다.

 

yum install postfix -y --downloadonly  

CentOS 7 에서는 yumdownloader 라는 별도의 명령어로 분리되었습니다

$ yumdownloader python --source

 

/var/cache/yum/ 에 다운로드 패키지 저장되니 아래처럼 하면 됨

yum install postfix -y --downloadonly --downloaddir=/opt
참고

 

verify plugin

설치된 패키지를 검증해 주는 플러그인이다.

다음 명령어로 httpd 패키지를 검증할 수 있다.

yum verify httpd

 

httpd 패키지의 설정파일의 수정 여부를 검증하려면 다음과 같이 수행한다.

yum verify --verify-filenames='/etc/httpd/*'  --verify-configuration-files=yes

특정 플러그인 disable

yum 실행시 --disableplugin 옵션으로 특정 플러그인의 사용을 잠시 중지할 수 있다. RHEL 의 경우 네트웍이 미구성되었거나 아직 subscription 을 등록 안 했을 경우 yum 실행시 RHN(RedHat Network) 에 연결하려고 하므로 DVD 나 ISO 로 local repository 를 만들어도 패키지를 설치할수 없다. 이럴 경우 다음과 같이 두 개의 plugin 을 잠시 중지시켜주면 RHN 연결과 상관없이 패키지를 설치할 수 있다.

yum --disableplugin=subscription-manager,rhnplugin install git -y

 

yum 설치 history 및 transaction 관리

패키지 설치, 변경, 삭제로 인해 내부 저장소가 변경되는 작업을 트랜잭션이라고 하며 RHEL6/CentOS 6 에 포함된 yum 부터는 트랜잭션 내역을 확인하고 rollback 을 할 수 있다. 

트랜잭션 목록 보기

yum history 를 옵션없이 실행하거나 옵션에 list 를 주면 최근 트랜잭션 목록을 볼 수 있다.

root@localhost:~:> yum history list
 
 
Loaded plugins: fastestmirror, security
ID     | Login user               | Date and time    | Action(s)      | Altered
-------------------------------------------------------------------------------
     8 | root <root>              | 2014-01-08 05:51 | Install        |    1  
     7 | root <root>              | 2014-01-08 04:23 | Reinstall      |    1  
     6 | root <root>              | 2014-01-08 03:18 | Reinstall      |    1  
     5 | root <root>              | 2014-01-07 06:44 | I, U           |    4  
     4 | root <root>              | 2014-01-02 05:32 | I, U           |    3  
     3 | root <root>              | 2014-01-01 03:48 | Install        |    4 EE
     2 | root <root>              | 2014-01-01 03:15 | I, U           |   28  
     1 | System <unset>           | 2013-12-15 03:43 | Install        |  534

 

모든 트랜잭션을 보려면 list 옵션뒤에 all 뒤에 키워드를 주면 된다.

root@localhost:~:> yum history list all

 

특정 범위내 트랜잭션만 보려면 "시작 트랜잭션 번호".."종료 트랜잭션 번호" 형식으로 입력하면 된다. 다음은 트랜잭션 번호가 30 에서 35인 목록을 출력한다.

yum history list 30..35
Loaded plugins: fastestmirror, replace
ID     | Login user               | Date and time    | Action(s)      | Altered
-------------------------------------------------------------------------------
    35 | root <root>              | 2014-01-12 16:53 | I, U           |    3 EE
    34 | root <root>              | 2014-01-12 14:05 | Install        |    1  
    33 | root <root>              | 2014-01-12 14:05 | Erase          |    2  
    32 | root <root>              | 2014-01-12 13:00 | Install        |    2  
    31 | root <root>              | 2014-01-12 13:00 | Erase          |    1  
    30 | root <root>              | 2014-01-02 10:18 | Install        |    5  
history list

 

트랜잭션에서 정보 추출

마지막 트랜잭션 정보 보기

root@localhost:~:> yum history info
 
Loaded plugins: fastestmirror, security
Transaction ID : 8
Begin time     : Wed Jan  8 05:51:29 2014
Begin rpmdb    : 541:b7c34882afac2a58081bb274b5aaf30c2f993335
End time       :            05:51:31 2014 (2 seconds)
End rpmdb      : 542:4124c5c718def4131929c4ca08df78611232aa42
User           : root <root>
Return-Code    : Success
Command Line   : install mc
Transaction performed with:
    Installed     rpm-4.8.0-37.el6.x86_64                       @anaconda-CentOS-201311272149.x86_64/6.5
    Installed     yum-3.2.29-43.el6.centos.noarch               @updates
    Installed     yum-plugin-fastestmirror-1.1.30-14.el6.noarch @anaconda-CentOS-201311272149.x86_64/6.5
Packages Altered:
    Install mc-1:4.7.0.2-3.el6.x86_64 @base
history info

 

ID 가 4 인 트랜잭션 정보 보기

root@localhost:~:> yum history info 4
 
Loaded plugins: fastestmirror, security
Transaction ID : 4
Begin time     : Thu Jan  2 05:32:21 2014
Begin rpmdb    : 539:85ca42f3d13cc18b6c4e179d32d564ba2ad47345
End time       :            05:32:30 2014 (9 seconds)
End rpmdb      : 540:a28a774308ff5f83227157e08f47bb2b3aa02618
User           : root <root>
Return-Code    : Success
Command Line   : localinstall git-1.8.3.1-1.sdl6.x86_64.rpm perl-Git-1.8.3.1-1.sdl6.noarch.rpm
Transaction performed with:
    Installed     rpm-4.8.0-37.el6.x86_64                       @anaconda-CentOS-201311272149.x86_64/6.5
    Installed     yum-3.2.29-43.el6.centos.noarch               @updates
    Installed     yum-plugin-fastestmirror-1.1.30-14.el6.noarch @anaconda-CentOS-201311272149.x86_64/6.5
Packages Altered:
    Updated     git-1.7.1-3.el6_4.1.x86_64          @anaconda-CentOS-201311272149.x86_64/6.5
    Update          1.8.3.1-1.sdl6.x86_64           @/git-1.8.3.1-1.sdl6.x86_64
    Updated     perl-Git-1.7.1-3.el6_4.1.noarch     @anaconda-CentOS-201311272149.x86_64/6.5
    Update               1.8.3.1-1.sdl6.noarch      @/perl-Git-1.8.3.1-1.sdl6.noarch
    Dep-Install perl-TermReadKey-2.30-13.el6.x86_64 @base
history info

 

트랜잭션 되돌리기

yum history undo ID 명령어로 특정 트랜잭션을 되돌릴 수 있다. (ID는 트랜잭션 번호이다)

예로 다음과 같이 트랜잭션 8에서 mc 라는 패키지를 설치했을 경우

root@localhost:~:> yum history list
 
Loaded plugins: fastestmirror, security
ID     | Login user               | Date and time    | Action(s)      | Altered
-------------------------------------------------------------------------------
     8 | root <root>              | 2014-01-08 05:51 | Install        |    1  
     7 | root <root>              | 2014-01-08 04:23 | Reinstall      |    1  
     6 | root <root>              | 2014-01-08 03:18 | Reinstall      |    1  
     5 | root <root>              | 2014-01-07 06:44 | I, U           |    4  
     4 | root <root>              | 2014-01-02 05:32 | I, U           |    3  
     3 | root <root>              | 2014-01-01 03:48 | Install        |    4 EE
     2 | root <root>              | 2014-01-01 03:15 | I, U           |   28  
     1 | System <unset>           | 2013-12-15 03:43 | Install        |  534  
history list

yum history undo 8 을 실행하면 8번 트랜잭션에 대해 undo 를 수행한다. undo 의 결과는 해당 트랜잭션이 무엇이었는지에 따라 다르다. 설치였으면 undo 는 삭제가 되고 삭제였다면 undo 는 설치가 된다.

예로 트랜잭션 8번에서 mc 라는 패키지를 설치했으면 undo 8의 결과는 mc 패키지의 삭제가 된다

transaction 8 번 되돌리기
root@localhost:~:>  yum history undo 8
 
Loaded plugins: fastestmirror, security
Loading mirror speeds from cached hostfile
 * base: data.nicehosting.co.kr
 * extras: data.nicehosting.co.kr
 * updates: data.nicehosting.co.kr
Undoing transaction 8, from Wed Jan  8 05:51:29 2014
    Install mc-1:4.7.0.2-3.el6.x86_64 @base
Resolving Dependencies
--> Running transaction check
---> Package mc.x86_64 1:4.7.0.2-3.el6 will be erased
--> Finished Dependency Resolution
Dependencies Resolved
=================================================================================================================
 Package              Arch                     Version                             Repository               Size
=================================================================================================================
Removing:
 mc                   x86_64                   1:4.7.0.2-3.el6                     @base                   5.4 M
Transaction Summary
=================================================================================================================
Remove        1 Package(s)
Installed size: 5.4 M
Is this ok [y/N]: y

 

undo의 결과로 다음과 같이 transaction 9번이 생겼고 Action 은 Erase 가 된다.

root@localhost:~:> yum history list  
 
Loaded plugins: fastestmirror, security
ID     | Login user               | Date and time    | Action(s)      | Altered
-------------------------------------------------------------------------------
     9 | root <root>              | 2014-01-08 05:58 | Erase          |    1  
     8 | root <root>              | 2014-01-08 05:51 | Install        |    1  
     7 | root <root>              | 2014-01-08 04:23 | Reinstall      |    1  
     6 | root <root>              | 2014-01-08 03:18 | Reinstall      |    1  
     5 | root <root>              | 2014-01-07 06:44 | I, U           |    4  
     4 | root <root>              | 2014-01-02 05:32 | I, U           |    3  
     3 | root <root>              | 2014-01-01 03:48 | Install        |    4 EE
     2 | root <root>              | 2014-01-01 03:15 | I, U           |   28  
     1 | System <unset>           | 2013-12-15 03:43 | Install        |  534  
history list

 

모든 history 를 삭제하는 위험한 명령어이다. 특별한 이유가 없다면 실행하지 않는다.

yum history new

 

같이 보기

이전 버전에선 /etc/inittab 에서 아래 id:5:initdefault: 부분의 숫자를 변경해주면 변경가능

 

[root@python ~]# vi /etc/inittab
# inittab is only used by upstart for the default runlevel.
#
# ADDING OTHER CONFIGURATION HERE WILL HAVE NO EFFECT ON YOUR SYSTEM.
#
# System initialization is started by /etc/init/rcS.conf
#
# Individual runlevels are started by /etc/init/rc.conf
#
# Ctrl-Alt-Delete is handled by /etc/init/control-alt-delete.conf
#
# Terminal gettys are handled by /etc/init/tty.conf and /etc/init/serial.conf,
# with configuration in /etc/sysconfig/init.
#
# For information on how to write upstart event handlers, or how
# upstart works, see init(5), init(8), and initctl(8).
#
# Default runlevel. The runlevels used are:
#   0 - halt (Do NOT set initdefault to this)
#   1 - Single user mode
#   2 - Multiuser, without NFS (The same as 3, if you do not have networking)
#   3 - Full multiuser mode
#   4 - unused
#   5 - X11
#   6 - reboot (Do NOT set initdefault to this)
#
id:5:initdefault:
~
~

 

하지만 7버전대 와서는 init을 쓰지 않게 되면서 파일 내용이 아래와 같이 변경

결론은 아래 파일을 보고 systemctl 명령어로 runlevel을 변경하면 됨

# systemctl get-default   // 현재 runlevel을 보여주기

# systemctl set-default multi-user.target   // 멀티유저(runlevel 3)으로 변경

# systemctl set-default graphical.target   // 그래피컬(runlevel 5)로 변경

 

 

[root@localhost etc]# cat inittab
# inittab is no longer used when using systemd.
#
# ADDING CONFIGURATION HERE WILL HAVE NO EFFECT ON YOUR SYSTEM.
#
# Ctrl-Alt-Delete is handled by /usr/lib/systemd/system/ctrl-alt-del.target
#
# systemd uses 'targets' instead of runlevels. By default, there are two main targets:
#
# multi-user.target: analogous to runlevel 3
# graphical.target: analogous to runlevel 5
#
# To view current default target, run:
# systemctl get-default
#
# To set a default target, run:
# systemctl set-default TARGET.target
#

 

 

openstack liberty 버전

 

하드웨어 요구사항 및 네트워크 구성

 

 

 

네트워크 구성도

 

이를 기반으로 실제 시스템 구성

피지컬 서버 사양

CPU - Intel Xeon e5-2603v3 6core

RAM - 32GB dd4

DISK - sata 3 disk 1TB

          ssd 120GB * 2ea(raid 0 구성 으로 OS 영역시 저장될 곳)

OS centos 7.2

 

일단 가상머신 설치를 위해 centos 7 버전을 설치

 

[root@localhost home]# wget http://ftp.daumkakao.com/centos/7/isos/x86_64/CentOS-7-x86_64-DVD-1511.iso
--2016-01-29 23:47:34--  http://ftp.daumkakao.com/centos/7/isos/x86_64/CentOS-7-x86_64-DVD-1511.iso
Resolving ftp.daumkakao.com (ftp.daumkakao.com)... 103.246.57.108
Connecting to ftp.daumkakao.com (ftp.daumkakao.com)|103.246.57.108|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 4329570304 (4.0G) [application/x-iso9660-image]
Saving to: ‘CentOS-7-x86_64-DVD-1511.iso’

94% [====================================================================================================================>        ] 4,073,544,588 9.65MB/s   in 15m 0s

2016-01-30 00:02:39 (4.32 MB/s) - Connection closed at byte 4073544588. Retrying.

--2016-01-30 00:02:40--  (try: 2)  http://ftp.daumkakao.com/centos/7/isos/x86_64/CentOS-7-x86_64-DVD-1511.iso
Connecting to ftp.daumkakao.com (ftp.daumkakao.com)|103.246.57.108|:80... connected.
HTTP request sent, awaiting response... 206 Partial Content
Length: 4329570304 (4.0G), 256025716 (244M) remaining [application/x-iso9660-image]
Saving to: ‘CentOS-7-x86_64-DVD-1511.iso’

100%[+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=======>] 4,329,570,304 5.29MB/s   in 33s

2016-01-30 00:03:13 (7.31 MB/s) - ‘CentOS-7-x86_64-DVD-1511.iso’ saved [4329570304/4329570304]
[root@localhost home]#

 

우선 Management network 생성하기 위해 vi로 아래와 같은 파일을 생성 및 define

[root@localhost~]# cd /etc/libvirt/qemu/networks

[root@localhost networks]# vi managenetwork.xml

<network>
  <name>managenetwork</name>
  <forward dev='br0' mode='nat'>         
    <interface dev='br0'/>                        // 인터넷에 연결된 brige 인터페이스를 입력                         
  </forward>
  <bridge name='virbr1' stp='on' delay='0'/>      // virbr0이 없으면 0으로 생성해도 무방
  <domain name='managenetwork'/>
  <ip address='10.0.0.1' netmask='255.255.255.0'>

  </ip>
</network>

[root@localhost networks]# virsh net-define /etc/libvirt/qemu/networks/managenetwork.xml
Network managenetwork defined from /etc/libvirt/qemu/networks/managenetwork.xml

[root@localhost networks]#

[root@localhost networks]# virsh net-list --all
 Name                 State      Autostart     Persistent
----------------------------------------------------------
 managenetwork        inactive   no            yes
 storagenetwork       active     yes           yes

[root@localhost networks]# virsh net-start managenetwork
Network managenetwork started

[root@localhost networks]# virsh net-autostart managenetwork
Network managenetwork marked as autostarted

[root@localhost networks]# virsh net-list --all
 Name                 State      Autostart     Persistent
----------------------------------------------------------
 managenetwork        active     yes           yes
 storagenetwork       active     yes           yes

[root@localhost networks]#

 

네트워크 생성후 가상머신을 임시로 Minimul 버전으로 설치후 (과정 생략 - 다른건 Default지만

네트워크 디바이스는 2개 연결해주며 eth0은 managenetwork에 연결 eth1은 br0에 연결)

VM들의 Base Image로 사용할 OS 편집을 위해 DHCP IP 할당을 위해 가상머신의 mac address 확인

 

[root@localhost~]# virsh dumpxml centos7.0 | grep 'mac address'
      <mac address='52:54:00:4a:8d:f2'/>   // managenetwork NAT 네트워크에 연결된 eth0
      <mac address='52:54:00:67:ff:88'/>    // host의 br0에 연결된 eth1

 

IP를 확인후 managenetwork 수정 => DHCP항목에 mac주소및 할당 될 IP 설정

[root@localhost ~]# virsh net-list
 Name                 State      Autostart     Persistent
----------------------------------------------------------
 managenetwork        active     yes           yes     

 

[root@localhost ~]# virsh net-edit managenetwork

...

중략

...

    <dhcp>
      <range start='10.0.0.2' end='10.0.0.254'/>
      <host mac='52:54:00:4a:8d:f2' ip='10.0.0.5'/>

      <host mac='52:54:00:4a:8d:11' ip='10.0.0.11'/>     // 가상머신 생성시 정해진 mac IP로 변경하여 DHCP로 IP 할당
      <host mac='52:54:00:4a:8d:31' ip='10.0.0.31'/>
      <host mac='52:54:00:4a:8d:41' ip='10.0.0.41'/>
      <host mac='52:54:00:4a:8d:51' ip='10.0.0.51'/>
      <host mac='52:54:00:4a:8d:52' ip='10.0.0.52'/>


    </dhcp>

 

VM 종료 및 네트워크 재설 후 가상머신을 다시 시작 후 연결상태 확인

 

[root@localhost ~]# virsh shutdown centos7.0
Domain centos7.0 is being shutdown

 

[root@localhost ~]# virsh net-destroy managenetwork
Network managenetwork destroyed

 

[root@localhost ~]# virsh net-start managenetwork
Network managenetwork started

 

[root@localhost ~]# virsh start centos7.0
Domain centos7.0 started

 

[root@localhost ~]# virsh domifaddr centos7.0
 Name       MAC address          Protocol     Address
-------------------------------------------------------------------------------
 vnet0      52:54:00:4a:8d:f2    ipv4         10.0.0.5/24

[root@localhost ~]#

 

기본 baseimage를 가진 가상머신에 접근하여 베이스 이미지를 수정한다.

[root@localhost ~]# ssh 10.0.0.5                                      
The authenticity of host '10.0.0.5 (10.0.0.5)' can't be established.
ECDSA key fingerprint is 99:e1:15:2b:05:9c:89:6b:1a:63:1d:e6:0e:7a:09:6e.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '10.0.0.5' (ECDSA) to the list of known hosts.
root@10.0.0.5's password:
Last login: Sat Jan 30 02:27:11 2016 from 10.0.0.1

 

[root@localhost ~]# yum -y update

Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: ftp.kaist.ac.kr
 * extras: ftp.kaist.ac.kr
 * updates: ftp.kaist.ac.kr
...

중략

...

 

같은 이미지를 사용하는 가상머신들끼리 접근이 편하게끔

ssh-keygen을 이용 ssh-key를 생성후 자신의 public키를 authorized_keys로 복사해준 후 시스템 종료

 

[root@localhost ~]#

[root@localhost ~]# ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa):
Created directory '/root/.ssh'.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /root/.ssh/id_rsa.
Your public key has been saved in /root/.ssh/id_rsa.pub.
The key fingerprint is:
xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx root@localhost.managenetwork
The key's randomart image is:
+--[ RSA 2048]----+
|        .. .  .o.|
|         .o   +o+|
|          ..  .Bo|
|         ..  .+oo|
|        S  ..  .+|
|            .. oE|
|           .  +  |
|          . .. . |
|           . .o..|
+-----------------+
[root@localhost ~]# cd .ssh

[root@localhost ~]# cp id_rsa.pub authorized_keys

[root@localhost ~]# shutdown -h now


 가상머신들이 사용할 이미지를 원본이미지를 통한 backing 파일로 생성 

 

[root@localhost ~]# virsh domblklist centos7.0
Target     Source
------------------------------------------------
vda        /mnt/osvg/vol/ospool/linux.qcow2

 

[root@localhost ~]# cd /mnt/osvg/vol/ospool

[root@localhost ospool]# qemu-img create -b ./linux.qcow2 -f qcow2 ./controller.qcow2
Formatting './controller.qcow2', fmt=qcow2 size=107374182400 backing_file='./linuxbase.qcow2' encryption=off cluster_size=65536 lazy_refcounts=off refcount_bits=16
[root@localhost ospool]# qemu-img create -b ./linux.qcow2 -f qcow2 ./compute.qcow2
Formatting './compute.qcow2', fmt=qcow2 size=107374182400 backing_file='./linuxbase.qcow2' encryption=off cluster_size=65536 lazy_refcounts=off refcount_bits=16
[root@localhost ospool]# qemu-img create -b ./linux.qcow2 -f qcow2 ./block1.qcow2
Formatting './block1.qcow2', fmt=qcow2 size=107374182400 backing_file='./linuxbase.qcow2' encryption=off cluster_size=65536 lazy_refcounts=off refcount_bits=16
[root@localhost ospool]# qemu-img create -b ./linux.qcow2 -f qcow2 ./object1.qcow2
Formatting './object1.qcow2', fmt=qcow2 size=107374182400 backing_file='./linuxbase.qcow2' encryption=off cluster_size=65536 lazy_refcounts=off refcount_bits=16
[root@localhost ospool]# qemu-img create -b ./linux.qcow2 -f qcow2 ./object2.qcow2
Formatting './object2.qcow2', fmt=qcow2 size=107374182400 backing_file='./linuxbase.qcow2' encryption=off cluster_size=65536 lazy_refcounts=off refcount_bits=16

 

[root@localhost ospool]# chown qemu:qemu *.qcow2
[root@localhost ospool]# ls -alrt
total xxxxxxx

drwxr-xr-x 4 nfsnobody root         4096 Jan 23 20:16 ..
-rw-r--r-- 1 qemu      qemu   3673030656 Jan 25 07:30 xxxxx.qcow2
-rw-r--r-- 1 qemu      qemu   4676124672 Jan 25 07:30 xxxxx.qcow2
-rw-r--r-- 1 qemu      qemu   3686268928 Jan 28 10:21 xxxxx.qcow2
-rw-r--r-- 1 qemu      qemu   1436483584 Jan 30 14:57 linux.qcow2
-rw-r--r-- 1 qemu      qemu 107390894592 Feb  1 05:19 xxxxx.qcow2
-rw-r--r-- 1 qemu      qemu   4346937344 Feb 10 05:44 xxxxx.qcow2
-rw-r--r-- 1 qemu      qemu   4289134592 Feb 16 09:27 xxxxx.qcow2
-rw-r--r-- 1 qemu      qemu       198656 Feb 17 05:37 controller.qcow2
-rw-r--r-- 1 qemu      qemu       198656 Feb 17 05:37 compute.qcow2
-rw-r--r-- 1 qemu      qemu       198656 Feb 17 05:37 block1.qcow2
-rw-r--r-- 1 qemu      qemu       198656 Feb 17 05:37 object1.qcow2
drwxr-xr-x 2 root      root         4096 Feb 17 05:38 .
-rw-r--r-- 1 qemu      qemu       198656 Feb 17 05:38 object2.qcow2

 

 

가상머신 생성을 위해 원본 가상머신의 xml 파일을 dump파일로 생성 후 복사 및 수정

이때 가상머신의 uuid와 max address들이 가상머신들끼리 겹치면 안되기 때문에 삭제 또는 적절히 수정해야함

 

[root@localhost ospool]# cd /etc/libvirt/qemu/ 

[root@localhost qemu]# virsh dumpxml generic >> /etc/libvirt/qemu/dump.xml

[root@localhost qemu]# cp /etc/libvirt/qemu/dump.xml /etc/libvirt/qemu/controller.xml
[root@localhost qemu]# cp /etc/libvirt/qemu/dump.xml /etc/libvirt/qemu/compute.xml
[root@localhost qemu]# cp /etc/libvirt/qemu/dump.xml /etc/libvirt/qemu/block1.xml
[root@localhost qemu]# cp /etc/libvirt/qemu/dump.xml /etc/libvirt/qemu/object1.xml
[root@localhost qemu]# cp /etc/libvirt/qemu/dump.xml /etc/libvirt/qemu/object2.xml

[root@localhost qemu]# vim /etc/libvirt/qemu/controller.xml

<domain type='kvm'>
  <name>controller</name>                            // 이름 수정

  <uuid>5e26e120-f046-4c8a-bf56-dbd4b9ba8f3f</uuid>  // 해당 내용은 실제 설정시는 uuid가 겹치면 안되기 때문에 삭제(define 할경우때 자동으로 생성)
  <memory unit='GiB'>4</memory>                      // 메모리도 알아서 수정, 단위를 GiB로 수정후 변경하는게 편함
  <currentMemory unit='GiB'>4</currentMemory>        // 현재 설정에서는 controller 4G, comupte 8G, block1 2G, object 각 4G 할당 예정
  <vcpu placement='static'>2</vcpu>                  // cpu는 각각 2, 6, 2, 2, 2 할당 예정
  ...(생략)...

  <cpu mode='host-passthrough'>                      // 중첩 가상화를 위해 cpu mode를 host-passthrough 또는 host-model로 변경
  ...(생략)...
   <disk type='file' device='disk'>
     <driver name='qemu' type='qcow2'/>
     <source file='/mnt/osvg/vol/ospool/controller.qcow2'/>   // 기존에 생성한 disk img
     <target dev='vda' bus='virtio'/>
     <boot order='1'/>
     <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x0'/>
   </disk>

...생략...

   <interface type='network'>                          // eth0에 해당 
     <mac address='52:54:00:4a:8d:11'/>                // 위의 management network에서 dhcp로 ip를 할당한 macaddress 설정
     <source network='managenetwork'/>
     <model type='virtio'/>
     <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
   </interface>
   <interface type='bridge'>                           // eth1에 해당, block1, object1, object2 노드는 해당 디바이스 삭제
     <mac address='52:54:00:a6:f8:42'/>                // mac address가 겹치면 안되기 때문에 알아서 수정하거나 삭제해도 무방      
     <source bridge='br0'/>
     <model type='virtio'/>
     <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>

   </interface>

 

compute, bloack1, object1, 2도 각각 설정후 define 및 실행시켜 준다.

 

[root@localhost qemu]# virsh define /etc/libvirt/qemu/controller.xml
Domain controller defined from /etc/libvirt/qemu/controller.xml

 

[root@localhost qemu]# virsh define /etc/libvirt/qemu/compute.xml
Domain compute defined from /etc/libvirt/qemu/compute.xml

 

[root@localhost qemu]# virsh define /etc/libvirt/qemu/block1.xml
Domain block1 defined from /etc/libvirt/qemu/block1.xml

 

[root@localhost qemu]# virsh define /etc/libvirt/qemu/object1.xml
Domain object1 defined from /etc/libvirt/qemu/object1.xml

 

[root@localhost qemu]# virsh define /etc/libvirt/qemu/object2.xml
Domain object2 defined from /etc/libvirt/qemu/object2.xml

 

[root@localhost qemu]# virsh list --all
 Id    Name                           State
----------------------------------------------------

 -     centos7.0                        shut off

 -     compute                        shut off
 -     controller                     shut off
 -     juho                           shut off
 -     object1                        shut off
 -     object2                        shut off

 

[root@localhost qemu]# virsh start controller
Domain controller started

 

[root@localhost qemu]# virsh start compute
Domain compute started

 

[root@localhost qemu]# virsh start block1
Domain block1 started

 

[root@localhost qemu]# virsh start object1
Domain object1 started

 

[root@localhost qemu]# virsh start object2
Domain object2 started

 

[root@localhost qemu]# virsh list --all
 Id    Name                           State
----------------------------------------------------
 4     controller                     running
 5     compute                        running
 6     block1                         running
 7     object1                        running
 8     object2                        running

 -     centos7.0                        shut off

 

[root@localhost qemu]# ping 10.0.0.11
PING 10.0.0.11 (10.0.0.11) 56(84) bytes of data.
64 bytes from 10.0.0.11: icmp_seq=1 ttl=64 time=0.193 ms
64 bytes from 10.0.0.11: icmp_seq=2 ttl=64 time=0.168 ms
^C
--- 10.0.0.11 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 999ms
rtt min/avg/max/mdev = 0.168/0.180/0.193/0.018 ms
[root@localhost ospool]# ping 10.0.0.31
PING 10.0.0.31 (10.0.0.31) 56(84) bytes of data.
64 bytes from 10.0.0.31: icmp_seq=1 ttl=64 time=0.185 ms
^C
--- 10.0.0.31 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 0.185/0.185/0.185/0.000 ms
[root@localhost ospool]# ping 10.0.0.41
PING 10.0.0.41 (10.0.0.41) 56(84) bytes of data.
64 bytes from 10.0.0.41: icmp_seq=1 ttl=64 time=0.164 ms
^C
--- 10.0.0.41 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 0.164/0.164/0.164/0.000 ms
[root@localhost ospool]# ping 10.0.0.51
PING 10.0.0.51 (10.0.0.51) 56(84) bytes of data.
64 bytes from 10.0.0.51: icmp_seq=1 ttl=64 time=0.176 ms
^C
--- 10.0.0.51 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 0.176/0.176/0.176/0.000 ms
[root@localhost ospool]# ping 10.0.0.52
PING 10.0.0.52 (10.0.0.52) 56(84) bytes of data.
64 bytes from 10.0.0.52: icmp_seq=1 ttl=64 time=0.177 ms
64 bytes from 10.0.0.52: icmp_seq=2 ttl=64 time=0.183 ms
^C
--- 10.0.0.52 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 999ms
rtt min/avg/max/mdev = 0.177/0.180/0.183/0.003 ms

 

 

 

 

 

https://kashyapc.fedorapeople.org/virt/lc-2012/snapshots-handout.html


 

 

 

 

# find . -type f -exec du -s {} \; | sort -n | tail -1
현재 폴더 이하에서 가장 큰 파일 표시

 

# find . -type f -exec perl -pi -e 's|old|new|g' {} \; 2> /dev/null     

현재 폴더 이하에서 가장 old 문자열을 가진 파일을 검색 후 new로 치환

 

# find . -exec grep -l "문자열" {} \; 2> /dev/null     

문자열 검색

 

# find . -ctime -30 -name "*" -exec rm -rf {} \;

30일 이상된 파일 삭제

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