Próbáltam egy centos7 konténert is, belül állítottam be az IP-t, mert a DHCP mintha nem menne (dnsmasq):
* hoszton:
sudo systemctl status lxc-net
● lxc-net.service - LXC network bridge setup
Loaded: loaded (/usr/lib/systemd/system/lxc-net.service; enabled; vendor preset: disabled)
Active: active (exited) since Tue 2021-05-11 07:58:01 CEST; 16min ago
Docs: man:lxc
Main PID: 5891 (code=exited, status=0/SUCCESS)
Tasks: 1 (limit: 6999)
Memory: 2.3M
CGroup: /system.slice/lxc-net.service
└─6028 dnsmasq --conf-file=/etc/lxc/dnsmasq.conf -s lxc -S /lxc/ -u dnsmasq --strict-order --bind-interfaces --pid-file=/run/lxc/dnsmasq.pid --listen-address 10.0.3.1 --dhcp-range 10.0.3.2,10.0.3.254 --dhcp-lease-max=253 --d>
máj 11 07:58:01 fedora-nb dnsmasq[6028]: started, version 2.85 cachesize 150
máj 11 07:58:01 fedora-nb dnsmasq[6028]: compile time options: IPv6 GNU-getopt DBus no-UBus no-i18n IDN2 DHCP DHCPv6 no-Lua TFTP no-conntrack ipset auth cryptohash DNSSEC loop-detect inotify dumpfile
máj 11 07:58:01 fedora-nb dnsmasq-dhcp[6028]: DHCP, IP range 10.0.3.2 -- 10.0.3.254, lease time 1h
máj 11 07:58:01 fedora-nb dnsmasq-dhcp[6028]: DHCP, sockets bound exclusively to interface lxcbr0
máj 11 07:58:01 fedora-nb dnsmasq[6028]: using only locally-known addresses for domain lxc
máj 11 07:58:01 fedora-nb dnsmasq[6028]: reading /etc/resolv.conf
máj 11 07:58:01 fedora-nb dnsmasq[6028]: using only locally-known addresses for domain lxc
máj 11 07:58:01 fedora-nb dnsmasq[6028]: using nameserver 127.0.0.53#53
máj 11 07:58:01 fedora-nb dnsmasq[6028]: read /etc/hosts - 9 addresses
máj 11 07:58:01 fedora-nb systemd[1]: Finished LXC network bridge setup.
* centos7 konténer:
$ cat /etc/resolv.conf
nameserver 8.8.8.8
nameserver 192.168.1.254
$ cat /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
BOOTPROTO=none
ONBOOT=yes
HOSTNAME=centos7
NM_CONTROLLED=no
TYPE=Ethernet
MTU=
DHCP_HOSTNAME=centos7
IPADDR=10.0.3.100
PREFIX=24
GATEWAY=10.0.3.1
DNS1=8.8.8.8
DNS2=192.168.1.254
DEFROUTE=yes
$ ping 8.8.8.8
PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.
64 bytes from 8.8.8.8: icmp_seq=1 ttl=54 time=762 ms
64 bytes from 8.8.8.8: icmp_seq=2 ttl=54 time=25.1 ms
64 bytes from 8.8.8.8: icmp_seq=3 ttl=54 time=18.7 ms
64 bytes from 8.8.8.8: icmp_seq=4 ttl=54 time=17.7 ms
$ yum update
Betöltött bővítmények: fastestmirror
Loading mirror speeds from cached hostfile
Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=os&infra=stock error was
14: curl#6 - "Could not resolve host: mirrorlist.centos.org; Ismeretlen hiba"
* LXC hoszt:
$ cat /etc/lxc/default.conf
lxc.net.0.type = veth
lxc.net.0.link = lxcbr0
lxc.net.0.flags = up
lxc.net.0.hwaddr = 00:16:3e:xx:xx:xx
$ cat /etc/lxc/dnsmasq.conf
dhcp-host=fedora34,10.0.3.100
$ cat /etc/sysconfig/lxc
# LXC_AUTO - whether or not to start containers at boot
LXC_AUTO="true"
# BOOTGROUPS - What groups should start on bootup?
# Comma separated list of groups.
# Leading comma, trailing comma or embedded double
# comma indicates when the NULL group should be run.
# Example (default): boot the onboot group first then the NULL group
BOOTGROUPS="onboot,"
# SHUTDOWNDELAY - Wait time for a container to shut down.
# Container shutdown can result in lengthy system
# shutdown times. Even 5 seconds per container can be
# too long.
SHUTDOWNDELAY=5
# OPTIONS can be used for anything else.
# If you want to boot everything then
# options can be "-a" or "-a -A".
OPTIONS=
# STOPOPTS are stop options. The can be used for anything else to stop.
# If you want to kill containers fast, use -k
STOPOPTS="-a -A -s"
USE_LXC_BRIDGE="true" # overridden in lxc-net
[ ! -f /etc/sysconfig/lxc-net ] || . /etc/sysconfig/lxc-net
$ cat /etc/sysconfig/lxc-net
# Leave USE_LXC_BRIDGE as "true" if you want to use lxcbr0 for your
# containers. Set to "false" if you'll use virbr0 or another existing
# bridge, or macvlan to your host's NIC.
USE_LXC_BRIDGE="true"
# If you change the LXC_BRIDGE to something other than lxcbr0, then
# you will also need to update your /etc/lxc/default.conf as well as the
# configuration (/var/lib/lxc/<container>/config) for any containers
# already created using the default config to reflect the new bridge
# name.
# If you have the dnsmasq daemon installed, you'll also have to update
# /etc/dnsmasq.d/lxc and restart the system wide dnsmasq daemon.
LXC_BRIDGE="lxcbr0"
LXC_BRIDGE_MAC="00:16:3e:00:00:00"
LXC_ADDR="10.0.3.1"
LXC_NETMASK="255.255.255.0"
LXC_NETWORK="10.0.3.0/24"
LXC_DHCP_RANGE="10.0.3.2,10.0.3.254"
LXC_DHCP_MAX="253"
# Uncomment the next line if you'd like to use a conf-file for the lxcbr0
# dnsmasq. For instance, you can use 'dhcp-host=mail1,10.0.3.100' to have
# container 'mail1' always get ip address 10.0.3.100.
LXC_DHCP_CONFILE=/etc/lxc/dnsmasq.conf
# Uncomment the next line if you want lxcbr0's dnsmasq to resolve the .lxc
# domain. You can then add "server=/lxc/10.0.3.1' (or your actual $LXC_ADDR)
# to /etc/dnsmasq.conf, after which 'container1.lxc' will resolve on your
# host.
LXC_DOMAIN="lxc"
Van ötlete valakinek?