2016년 4월 14일 목요일

스트라이핑이란?

스트라이핑 스트라이핑은 성능 향상을 위해 단일 파일과 같은 논리적으로 연속된 데이터 세그먼트들이, 물리적으로 여러 개의 장치, 즉 디스크 드라이브 등에 라운드로빈 방식으로 나뉘어 기록될 수 있는 것이다. 이것은 만약 프로세서가, 하나의 디스크에서 공급하거나 또는 받아들일 수 있는 것보다 더 빠르게 데이터를 읽거나 쓸 수 있는 능력이 있다면, 이러한 방식은 매우 유용한 기술이 된다. 데이터는 여러 개의 드라이브에 걸쳐 일정크기의 바이트 또는 섹터별로 나뉘어 기록된다. 예를 들면, 서로 겹쳐서 읽거나 쓸 수 있도록 설계된 네 개의 드라이브가 있다면, 보통 하나의 섹터를 읽을 수 있는 시간에 네 개의 섹터를 동시에 읽을 수 있다. 스트라이핑은 사이베이스와 같은 일부 데이터베이스와, IBM의 RAMAC 어레이 서브시스템과 같이 하드웨어의 제어 하에 있는 RAID 장치들에서 사용된다. 디스크 스트라이핑, 그 자체가 본래부터 고장에 대비하거나 에러를 체크하는 기능을 제공하는 것은 아니며, 다만 그러한 기능들은 여러 가지 다른 방식들과 함께 사용될 때 비로소 발휘된다. 스트라이핑은 미러링과는 다르지만, 그것과 함께 사용될 수는 있다.

2016년 4월 11일 월요일

CentOS 7 고정 IP 할당방법

환경
base OS          centOS 7
vmware           VmwareWorkstation pro12


Virtual Machine Settings -> Network Adapter -> NAT로 체크 OK 누름

시작


Network 정지
#service network stop

NetworkManager 정지 및 부팅시 off로 설정

#systemctl stop NetworkManager
#systemctl disable NetworkManager

NetworkManager 상태확인
#systemctl status NetworkManager

경로 이동
#cd /etc/sysconfig/network-scripts

하위파일 탐색
#ls
ifcfg-eno16777736  ifdown-ppp       ifup-ib      ifup-Team
ifcfg-lo           ifdown-routes    ifup-ippp    ifup-TeamPort
ifdown             ifdown-sit       ifup-ipv6    ifup-tunnel
ifdown-bnep        ifdown-Team      ifup-isdn    ifup-wireless
ifdown-eth         ifdown-TeamPort  ifup-plip    init.ipv6-global
ifdown-ib          ifdown-tunnel    ifup-plusb   network-functions
ifdown-ippp        ifup             ifup-post    network-functions-ipv6
ifdown-ipv6        ifup-aliases     ifup-ppp
ifdown-isdn        ifup-bnep        ifup-routes
ifdown-post        ifup-eth         ifup-sit
// 대부분 eth0 이나 eth1일 것임

vmware에서 edit -> virtual Network Editor -> NAT settings 에 보면 subnet mask와
Gateway ip를 볼 수 있다 subnet ip가 (192.168.33.0)이라면 33번대역을 가지므로
192.168.33.xxx로 ip를 설정

이더넷 장치파일을 열고 알맞게 수정
#vi ifcfg-eno16777736
TYPE=Ethernet
BOOTPROTO=static
DEVICE=eno16777736
ONBOOT=yes
IPADDR=192.168.17.155
NETMASK=255.255.255.0
DNS1=8.8.8.8
GATEWAY=192.168.17.2     

네트워크 재시작
#service network restart

핑 확인
#ping 8.8.8.8

ip확인
#ip a
                    





2016년 4월 7일 목요일

CentOS 7 DHCP Server & Client 설치 및 설정

환경
Base OS          CentOS 7
DHCP version   4.2.5
IP                  192.168.17.210
GATEWAY       192.168.17.2
Hostname       sungsik.mirhenge.com
root계정으로 진행

선행작업
1. 먼저 IP할당을 static으로 바꿔놓는다. (설정법은 나중에 설명)

2. NetworkManager를 끄고 부팅시 off 상태로 만든다.
#systemctl stop NetworkManager
#systemctl disable NetworkManager

3. Virtual Machine Settings에 들어가 Network Adapter부분에
   Custom:specific virtual network 체크한 후 VMnet8(NAT) 로 설정한다

4. vmware workstation의 Edit->Virtual Network Editor->Change Settings->예->
  VMnet8 클릭-> Use local DHCP service to distribute IP address to VMs 체크해제
 ->상단 VMnet8 부분에 DHCP가 - 된것을 확인후 OK누른다

DHCP Server 설치 및 설정


