I installed the lxc container, registered all configs for it.

file / etc / network / interfaces

# Loopback device: auto lo iface lo inet loopback # device: eth0 #auto eth0 #iface eth0 inet static #address 213.239.197.111 #netmask 255.255.255.224 #gateway 213.239.197.97 # default route to access subnet #up route add -net 213.239.197.96 netmask 255.255.255.224 gw 213.239.197.97 eth0 auto br0 iface br0 inet static bridge_ports eth0 bridge_fd 0 address 213.239.197.111 broadcast 213.239.197.127 netmask 255.255.255.224 gateway 213.239.197.97 post-up /sbin/ip ro add 213.239.197.122/32 dev br0 # Создаем bridge br0 # auto br0 # iface br0 inet static # bridge_ports none # bridge_fd 0 # address 10.0.0.1 # netmask 255.255.255.0 iface eth0 inet6 static address 2a01:4f8:130:622e::2 netmask 64 gateway fe80::1 

container configuration

 # Template used to create this container: /usr/share/lxc/templates/lxc-download # Parameters passed to the template: # For additional config options, please look at lxc.container.conf(5) # Distribution configuration lxc.include = /usr/share/lxc/config/ubuntu.common.conf lxc.arch = x86_64 # Container specific configuration lxc.rootfs = /var/lib/lxc/crm/rootfs lxc.utsname = crm # Network configuration lxc.network.type = veth lxc.network.flags = up lxc.network.name = eth1 lxc.network.link = br0 lxc.network.veth.pair = veth-01 lxc.network.ipv4 = 213.239.197.122/28 lxc.network.ipv4.gateway = 213.239.197.97 lxc.network.hwaddr = 00:50:56:00:9C:81 

but there is no network on the container. where to even look?

systemctl command output status networking.service

 Loaded: loaded (/lib/systemd/system/networking.service; enabled; vendor preset: enabled) Drop-In: /run/systemd/generator/networking.service.d └─50-insserv.conf-$network.conf Active: failed (Result: exit-code) since Wed 2016-03-09 23:10:17 UTC; 5s ago Docs: man:interfaces(5) Process: 192 ExecStart=/sbin/ifup -a --read-environment (code=exited, status=1/FAILURE) Process: 189 ExecStartPre=/bin/sh -c [ "$CONFIGURE_INTERFACES" != "no" ] && [ -n "$(ifquery --read-environment --list --exclude=lo)" ] && u devadm settle (code=exited, status=0/SUCCESS) Main PID: 192 (code=exited, status=1/FAILURE) 
  • This is not a virtual machine, but a container, these are different things - Vitaly Karpenko
  • I apologize, I wanted to configure the virtual machine before, now I'm constantly confusing - Diefair
  • what if you ping from the host machine to the container - it passes - Diefair

1 answer 1

you have some kind of inconsistency in the networks.

in the container network: 213.239.197.112/28 . and the default gateway is 213.239.197.97 , which is not included in this network (like the address of the main machine - 213.239.197.111 ).

probably, the container should have the same network as the main machine: 213.239.197.96/27 .

i.e., the address assignment string should look like:

 lxc.network.ipv4 = 213.239.197.122/27 

ps and this line in the configuration of the main machine is obviously superfluous:

 post-up /sbin/ip ra 213.239.197.122/32 dev br0 
  • did as you wrote, did not help. On the container, he launched the systemctl status networking.service command and this is what it showed - added to the question - Diefair
  • @Diefair, you may understand what is written there. I, unfortunately, do not even understand why you brought the output of this command: this is your container (for one program), and not a virtual machine with full initialization. - aleksandr barakin