Need ping between container and LXD server

Suppose My lxd host server IP 192.168.1.1 and my lxd container IP 192.168.1.5 normaly ping doesn’t work between host and container but I heard it works by routing. How can I do it?

I’m afraid we will need some more information on your setup.

Please can you explain what networking config you have?

1st time I m trying with macvlan. But now I have set up without bridge and macvlan. And my container getting IP from DHCP. Now lxd server and container both r getting IP from my DHCP but they can not ping each other.

root@naztech:~# lxd init
Would you like to use LXD clustering? (yes/no) [default=no]:
Do you want to configure a new storage pool? (yes/no) [default=yes]:
Name of the new storage pool [default=default]: mypool
Name of the storage backend to use (btrfs, dir, lvm, zfs) [default=zfs]:
Create a new ZFS pool? (yes/no) [default=yes]: no
Name of the existing ZFS pool or dataset: mypool/containers
Would you like to connect to a MAAS server? (yes/no) [default=no]:
Would you like to create a new local network bridge? (yes/no) [default=yes]: no
Would you like to configure LXD to use an existing bridge or host interface? (yes/no) [default=no]: yes
Name of the existing bridge or host interface: eth1
Would you like LXD to be available over the network? (yes/no) [default=no]: yes
Address to bind LXD to (not including port) [default=all]:
Port to bind LXD to [default=8443]:
Trust password for new clients:
Again:
No password set, client certificates will have to be manually trusted.Would you like stale cached images to be updated automatically? (yes/no) [default=yes]
Would you like a YAML “lxd init” preseed to be printed? (yes/no) [default=no]:

Please show output of lxc network ls and lxc network show <name> for the network in question?

root@naztech:~# lxc network ls
±-----±---------±--------±------------±--------+
| NAME | TYPE | MANAGED | DESCRIPTION | USED BY |
±-----±---------±--------±------------±--------+
| eth0 | physical | NO | | 0 |
±-----±---------±--------±------------±--------+
| eth1 | physical | NO | | 2 |
±-----±---------±--------±------------±--------+
root@naztech:~# lxc network show eth1
config: {}
description: “”
name: eth1
type: physical
used_by:

  • /1.0/containers/test
  • /1.0/containers/test1
    managed: false
    status: “”
    locations: []
    root@naztech:~#

@tomp could u help me?

Please show output of lxc config show <instance> --expanded for container, and ip a and ip r from inside container and on host.

Ah, so you’re using macvlan, this makes sense now, so macvlan doesn’t allow the instances to communicate with LXD. This is an inherent behaviour in macvlan device types and not something specific to LXD.

What are you trying to achieve? A private network between instances and the host, or to join the instances to the external network (and have them communicate with the host)?

Is this setup mention macvlan? I didn’t manual setup macvlan

Would you like to create a new local network bridge? (yes/no) [default=yes]: no
Would you like to configure LXD to use an existing bridge or host interface? (yes/no) [default=no]: yes
Name of the existing bridge or host interface: eth1
Would you like LXD to be available over the network? (yes/no) [default=no]: yes
Address to bind LXD to (not including port) [default=all]:

Implicitly yes, for the question:

This is for the default profile configuration used with all instances created using the profile, and because the interface you specified isn’t a bridge (its a physical interface), you cannot share a single port with multiple instances unless you use macvlan. So that is what LXD uses.

If you intend to only have a single instance per-physical port, then you can pass the physical port itself directly into the instance using:

lxc config device add <instance> eth0 nic nictype=physical parent=<physical interface>