DHCP package 가 설치되었는지 확인
# rpm -qa | grep dhcp
dhcp-common-4.2.5-42.el7.centos.x86_64   // 기본으로 
dhcp-libs-4.2.5-42.el7.centos.x86_64          // 2가지가 보일 것이다.

DHCP package 설치
#yum -y install dhcp
패키지가 설치 될 것임 complete가 뜰 때까지 기달린다

DHCP package 설치확인
#rpm -qa | grep dhcp
dhcp-4.2.5-42.el7.centos.x86_64
dhcp-common-4.2.5-42.el7.centos.x86_64
dhcp-libs-4.2.5-42.el7.centos.x86_64

DHCP 예비설정 파일을 올바른 경로로 옮긴다
 #cp /usr/share/doc/dhcp-4.2.5/dhcpd.conf.example  /etc/dhcp/dhcpd.conf

/etc/dhcp에 dhcpd.conf가 제대로 옮겼는지 확인
 #ls /etc/dhcp
dhclient.d  dhcpd6.conf  dhcpd.conf ->바로 이파일!!
//dhcpd.conf파일은 DHCP server가 host들에게 할당하는 IP범위 지정,DNS로 지정할       //domain name과 domain name server
//(domain name -> sungsik          domain name server -> sungsik.mirhenge.com)
//최소 IP할당 시간,최대 IP 할당 시간 등 DHCP서버의 동작을 설정하는 파일이다

dhcpd.conf파일을 연다
 #vi /etc/dhcp/dhcpd.conf
# dhcpd.conf
#
# Sample configuration file for ISC dhcpd
#

# option definitions common to all supported networks...

option domain-name "example.org";
option domain-name-servers ns1.example.org, ns2.example.org;

default-lease-time 600;

max-lease-time 7200;

# Use this to enble / disable dynamic dns updates globally.

#ddns-update-style none;

.........    (넘 기니까 중간 생략....

...........     이런 환경으로 하고 싶으면 이것만 설정하고 저런 환경으로 하고 싶으면 저것만
...........     설정해라 라는 예시이다. 중간에 #이 아닌 부분이 있는데 수정하지 말고 내비둔다             아무 문제 발생안함.)

shared-network 224-29 {

  subnet 10.17.224.0 netmask 255.255.255.0 {
    option routers rtr-224.example.org;
  }
  subnet 10.0.29.0 netmask 255.255.255.0 {
    option routers rtr-29.example.org;
  }
  pool {
    allow members of "foo";
    range 10.17.224.10 10.17.224.250;
  }
  pool {
    deny members of "foo";
    range 10.0.29.10 10.0.29.230;
  }

}

dhcpd.conf파일 수정(파란색 부분 = 수정     검붉은 부분 = 추가)
# Sample configuration file for ISC dhcpd
#

# option definitions common to all supported networks...
option domain-name "mirhenge.com";
option domain-name-servers sungsik.mirhenge.com;

default-lease-time 600;
max-lease-time 7200;
authoritative; 
subnet 192.168.17.0 netmask 255.255.255.0{                                     
option routers  192.168.17.1;   -> ex) 자신의 IP주소가
option subnet-mask 255.255.255.0;     192.168.39.145 이런 형식이면은 router는
                                  192.168.39.1
option domain-search "mirhenge.com";    145 -> 1 로바꾼다
option domain-name-servers 192.168.17.210;  ->도메인서버의 ip를 쓰면 된다.
option broadcast-address 192.168.17.255;      ex) 자신의 IP주소가 192.168.39.145 이런                                                                                                                                           주소면  broadcast주소는 192.168.39.255  
option time-offset -18000;                                145->255     
                                                                                                     
range 192.168.17.212 192.168.17.220;      -> 임의로 IP할당 범위를 min 에서 max 까지 지                                                     
  }                                                        정해줌 본인은 212~220 까지 범위를 준 것
host station1{                                        ->특정 컴퓨터에게 고정IP를 넣어주는 부분
option host-name "station1.example.com";         
hardware ethernet 00:0c:29:69:bc:77;          -> 특정 컴퓨터의 맥주소 넣는다
fixed-address 192.168.17.220;            -> range 범위에서 가장 끝 ip주소를 넣는다
}

              // 이 뒤에 나오는 복잡한 영어는 안 건드려도 된다 #이 안붙은 것도 무시 가능!!
              (단 지우진 마세요)

# Use this to enble / disable dynamic dns updates globally.
#ddns-update-style none;

# If this DHCP server is the official DHCP server for the local
# network, the authoritative directive should be uncommented.
#authoritative;

# Use this to send dhcp log messages to a different log file (you also
# have to hack syslog.conf to complete the redirection).
log-facility local7;

# No service will be given on this subnet, but declaring it helps the 
# DHCP server to understand the network topology.

subnet 10.152.187.0 netmask 255.255.255.0 {
}

