Difference between revisions of "Give an lxc container an external ip address"
From MyWiki
| Line 1: | Line 1: | ||
https://www.techrepublic.com/article/how-to-set-up-a-bridge-for-lxd-containers/<br> | https://www.techrepublic.com/article/how-to-set-up-a-bridge-for-lxd-containers/<br> | ||
| + | Once the bridge is set up run this:<br> | ||
<source lang="text"> | <source lang="text"> | ||
lxc launch images:centos/8 cent8 | lxc launch images:centos/8 cent8 | ||
Revision as of 09:37, 7 August 2021
https://www.techrepublic.com/article/how-to-set-up-a-bridge-for-lxd-containers/
Once the bridge is set up run this:
lxc launch images:centos/8 cent8 lxc list lxc config device add cent8 eth0 nic nictype=bridged parent=br0 name=eth0 lxc list lxc exec cent8 – /bin/bash lxc list lxc stop cent8 lxc start cent8
Example of netplan file on host server
# This file describes the network interfaces available on your system
# For more information, see netplan(5).
network:
version: 2
renderer: networkd
ethernets:
enp2s0:
dhcp4: no
# addresses: [192.168.0.17/24]
# gateway4: 192.168.0.1
# nameservers:
# addresses: [8.8.8.8,8.8.4.4]
# routes:
# - to: 10.8.0.0/24
# via: 10.8.0.74
bridges:
br0:
interfaces: [enp2s0]
addresses: [192.168.0.17/24]
gateway4: 192.168.0.1
mtu: 1500
nameservers:
addresses: [8.8.8.8]
parameters:
stp: true
forward-delay: 4