I am trying to set the IP address of my container to 192.168.1.70 (on production server, i want to do the same with a public IP address) so that it is visible on my home network. It is not working for me, not reachable and no internet.
Any help would be appreciated. thanks.
Here is what I did:
Create network interface
$ sudo nmcli con add ifname custombr1 type bridge con-name custombr1
$ sudo nmcli con add type bridge-slave ifname wlx28ee52172bc master custombr1
$ sudo nmcli con up custombr1
Check ifconfig
$ ifconfig
custombr1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
ether 0a:23:ad:aa:22:2d txqueuelen 1000 (Ethernet)
RX packets 73 bytes 23128 (23.1 KB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 2 bytes 260 (260.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
I created a profile and then added this to the container
$ lxc info apache
Name: apache
Location: none
Remote: unix://
Architecture: x86_64
Created: 2021/05/08 07:15 UTC
Status: Running
Type: container
Profiles: custom-default, custom-bridged
Pid: 61775
Ips:
eth0: inet6 fe80::216:3eff:fe74:bffe veth8440bec7
lo: inet 127.0.0.1
lo: inet6 ::1
Resources:
Processes: 12
Disk usage:
root: 16.09MB
CPU usage:
CPU usage (in seconds): 0
Memory usage:
Memory (current): 9.43MB
Memory (peak): 10.92MB
Network usage:
eth0:
Bytes received: 10.61kB
Bytes sent: 21.11kB
Packets received: 201
Packets sent: 71
lo:
Bytes received: 0B
Bytes sent: 0B
Packets received: 0
Packets sent: 0
This is what the profile shows
$ lxc profile show custom-bridged
config: {}
description: Custom Bridged Network Profile
devices:
eth0:
name: eth0
nictype: bridged
parent: custombr1
type: nic
name: custom-bridged
used_by:
- /1.0/instances/apache
This is the other profile that is also attached to the instance
$ lxc profile show custom-default
config: {}
description: ""
devices:
root:
path: /
pool: default
type: disk
name: custom-default
used_by:
- /1.0/instances/apache
$ lxc list
+-----------+---------+-----------------------+----------------------------------------------+-----------+-----------+
| NAME | STATE | IPV4 | IPV6 | TYPE | SNAPSHOTS |
+-----------+---------+-----------------------+----------------------------------------------+-----------+-----------+
| apache | RUNNING | | | CONTAINER | 0 |
+-----------+---------+-----------------------+----------------------------------------------+-----------+-----------+
| web-app | RUNNING | 10.173.158.156 (eth0) | fd42:6ed:2d75:d56b:216:3eff:fe58:cbd1 (eth0) | CONTAINER | 0 |
+-----------+---------+-----------------------+----------------------------------------------+-----------+-----------+