User Tools

Site Tools


docs:tips_n_tricks:xen.html

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
docs:tips_n_tricks:xen.html [16.04.2022 18:41 CEST] – [Further reading] peterdocs:tips_n_tricks:xen.html [13.08.2022 23:36 CEST] (current) – [Create new DomU] peter
Line 21: Line 21:
 ===== Create new DomU ===== ===== Create new DomU =====
 //Assuming, you have a bridge //xenbr0// up and running on your Dom0 with 10.1.0.1 beeing the outbound gateway and a disk partitioning scheme defined in// ''/etc/xen-tools/partitions.d/my-disk-set'' //Assuming, you have a bridge //xenbr0// up and running on your Dom0 with 10.1.0.1 beeing the outbound gateway and a disk partitioning scheme defined in// ''/etc/xen-tools/partitions.d/my-disk-set''
 +
 +  * create ''/etc/xen-tools/skel/root/.ssh/authorized_keys''
 +  * run ''create_guest.sh //<name>//''
  
 <code bash create_guest.sh> <code bash create_guest.sh>
Line 52: Line 55:
 </code> </code>
  
 +<code authorized_keys /etc/xen-tools/skel/root/.ssh/authorized_keys>
 +# replace 202204260000 by some day in the near future and add your own sshkey
 +expiry-time="202204260000" ssh-rsa AAAAB3N...
 +</code>
 +
 +===== Matching physical and virtual Xen block (and other) devices and eventually their ids =====
 +
 +  xenstore-ls -f -s /local/domain/0/backend/vbd | egrep '(domain|frontend|dev|params) = ' 
 +
 +
 +__References:__
 +
 +  * [[https://serverfault.com/a/259112|ukautz' answer]] to question [[https://serverfault.com/questions/153196/xen-find-vbd-id-for-physical-disks|"Xen find VBD id for physical disks" on Server Fault]].
 +  * https://xenbits.xen.org/docs/4.9-testing/man/xenstore-ls.1.html
 ===== Turn a domU into a new dom0 running with serial console ===== ===== Turn a domU into a new dom0 running with serial console =====
  
Line 92: Line 109:
 mkdir /GRUB0 mkdir /GRUB0
 mount LABEL="$HOSTNAME:GRUB0" /GRUB0/ mount LABEL="$HOSTNAME:GRUB0" /GRUB0/
-grub-install --boot-directory /GRUB0 /dev/sdb +grub-install --boot-directory /GRUB0 --recheck /dev/sdb 
-grub-install --boot-directory /GRUB0 /dev/sda+grub-install --boot-directory /GRUB0 --recheck /dev/sda
 </code> </code>
 <code grub /GRUB0/grub/grub.cfg> <code grub /GRUB0/grub/grub.cfg>
Line 164: Line 181:
  
 dhcp        = 'dhcp' dhcp        = 'dhcp'
-vif         = [ 'bridge=xenbr0,vifname=eth0,mac=00:16:3e:XX:XX:XX' ]+vif         = [ 'bridge=xenbr0,vifname=vif.oddom0.0,mac=00:16:3e:XX:XX:XX' ]
 </code> </code>
 ==== Attach network to domU ==== ==== Attach network to domU ====
Line 189: Line 206:
  
 to ''/etc/default/grub'' to ''/etc/default/grub''
 +<note warning>If you install GRUB from the new Dom0, make sure no outdated ''device.map'' is lying around. Best use the ''--recheck'' option to ''grub-install''</note>
 Manual steps: Manual steps:
 <code bash> <code bash>
Line 217: Line 234:
   sysctl -w net.ipv4.conf.all.forwarding=1   sysctl -w net.ipv4.conf.all.forwarding=1
  
 +=== Make network card names persistent with your own (traditional) naming scheme ===
 +//In domU connected to external interface//
 +== The ifupdown way ==
 +  * Give parameeter ''net.ifnames=0'' to the kernel at boot time 
 +  * Use ''mac/xx.xx.xx.xx.xx.xx.xx=eth0'' in ''/etc/network/interfaces''
 +<code interfaces /etc/network/interfaces.d/ifrename>
 +rename mac/00:16:3e:XX:XX:XX=vif0
 +# rename mac/aa:bb:cc:??:??:??=eth0 # use this if you expect the network card to be replaced by another one of same type
 +rename mac/aa:bb:cc:dd:ee:ff=eth0
 +</code>
 +== The systemd way ==
 +<code properties /etc/systemd/network/10-persistent-eth0.link>
 +# https://wiki.debian.org/NetworkInterfaceNames
 +[Match]
 +MACAddress=aa:bb:cc:dd:ee:ff
 +
 +[Link]
 +Name=eth0
 +</code>
 +
 +<code properties /etc/systemd/network/11-persistent-vif0.link>
 +# https://wiki.debian.org/NetworkInterfaceNames
 +[Match]
 +MACAddress=00:16:3e:XX:XX:XX
 +
 +[Link]
 +Name=vif0
 +</code>
 +=== Use persistent name in /etc/network/interfaces ===
 +
 +<code interfaces /etc/network/interfaces.d/vif0>
 +auto vif0
 +iface vif0 inet static
 + address 10.1.0.1
 + netmask 255.255.255.0
 +</code>
 ==== Allow ssh root login ==== ==== Allow ssh root login ====
 <code text /etc/ssh/sshd_config> <code text /etc/ssh/sshd_config>
docs/tips_n_tricks/xen.html.1650127309.txt.gz · Last modified: 16.04.2022 18:41 CEST by peter

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki