LXC Ubuntu 16.04

From MyWiki
Revision as of 11:12, 16 March 2019 by George2 (Talk | contribs)

Jump to: navigation, search

give an lxc container a static ip address


https://tutorials.ubuntu.com/tutorial/tutorial-setting-up-lxd-1604#2

There are two repositories -    images repository  and  ubuntu repository
lxc image list images:
lxc image list ubuntu:
https://www.youtube.com/watch?v=snWp-5K2LO4
lxc exec first -- /bin/bash
iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 80 -j DNAT --to [DestinationIP:PORT]
iptables -t nat -A PREROUTING -p tcp -i eth0 --dport 587 -j DNAT  --to-destination 10.0.3.100:587
To set static ip addresses - https://medium.com/@ali_oguzhan/lxd-assigning-static-ip-to-containers-ecf558982071
autostarting containers - https://www.cyberciti.biz/faq/how-to-auto-start-lxd-containers-at-boot-time-in-linux/
 lxc launch images:centos/7 centos

Give static ip address to containers in modern version of lxd

lxc stop c1
lxc network attach lxdbr0 c1 eth0 eth0
lxc config device set c1 eth0 ipv4.address 10.99.10.42
lxc start c1