LXC container running Ubuntu can't access http server

rufusz

Member
May 16, 2021
4
0
6
42
Hi,
I've installed Ubuntu 21 in an LXC container and running an http-server for testing on port 8080, I can't access the webserver from thee lan (through VPN). From the host proxmox it works.

VPN is in 192.168.240.x adress space

CONTAINER
ip is dhcp 192.168.101.159

route -n
Code:
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         192.168.101.1   0.0.0.0         UG    0      0        0 eth0
10.0.3.0        0.0.0.0         255.255.255.0   U     0      0        0 lxcbr0
192.168.101.0   0.0.0.0         255.255.255.0   U     0      0        0 eth0



HOST

/etc/network/interfaces
Code:
auto lo
iface lo inet loopback

iface eno1 inet manual

auto vmbr0
iface vmbr0 inet static
        address  192.168.101.101
        netmask  255.255.255.0
        gateway  192.168.101.1
        up route add -net 192.168.102.0/24 gw 192.168.101.117
        up route add -net 192.168.103.0/24 gw 192.168.101.117
        up route add -net 192.168.240.0/24 gw 192.168.101.117
        down route del -net 192.168.102.0/24 gw 192.168.101.117
        down route del -net 192.168.103.0/24 gw 192.168.101.117
        down route del -net 192.168.240.0/24 gw 192.168.101.117
        bridge_ports eno1
        bridge_stp off
        bridge_fd 0
route -n
Code:
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         192.168.101.1   0.0.0.0         UG    0      0        0 vmbr0
192.168.101.0   0.0.0.0         255.255.255.0   U     0      0        0 vmbr0
192.168.102.0   192.168.101.117 255.255.255.0   UG    0      0        0 vmbr0
192.168.103.0   192.168.101.117 255.255.255.0   UG    0      0        0 vmbr0
192.168.240.0   192.168.101.117 255.255.255.0   UG    0      0        0 vmbr0
 
Last edited:
Solved it, I had to add an entry to the route table. Maybe it is very specific for my network architecture, but anyway I leave the solution here: the container needs to know the gateway.

route add -net 192.168.102.0 netmask 255.255.255.0 gw 192.168.101.117