Pegasi Wiki

This wiki acts as a memo for our own work so why not share them? Feel free to browse and use out notes and leave a note while at it.

Deployment of virtual template to server

Copy image

Copy image from start template to the new guest disk.

Find out the right disk LUN from NAS and copy (replace NN with LUN):

dd if=/dev/disk/by-path/ip-192.168.120.28\:3260-iscsi-iqn.2004-04.com.qnap\:ts-459uplus\:iscsi.pegasi.cf8790-lun-15 of=/dev/disk/by-path/ip-192.168.120.28\:3260-iscsi-iqn.2004-04.com.qnap\:ts-459uplus\:iscsi.pegasi.cf8790-lun-NN bs=128k

Copy configuration

virsh dumpxml start.pegasi.fi > uusikone.pegasi.fi.xml

Edit the file and change:

  • name
  • uuid
  • source dev
  • mac address x 2
  • channel name start → <virtual host name>
virsh define uusikone.pegasi.fi.xml

(ip and mac)

Edit guest OS

virsh start uusikone.pegasi.fi --console

Log in to the guest and change

  • /etc/hostname
  • /etc/hosts
  • /etc/sysconfig/network
  • /etc/sysconfig/network-scripts/ifcfg-eth0 (ip and mac)
  • /etc/sysconfig/network-scripts/ifcfg-eth1 (ip and mac)
  • /etc/sysconfig/network-scripts/route-eth0
  • /etc/sysconfig/network-scripts/route-eth1
  • /etc/sysconfig/network-scripts/rule-eth0
  • /etc/sysconfig/network-scripts/rule-eth1
:%s/192.168.150.30/192.168.150.NN/g
:%s/193.64.134.30/193.64.134.NN/g

Ping ip address to check it is not taken.

Route tables

Add internal and external to /etc/iproute2/rt_tables

1       internal
2       public

Add internal and external routes to /etc/sysconfig/network-scripts/route-ethN

$NETWORK dev $DEVICE src $IPADDRESS table public
default via $DEFAULT_GW dev $DEVICE table public
$NETWORK dev $DEVICE src $IPADDRESS table internal
default via $DEFAULT_GW dev $DEVICE table internal

Add internal and external rules to /etc/sysconfig/network-scripts/route-ethN

from $IPADDRESS table internal

Add a bridged interface to guest

A configured and working bridge device must exist to do this.

Bring the interface down

ifdown xxx

Add a bridge to the host

Edit the interface ifcfg init file:

cd /etc/sysconfig/network-scripts
cp -a ifcfg-xxx /root/
vim ifcfg-xxx

Remove lines:

IPADDR=x.x.x.x
PREFIX=x

Add lines to the end of the file:

NM_CONTROLLED=no
BRIDGE=brN

Add a new configuration file for the bridge

vim ifcfg-brN

Add lines (copy the IP address and mask from the original)

DEVICE=brN
ONBOOT=yes
IPADDR=x.x.x.x
PREFIX=x
TYPE=Bridge
NM_CONTROLLED=no
STP=off

Set selinux context

First check the current contexts and copy the right one from there

ls -alZ

Then set it

chcon system_u:object_r:net_conf_t:s0 ifcfg-brN 

Fire up the interface and the bridge

I think you only need to fire up the bridge but I did both

ifup brN
ifup xxx

Add the interface to guest

List existing network devices of a domain first

virsh domiflist <domain>

From there copy the correct values and add an existing bridge to a domain

virsh attach-interface dental.pegasi.fi bridge br3 --mac 52:54:00:87:75:04 --model rtl8139 --live --config

Leave a comment

Enter your comment:
V A L W P
 

  //check if we are running within the DokuWiki environment if (!defined("DOKU_INC")){ die(); } //place the needed HTML source codes BELOW this line