관리 메뉴

소나기

Ubuntu에 Xen서버설치 후 게스트 설치 본문

연구/Software

Ubuntu에 Xen서버설치 후 게스트 설치

moyoung 2013. 9. 10. 10:36

Ubuntu에 Xen 서버를 설치가 끝났다면 

내트워크 설정을 한 후에 Guest, Domain U를 설치해 보자.



 


자꾸 오류가 나는데는 이유가 있다.

포기하지 말고 이유를 찾아 해결하도록 노력해야 한다.



우선 먼저 네트워크 설정을 해야 한다.

/etc/sysctl.conf 을 열고 아래 내용을 추가한다.

net.ipv4.ip_forward=1
net.ipv4.conf.all.rp_filter=1
net.ipv4.conf.default.proxy_arp=1
net.ipv4.icmp_echo_ignore_broadcasts=1
net.ipv6.conf.all.forwarding = 1

 /etc/xen/xend-config.sxp 을 열고 아래 내용을 활성화 시킨다.

(network-script network-bridge)
(vif-script vif-bridge)

아래 내용은 비활성화로 둔다. (#)

(network-script network-route)
(vif-script     vif-route)

/etc/network/interfaces을 열고 아래 내용을 추가한다.(본인의 아이피에 맞게 설정하도록 한다.)

#up route add -net 5.9.119.52 netmask 255.255.255.224 gw 5.9.119.51 eth0



그럼 이제 Xen 설정을 해보자.

/etc/xen-tools/xen-tools.conf을 열고 아래와 같이 수정한다(본인의 환경에 맞게 수정하라.)

# virtual disks will live here
dir = /home/xen

install-method = debootstrap

# these are the default settings for guests which you'll probably
# override when you actually create it
size    = 20Gb
memory  = 512Mb
swap    = 512Mb
fs      = ext3

# this sets all guests up to use Ubuntu 12.04
dist    = precise
image   = sparse

# the gateway IP here MUST be the IP address of your host machine,
# and the netmask and broadcast addresses should match the output
# for eth0 when you run `ifconfig`
gateway   = 5.9.119.30
netmask   = 255.255.255.224
broadcast = 5.9.119.50

# prompt for a root password when creating a guest
passwd = 1

kernel = /boot/vmlinuz-`uname -r`
initrd = /boot/initrd.img-`uname -r`
arch = amd64

# german mirror to download ubuntu, as this server is in germany
mirror = http://de.archive.ubuntu.com/ubuntu

ext3_options     = noatime,nodiratime,errors=remount-ro
ext2_options     = noatime,nodiratime,errors=remount-ro
xfs_options      = defaults
reiserfs_options = defaults
btrfs_options    = defaults

# auto boot new guests
boot = 1

serial_device = hvc0
disk_device = xvda

다음 폴더가 있는지 확인하고 없으면 생성해라.

mkdir /home/xen
cd /usr/lib/xen-tools
ln -s debian.d precise.d

이제 리부팅을 하고 게스트를 만들 준비를 한다.


게스트 만들기

# xen-create-image --hostname=guest1.example.com --ip=<additional ip>

혹은

# xen-create-image --hostname=guest1.example.com --ip=<additional ip> 
  --vcpus=2 --memory=4Gb --swap=1Gb --size=50Gb

로 새로운 이미지를 만들수 있다.

만약 boot = 1 설정을 하지 않았다면 아래와 같이 입력하면 된다.

# xm create /etc/xen/guest1.example.com.cfg

가상머신이 리부팅 되면 xm list명령어로 새로 생긴 도메인U를 확인한다.

xm list
Name                                        ID   Mem VCPUs      State   Time(s)
Domain-0                                     0 31007     8     r-----   3624.8
guest1.example.com                           2  4096     2     -b----    13.4

작업이 모두 끝나면 아래와 같이 IP를 이용해서 SSH접속을 할 수 있다.

# ssh root@<guest ip>

만약 작동하지 않는다면 아래와 같이 게스트에 연결한다.

# xm console guest1.example.com



Comments