os: centos7 minimal


partition:

   Device Boot      Start         End      Blocks   Id  System

/dev/sda1   *        2048      976895      487424   83  Linux

/dev/sda2          976896    98631679    48827392   83  Linux

/dev/sda3        98631680   129880063    15624192   82  Linux swap / Solaris

/dev/sda4       129880064   488396799   179258368    5  Extended

/dev/sda5       129882112   488388607   179253248   83  Linux


network:

]# vi /etc/sysconfig/network-scripts/ifcfg-enp0s25

TYPE=Ethernet

BOOTPROTO=static

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

UUID=f5aad67b-0b2e-46b9-b17d-126c9eaae4b1

DEVICE=enp0s25

ONBOOT=yes

IPADDR=123.140.248.88

NETMASK=255.255.255.0

GATEWAY=123.140.248.254


]# vi /etc/resolv.conf

search .

nameserver 210.220.163.82


selinux:

]# vi /etc/selinux/config

SELINUX=disabled


update:

]# yum update

]# yum install net-tools

]# reboot


kvm install:

# xming install in pc

https://sourceforge.net/projects/xming/


]# yum install qemu-kvm qemu-kvm-tools libvirt virt-install virt-manager virt-viewer virt-top dejavu-lgc-sans-fonts xorg-x11-xauth wget vim

]# systemctl start libvirtd

]# systemctl enable libvirtd

]# export NO_AT_BRIDGE=1

]# alis vi=vim

]# setterm -blength 0

]# mkdir /home/isos

]# cd /home/isos

]# wget http://ftp.daumkakao.com/centos/7/isos/x86_64/CentOS-7-x86_64-Minimal-1611.iso 

]# virsh net-destroy default

]# virsh net-autostart default --disable

]# mkdir /root/rpms

]# cd /root/rpms

]# wget https://rdo.fedorapeople.org/openstack/openstack-kilo/rdo-release-kilo.rpm

]# rpm -Uvh rdo-release-kilo.rpm

]# yum install openvswitch

]# systemctl start openvswitch

]# systemctl enable openvswitch

]# vi /etc/sysconfig/network-scripts/ifcfg-ovsbr0

DEVICE=ovsbr0

ONBOOT=yes

DEVICETYPE=ovs

TYPE=OVSBridge

BOOTPROTO=static

IPADDR=192.168.100.1

NETMASK=255.255.255.0

HOTPLUG=no

ZONE=trusted


]# ifup ovsbr0

]# iptables -A POSTROUTING -s 192.168.100.0/24 -t nat -j MASQUERADE


]# vi /etc/libvirt/qemu/networks/public.xml

<network>

  <name>public</name>

  <forward mode='bridge'/>

  <bridge name='ovsbr0'/>

  <virtualport type='openvswitch'/>

</network>


]# vi /etc/libvirt/qemu/networks/private.xml

<network>

  <name>private</name>

  <forward mode='nat'/>

  <bridge name='virbr0' stp='on' delay='0'/>

  <mac address='52:54:00:e3:83:e1'/>

  <ip address='192.168.122.1' netmask='255.255.255.0'>

    <dhcp>

      <range start='192.168.122.2' end='192.168.122.254'/>

      <host mac='52:54:00:e5:22:c1' name='test-001' ip='192.168.122.2'/>

      <host mac='52:54:00:e5:22:c2' name='test-002' ip='192.168.122.3'/>

      <host mac='52:54:00:e5:22:c3' name='test-003' ip='192.168.122.4'/>

      <host mac='52:54:00:e5:22:c4' name='test-004' ip='192.168.122.5'/>

    </dhcp>

  </ip>

</network>


]# virsh net-define /etc/libvirt/qemu/networks/public.xml

]# virsh net-define /etc/libvirt/qemu/networks/private.xml

]# virsh net-start public

]# virsh net-start private

]# virsh net-autostart public

]# virsh net-autostart private


]# vi /etc/libvirt/qemu/test-001.xml

]# vi /etc/libvirt/qemu/test-002.xml

]# vi /etc/libvirt/qemu/test-003.xml

]# vi /etc/libvirt/qemu/test-004.xml

