I am on a fresh install. Installed LXD following lxd init using “dir” and the automatically created network bridge.
I created a container: lxc launch ubuntu:18.04 bind
I get such a routing table inside the container:
# route
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
default vps170961 0.0.0.0 UG 100 0 0 eth0
10.226.125.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
vps170961 0.0.0.0 255.255.255.255 UH 100 0 0 eth0
# ip route list
default via 10.226.125.1 dev eth0 proto dhcp src 10.226.125.226 metric 100
10.226.125.0/24 dev eth0 proto kernel scope link src 10.226.125.226
10.226.125.1 dev eth0 proto dhcp scope link src 10.226.125.226 metric 100
I then set a static ipv4:
lxc stop bind
lxc network attach lxdbr0 bind eth0 eth0
lxc config device set bind eth0 ipv4.address 10.226.125.3
lxc start bind
The container now cannot access the internet but can resolve domain names. It has this routing table:
# route
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
default _gateway 0.0.0.0 UG 100 0 0 eth0
default _gateway 0.0.0.0 UG 100 0 0 eth0
10.226.125.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
_gateway 0.0.0.0 255.255.255.255 UH 100 0 0 eth0
_gateway 0.0.0.0 255.255.255.255 UH 100 0 0 eth0
# ip route list
default via 10.226.125.1 dev eth0 proto dhcp src 10.226.125.56 metric 100
default via 10.226.125.1 dev eth0 proto dhcp src 10.226.125.3 metric 100
10.226.125.0/24 dev eth0 proto kernel scope link src 10.226.125.3
10.226.125.1 dev eth0 proto dhcp scope link src 10.226.125.56 metric 100
10.226.125.1 dev eth0 proto dhcp scope link src 10.226.125.3 metric 100
More infos:
# lxc config show --expanded bind
architecture: x86_64
config:
image.architecture: amd64
image.description: ubuntu 18.04 LTS amd64 (release) (20190131)
image.label: release
image.os: ubuntu
image.release: bionic
image.serial: "20190131"
image.version: "18.04"
volatile.base_image: b7c4dbea897f09f29474c8597c511b57c3b9c0d6f98dc42f257c64e76fea8c92
volatile.eth0.hwaddr: 00:16:3e:41:bd:52
volatile.idmap.base: "0"
volatile.idmap.next: '[{"Isuid":true,"Isgid":false,"Hostid":100000,"Nsid":0,"Maprange":65536},{"Isuid":false,"Isgid":true,"Hostid":100000,"Nsid":0,"Maprange":65536}]'
volatile.last_state.idmap: '[{"Isuid":true,"Isgid":false,"Hostid":100000,"Nsid":0,"Maprange":65536},{"Isuid":false,"Isgid":true,"Hostid":100000,"Nsid":0,"Maprange":65536}]'
volatile.last_state.power: RUNNING
devices:
eth0:
ipv4.address: 10.226.125.3
name: eth0
nictype: bridged
parent: lxdbr0
type: nic
root:
path: /
pool: default
type: disk
ephemeral: false
profiles:
- default
stateful: false
description: ""
# lxc network show lxdbr0
config:
ipv4.address: 10.226.125.1/24
ipv4.nat: "true"
ipv6.address: none
description: ""
name: lxdbr0
type: bridge
used_by:
- /1.0/containers/base
- /1.0/containers/bind
- /1.0/containers/mail
- /1.0/containers/www
managed: true
status: Created
locations:
- none