# This is a very basic subnet declaration.

subnet 10.254.239.0 netmask 255.255.255.224 {
  range 10.254.239.10 10.254.239.20;
  option routers rtr-239-0-1.example.org, rtr-239-0-2.example.org;
}

# This declaration allows BOOTP clients to get dynamic addresses,
# which we don't really recommend.

subnet 10.254.239.32 netmask 255.255.255.224 {
  range dynamic-bootp 10.254.239.40 10.254.239.60;
  option broadcast-address 10.254.239.31;
  option routers rtr-239-32-1.example.org;
}

# A slightly different configuration for an internal subnet.
subnet 10.5.5.0 netmask 255.255.255.224 {
  range 10.5.5.26 10.5.5.30;
  option domain-name-servers ns1.internal.example.org;
  option domain-name "internal.example.org";
  option routers 10.5.5.1;
  option broadcast-address 10.5.5.31;
  default-lease-time 600;
  max-lease-time 7200;
}

# Hosts which require special configuration options can be listed in
# host statements.   If no address is specified, the address will be
# allocated dynamically (if possible), but the host-specific information
# will still come from the host declaration.

host passacaglia {
  hardware ethernet 0:0:c0:5d:bd:95;
  filename "vmunix.passacaglia";
  server-name "toccata.fugue.com";
}

# Fixed IP addresses can also be specified for hosts.   These addresses
# should not also be listed as being available for dynamic assignment.
# Hosts for which fixed IP addresses have been specified can boot using
# BOOTP or DHCP.   Hosts for which no fixed address is specified can only
# be booted with DHCP, unless there is an address range on the subnet
# to which a BOOTP client is connected which has the dynamic-bootp flag
# set.
host fantasia {
  hardware ethernet 08:00:07:26:c0:a5;
  fixed-address fantasia.fugue.com;
}

# You can declare a class of clients and then do address allocation
# based on that.   The example below shows a case where all clients
# in a certain class get addresses on the 10.17.224/24 subnet, and all
# other clients get addresses on the 10.0.29/24 subnet.

class "foo" {
  match if substring (option vendor-class-identifier, 0, 4) = "SUNW";
}

shared-network 224-29 {
  subnet 10.17.224.0 netmask 255.255.255.0 {
    option routers rtr-224.example.org;
  }
  subnet 10.0.29.0 netmask 255.255.255.0 {
    option routers rtr-29.example.org;
  }
  pool {
    allow members of "foo";
    range 10.17.224.10 10.17.224.250;
  }
  pool {
    deny members of "foo";
    range 10.0.29.10 10.0.29.230;
  }
}

수정한 dhcpd.conf 저장 후 닫는다.
아시죠?  esc 누르고 :wq

Network 재시작
#service network restart

DHCP서비스를 시작한다
#systemctl start dhcpd
● dhcpd.service - DHCPv4 Server Daemon
   Loaded: loaded (/usr/lib/systemd/system/dhcpd.service; enabled; vendor preset: disabled)
   Active: active (running) since Thu 2016-04-07 22:53:17 PDT; 28s ago
     Docs: man:dhcpd(8)
           man:dhcpd.conf(5)
 Main PID: 7985 (dhcpd)
   Status: "Dispatching packets..."
   CGroup: /system.slice/dhcpd.service
           └─7985 /usr/sbin/dhcpd -f -cf /etc/dhcp/dhcpd.conf -user dhcpd -group dhcpd --no-pid

Apr 07 22:53:17 sungsik.mirhenge.com dhcpd[7985]: No subnet declaration for virbr0 (192.168.122.1).
Apr 07 22:53:17 sungsik.mirhenge.com dhcpd[7985]: ** Ignoring requests on virbr0.  If this is not what
Apr 07 22:53:17 sungsik.mirhengser.com dhcpd[7985]:    you want, please write a subnet declaration
Apr 07 22:53:17 sungsik.mirhenge.com dhcpd[7985]:    in your dhcpd.conf file for the network segment
Apr 07 22:53:17 sungsik.mirhenge.com dhcpd[7985]:    to which interface virbr0 is attached. **
Apr 07 22:53:17 sungsik.mirhenge.com dhcpd[7985]: 
Apr 07 22:53:17 sungsik.mirhenge.com dhcpd[7985]: Listening on LPF/eno16777736/00:0c:29:69:bc:77/192.168.17.0/24
Apr 07 22:53:17 sungsik.mirhenge.com dhcpd[7985]: Sending on   LPF/eno16777736/00:0c:29:69:bc:77/192.168.17.0/24
Apr 07 22:53:17 sungsik.mirhenge.com dhcpd[7985]: Sending on   Socket/fallback/fallback-net
Apr 07 22:53:17 sungsik.mirhenge.com systemd[1]: Started DHCPv4 Server Daemon.

