Hey, LXC beginner here. Whenever I create a container IP address is not assigned and I have tried assigning a static IP to the container. I have tried assigning it through config file
# Template used to create this container: /usr/share/lxc/templates/lxc-busybox
# Parameters passed to the template:
# Template script checksum (SHA-1): 21abc1440b73cdb95d96d5459b27c3a87df9976f
# For additional config options, please look at lxc.container.conf(5)
# Uncomment the following line to support nesting containers:
#lxc.include = /usr/share/lxc/config/nesting.conf
# (Be aware this has security implications)
lxc.net.0.type = veth
lxc.net.0.link = lxcbr0
lxc.net.0.flags = up
lxc.net.0.hwaddr = 00:16:3e:a1:a2:45
lxc.net.0.ipv4.gateway = 10.0.3.1
lxc.net.0.ipv4.address = 10.0.3.6/24
lxc.rootfs.path = dir:/var/lib/lxc/fih_lxc/rootfs
lxc.signal.halt = SIGUSR1
lxc.signal.reboot = SIGTERM
lxc.uts.name = "fih_lxc"
lxc.tty.max = 1
lxc.pty.max = 1
lxc.cap.drop = sys_module mac_admin mac_override sys_time
# When using LXC with apparmor, uncomment the next line to run unconfined:
#lxc.apparmor.profile = unconfined
lxc.mount.auto = cgroup:mixed proc:mixed sys:mixed
lxc.mount.entry = shm /dev/shm tmpfs defaults 0 0
lxc.mount.entry = /lib lib none ro,bind 0 0
lxc.mount.entry = /usr/lib usr/lib none ro,bind 0 0
lxc.mount.entry = /lib64 lib64 none ro,bind 0 0
lxc.mount.entry = /sys/kernel/security sys/kernel/security none ro,bind,optional 0 0
ifconfig
output is
enp0s31f6: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 10.209.0.124 netmask 255.255.255.0 broadcast 10.209.0.255
inet6 fe80::fd68:9c90:17b1:4656 prefixlen 64 scopeid 0x20<link>
ether 30:d0:42:f8:1c:43 txqueuelen 1000 (Ethernet)
RX packets 572678 bytes 620169154 (620.1 MB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 280336 bytes 45411659 (45.4 MB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
device interrupt 16 memory 0x70900000-70920000
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 1000 (Local Loopback)
RX packets 65852 bytes 7722713 (7.7 MB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 65852 bytes 7722713 (7.7 MB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
lxcbr0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
ether 00:16:3e:00:00:00 txqueuelen 1000 (Ethernet)
RX packets 918 bytes 159756 (159.7 KB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 193 bytes 25864 (25.8 KB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
vethG87TFQ: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet6 fe80::fced:bdff:febe:edc7 prefixlen 64 scopeid 0x20<link>
ether fe:ed:bd:be:ed:c7 txqueuelen 1000 (Ethernet)
RX packets 412 bytes 133320 (133.3 KB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 35 bytes 5066 (5.0 KB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
IP a
command
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: enp0s31f6: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
link/ether 30:d0:42:f8:1c:43 brd ff:ff:ff:ff:ff:ff
inet 10.209.0.124/24 brd 10.209.0.255 scope global dynamic noprefixroute enp0s31f6
valid_lft 25208sec preferred_lft 25208sec
inet6 fe80::fd68:9c90:17b1:4656/64 scope link noprefixroute
valid_lft forever preferred_lft forever
3: lxcbr0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
link/ether 00:16:3e:00:00:00 brd ff:ff:ff:ff:ff:ff
35: vethG87TFQ@if34: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master lxcbr0 state UP group default qlen 1000
link/ether fe:ed:bd:be:ed:c7 brd ff:ff:ff:ff:ff:ff link-netnsid 0
inet6 fe80::fced:bdff:febe:edc7/64 scope link
valid_lft forever preferred_lft forever
Let me know if there is anything else required.