Linu X Containers What is LXCLinu X Containers

  • Slides: 14
Download presentation
Linu. X Containers

Linu. X Containers

What is LXC(Linu. X Containers)? X 리소스 소비량이 극히 적고 속도가 빠르다 OS(커널) LXC

What is LXC(Linu. X Containers)? X 리소스 소비량이 극히 적고 속도가 빠르다 OS(커널) LXC 1 LXC 2 LXC 3 LXC 4 LXC 5 LXC 6 LXC 7 LXC 8 LXC 9 LXC 10 User SPACE OS(커널)

LXC Install $ > sudo aptitude install lxc The following NEW packages will be

LXC Install $ > sudo aptitude install lxc The following NEW packages will be installed: bridge-utils{a} cloud-image-utils{a} debootstrap{a} distro-info{a} genisoimage{a} libaio 1{a} libboost-random 1. 58. 0{a} libboost-system 1. 58. 0{a} libboost-thread 1. 58. 0{a} libiscsi 2{a} libnspr 4{a} libnss 3 -nssdb{a} libpam-cgfs{a} librados 2{a} librbd 1{a} lxc-templates{a} lxc 1{a} python 3 -lxc{a} qemu-block-extra{a} qemu-utils{a} sharutils{a} 0 packages upgraded, 23 newly installed, 0 to remove and 7 not upgraded. Need to get 6, 806 k. B of archives. After unpacking 26. 0 MB will be used. Do you want to continue? [Y/n/? ] y

lxc-create - Step-by-Step 으로 만들기 root $ > lxc-create --template download --name nexgfw -

lxc-create - Step-by-Step 으로 만들기 root $ > lxc-create --template download --name nexgfw - 한번에 만들기 root $ > lxc-create -t download -n nexgfw -- -d ubuntu -r zesty -a amd 64 - 컨테이너 저장 위치 root lxc 1 root bin dev $ > ls /var/lib/lxc 2 lxc 3 lxc 4 lxc 5 lxc 6 lxc 7 lxc 8 lxc 9 lxc 10 nexgfw $ > ls /var/lib/lxc 1 etc init lib 32 linuxrc mnta opt ramdb sbin home lib 64 mntb proc root sys $ > ls /var/lib/lxc 2 etc init lib 32 linuxrc mnta opt ramdb sbin home lib 64 mntb proc root sys tmp usr var

lxc-destory root $ > lxc-destroy --name nexgfw

lxc-destory root $ > lxc-destroy --name nexgfw

lxc-start root $ > lxc-start --name nexgfw

lxc-start root $ > lxc-start --name nexgfw

lxc-stop root $ > lxc-stop --name nexgfw

lxc-stop root $ > lxc-stop --name nexgfw

lxc-ls root $ > lxc-ls –fancy NAME STATE AUTOSTART GROUPS IPV 4 IPV 6

lxc-ls root $ > lxc-ls –fancy NAME STATE AUTOSTART GROUPS IPV 4 IPV 6 nexgfw STOPPED 0 - -

lxc-info root $ > lxc-info --name nexgfw Name: nexgfw State: RUNNING PID: 29352 IP:

lxc-info root $ > lxc-info --name nexgfw Name: nexgfw State: RUNNING PID: 29352 IP: 10. 0. 3. 156 CPU use: 0. 27 seconds Blk. IO use: 60. 00 Ki. B Memory use: 13. 32 Mi. B KMem use: 0 bytes Link: veth 9 LDQI 2 TX bytes: 1. 34 Ki. B RX bytes: 7. 92 Ki. B Total bytes: 9. 27 Ki. B

lxc-attach root $ > lxc-attach --name nexgfw root@nexgfw: ~#

lxc-attach root $ > lxc-attach --name nexgfw root@nexgfw: ~#

lxc-console root $ > lxc-console --name lxc 1 Connected to tty 1 Type <Ctrl+a

lxc-console root $ > lxc-console --name lxc 1 Connected to tty 1 Type <Ctrl+a q> to exit the console, <Ctrl+a> to enter Ctrl+a itself Ubuntu 17. 04 u 1 pts/0 nexgfw login: poplinux Password: Last login: Wed May 17 09: 58: 46 UTC 2017 from 10. 0. 3. 1 on pts/4 dpkg-query: no packages found matching curl Welcome to Ubuntu 17. 04 (GNU/Linux 4. 4. 0 -78 -generic x 86_64) * Documentation: https: //help. ubuntu. com * Management: https: //landscape. canonical. com * Support: https: //ubuntu. com/advantage poplinux@lxc 1: ~$

외부에서 lxc 에 직접 접속하고 싶다면? (Over. View) Server (Ubuntu 16. 04) enp 2

외부에서 lxc 에 직접 접속하고 싶다면? (Over. View) Server (Ubuntu 16. 04) enp 2 s 0 (physical dev) lxc-1 $ > cat /etc/network/interfaces auto eth 0 iface eth 0 inet static address 10. 100. 4. 20 netmask 255. 0 network 10. 100. 4. 0 broadcast 10. 100. 4. 255 gateway 10. 100. 4. 254 dns-nameservers 8. 8 lxc-2 $ > cat /etc/network/interfaces auto eth 0 iface eth 0 inet static address 10. 100. 4. 30 netmask 255. 0 network 10. 100. 4. 0 broadcast 10. 100. 4. 255 gateway 10. 100. 4. 254 dns-nameservers 8. 8 $ > cat /etc/network/interfaces auto enp 2 s 0 iface enp 2 s 0 inet manual br 0 (logical dev) $ > cat /etc/network/interfaces auto br 0 iface br 0 inet static address 10. 100. 4. 13 netmask 255. 0 network 10. 100. 4. 0 broadcast 10. 100. 4. 255 gateway 10. 100. 4. 254 dns-nameservers 8. 8 bridge-ifaces enp 2 s 0 bridge-ports enp 2 s 0 up ifconfig enp 2 s 0 up 서버(1) $ > ping 10. 100. 4. 13 => OK $ > ping 10. 100. 4. 20 => OK $ > ping 10. 100. 4. 30 => OK