DHCP서비스를 부팅시 자동온 설정한다
#systemctl enable dhcpd
Created symlink from /etc/systemd/system/multi-user.target.wants/dhcpd.service to /usr/lib/systemd/system/dhcpd.service.

네트워크 재시작
#service network restart
Restarting network (via systemctl):                        [  OK  ]


DHCP Client 설정

기본적으로 CentOS 7은 DHCP Client가 깔려있음

 Virtual Machine Settings에 들어가 Network Adapter부분에
   Custom:specific virtual network 체크한 후 VMnet8(NAT) 로 설정한다

 vmware NetworkManager 종료와 부팅시 off 설정
#systemctl stop NetworkManager
#systemctl disable NetworkManager

/etc/sysconfig/network-scripts로 경로이동
#cd /etc/sysconfig/network-scripts 

ls로 이더넷 장치 확인
#ls
ifcfg-eno16777736  ifdown-ppp       ifup-ib      ifup-Team
ifcfg-lo           ifdown-routes    ifup-ippp    ifup-TeamPort
ifdown             ifdown-sit       ifup-ipv6    ifup-tunnel
ifdown-bnep        ifdown-Team      ifup-isdn    ifup-wireless
ifdown-eth         ifdown-TeamPort  ifup-plip    init.ipv6-global
ifdown-ib          ifdown-tunnel    ifup-plusb   network-functions
ifdown-ippp        ifup             ifup-post    network-functions-ipv6
ifdown-ipv6        ifup-aliases     ifup-ppp
ifdown-isdn        ifup-bnep        ifup-routes

ifdown-post        ifup-eth         ifup-sit
필자는 eno16777736으로 잡혀있음   아마 대부분은 eth0이나 eth1일 것임

ifcfg-eno16777736수정
#vi ifcfg-eno16777736
TYPE=Ethernet              
BOOTPROTO=dhcp
DEVICE=eno16777736
ONBOOT=yes
NAME=eno16777736
GATEWAY=192.168.17.2
NETMASK=255.255.255.0
DNS=8.8.8.8
// 요런식으로 수정해준다. 


network를 재시작한다
#service network restart
Restarting network (via systemctl):                        [  OK  ]


ip a 명령어로 DHCP Server에서 dhcpd.conf 파일에 설정한 range 부분에 설정한 범위에
맞게 ethernet 장치에 IP 가 들어갔는지 확인한다. (필자는 192.168.17.211~192.168.17.220)
#ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 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
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: eno16777736: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
    link/ether 00:0c:29:e8:1f:cb brd ff:ff:ff:ff:ff:ff
    inet 192.168.17.212/24 brd 192.168.17.255 scope global dynamic eno16777736
       valid_lft 378sec preferred_lft 378sec
    inet6 fe80::20c:29ff:fee8:1fcb/64 scope link 
       valid_lft forever preferred_lft forever
3: virbr0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN 
    link/ether 52:54:00:db:d5:bd brd ff:ff:ff:ff:ff:ff
    inet 192.168.122.1/24 brd 192.168.122.255 scope global virbr0
       valid_lft forever preferred_lft forever
4: virbr0-nic: <BROADCAST,MULTICAST> mtu 1500 qdisc pfifo_fast master virbr0 state DOWN qlen 500
    link/ether 52:54:00:db:d5:bd brd ff:ff:ff:ff:ff:ff


ping을 통해 제대로 패킷을 주고 받는지 확인한다
#ping 8.8.8.8
PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.
64 bytes from 8.8.8.8: icmp_seq=1 ttl=128 time=76.0 ms
64 bytes from 8.8.8.8: icmp_seq=2 ttl=128 time=80.8 ms
64 bytes from 8.8.8.8: icmp_seq=3 ttl=128 time=78.0 ms
64 bytes from 8.8.8.8: icmp_seq=4 ttl=128 time=74.4 ms
64 bytes from 8.8.8.8: icmp_seq=5 ttl=128 time=95.2 ms
64 bytes from 8.8.8.8: icmp_seq=6 ttl=128 time=81.9 ms
^C
--- 8.8.8.8 ping statistics ---
6 packets transmitted, 6 received, 0% packet loss, time 5018ms
rtt min/avg/max/mdev = 74.481/81.094/95.282/6.844 ms
// 핑 테스트 종료는 Ctrl+c 

여기까지 제대로 되었다면 DHCP Server 구축 및 운영에 성공한 것
















HOSTNAME 지정 및 세팅법

도메인지정
(1) vi /etc/hosts

192.168.17.210 sungsik sungsik.mirhenge.com
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6

호스트네임 세팅
(2) hostnamectl set-hostname sungsik.mirhenge.com

hostname검색 시 sungsik만 나오게
hostname --fqdn

변경확인
(3) hostname
(4) ping sungsik
(5) ping sungsik.com 확인