<domain type='kvm'>

  <name>test-001</name>

  <memory unit='KiB'>1048576</memory>

  <currentMemory unit='KiB'>1048576</currentMemory>

  <vcpu placement='static'>1</vcpu>

  <os>

    <type arch='x86_64' machine='pc-i440fx-rhel7.0.0'>hvm</type>

    <boot dev='hd'/>

  </os>

  <features>

    <acpi/>

    <apic/>

  </features>

  <cpu mode='custom' match='exact'>

    <model fallback='allow'>Penryn</model>

  </cpu>

  <clock offset='utc'>

    <timer name='rtc' tickpolicy='catchup'/>

    <timer name='pit' tickpolicy='delay'/>

    <timer name='hpet' present='no'/>

  </clock>

  <on_poweroff>destroy</on_poweroff>

  <on_reboot>restart</on_reboot>

  <on_crash>restart</on_crash>

  <pm>

    <suspend-to-mem enabled='no'/>

    <suspend-to-disk enabled='no'/>

  </pm>

  <devices>

    <emulator>/usr/libexec/qemu-kvm</emulator>

    <disk type='file' device='disk'>

      <driver name='qemu' type='raw'/>

      <source file='/var/lib/libvirt/images/test-001.img'/>

      <target dev='vda' bus='virtio'/>

      <address type='pci' domain='0x0000' bus='0x00' slot='0x08' function='0x0'/>

    </disk>

    <controller type='usb' index='0' model='ich9-ehci1'>

      <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x7'/>

    </controller>

    <controller type='usb' index='0' model='ich9-uhci1'>

      <master startport='0'/>

      <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x0' multifunction='on'/>

    </controller>

    <controller type='usb' index='0' model='ich9-uhci2'>

      <master startport='2'/>

      <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x1'/>

    </controller>

    <controller type='usb' index='0' model='ich9-uhci3'>

      <master startport='4'/>

      <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x2'/>

    </controller>

    <controller type='pci' index='0' model='pci-root'/>

    <controller type='virtio-serial' index='0'>

      <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>

    </controller>

    <interface type='network'>

      <mac address='52:54:00:05:d1:c1'/>

      <source network='public'/>

      <model type='virtio'/>

      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>

    </interface>

    <interface type='network'>

      <mac address='52:54:00:e5:22:c1'/>

      <source network='private'/>

      <model type='virtio'/>

      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>

    </interface>

    <serial type='pty'>

      <target port='0'/>

    </serial>

    <console type='pty'>

      <target type='serial' port='0'/>

    </console>

    <channel type='unix'>

      <target type='virtio' name='org.qemu.guest_agent.0'/>

      <address type='virtio-serial' controller='0' bus='0' port='1'/>

    </channel>

    <channel type='spicevmc'>

      <target type='virtio' name='com.redhat.spice.0'/>

      <address type='virtio-serial' controller='0' bus='0' port='2'/>

    </channel>

    <input type='tablet' bus='usb'>

      <address type='usb' bus='0' port='1'/>

    </input>

    <input type='mouse' bus='ps2'/>

    <input type='keyboard' bus='ps2'/>

    <graphics type='spice' autoport='yes'>

      <listen type='address'/>

      <image compression='off'/>

    </graphics>

    <sound model='ich6'>

      <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>

    </sound>

    <video>

      <model type='qxl' ram='65536' vram='65536' vgamem='16384' heads='1' primary='yes'/>

      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>

    </video>

    <redirdev bus='usb' type='spicevmc'>

      <address type='usb' bus='0' port='2'/>

    </redirdev>

    <redirdev bus='usb' type='spicevmc'>

      <address type='usb' bus='0' port='3'/>

    </redirdev>

    <memballoon model='virtio'>

      <address type='pci' domain='0x0000' bus='0x00' slot='0x09' function='0x0'/>

    </memballoon>

  </devices>

</domain>


]# qemu-img convert test-001.img test-002.img 

]# qemu-img convert test-001.img test-003.img 

]# qemu-img convert test-001.img test-004.img 


]# virsh define test-001.xml

]# virsh define test-002.xml

]# virsh define test-003.xml

]# virsh define test-004.xml


]# virsh start test-001

]# virsh start test-002

]# virsh start test-003

]# virsh start test-004



test-001~ test-004

]# cat /etc/sysconfig/network-scripts/ifcfg-eth0

DEVICE=eth0

ONBOOT=yes

BOOTPROTO=static

IPADDR=192.168.100.2

NETMASK=255.255.255.0

GATEWAY=192.168.100.1


]# cat /etc/sysconfig/network-scripts/ifcfg-eth1

DEVICE=eth1

BOOTPROTO=dhcp

ONBOOT=yes


]# yum remove NetworkManager


]# /usr/sbin/dhclient-script

506c506

<     make_resolv_conf

---

>     #make_resolv_conf

592c592

<             make_resolv_conf

---

>             #make_resolv_conf

608c608

<                 make_resolv_conf

---

>                 #make_resolv_conf


]# vi /etc/resolv.conf

search .

nameserver 210.220.163.82


etc

]# ovs-vsctl list-ports ovsbr0

vnet0

vnet2

vnet4

vnet6

[root@localhost qemu]# brctl show

bridge name     bridge id               STP enabled     interfaces

virbr0          8000.525400e383e1       yes             virbr0-nic

                                                        vnet1

                                                        vnet3

                                                        vnet5

                                                        vnet7




http://prolinuxhub.com/configure-start-up-scripts-for-ovs-on-centos-and-red-hat/


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

TYPE=OVSPort

BOOTPROTO=none

DEVICE=enp0s25

DEVICETYPE=ovs

ONBOOT=yes

HOTPLUG=no

OVS_BRIDGE=ovsbr0


[root@localhost ~]# cat /etc/sysconfig/network-scripts/ifcfg-ovsbr0

DEVICE=ovsbr0

ONBOOT=yes

DEVICETYPE=ovs

TYPE=OVSBridge

BOOTPROTO=static

IPADDR=123.140.248.88

NETMASK=255.255.255.0

GATEWAY=13.140.248.254

HOTPLUG=no










'Virtualization' 카테고리의 다른 글

ceph  (0) 2017.01.19
LVM2  (0) 2017.01.12

+ Recent posts