[SOLVED] Internet access to Containers

brawcks

New Member
Sep 17, 2023
1
0
1
Hello there,

After some hours struggling on how to achieve it, i'm now asking for some help ! I've searched on a lot of existing topics before asking here, youtube videos also and official proxmox documentation, but i litterraly couldn't give any internet access to my proxmox container.

What i have actually :

- Clustered 2 proxmox servers (only testing there, i'll have a 3rd one later :D)
- 1 is a dedicated machine at home (Machine A : 192.168.1.88/24)
- 1 is a VM containing proxmox over virtualbox on my computer (Machine B : 192.168.1.24/24)

Actually :

- Both proxmox servers have internet access and static IP over my private network.
- LXC containers started on machine B do not have access to internet.
- LXC containers started on machine A do not have access to internet.
- If i start LXC container using DHCP, my router is able to see the container and assign it an IP over the network, BUT i can't ping my router (192.168.1.254) from the container.

I'm doing every tests on machine B :

Actually, machine B configuration (/etc/network/interfaces) looks like this :

Code:
root@Machine-B:~# cat /etc/network/interfaces
# network interface settings; autogenerated
# Please do NOT modify this file directly, unless you know what
# you're doing.
#
# If you want to manage parts of the network configuration manually,
# please utilize the 'source' or 'source-directory' directives to do
# so.
# PVE will preserve these directives, but will NOT read its network
# configuration from sourced files, so do not attempt to move any of
# the PVE managed interfaces into external files!

auto lo
iface lo inet loopback

auto enp0s3
iface enp0s3 inet manual

auto vmbr0
iface vmbr0 inet static
        address 192.168.1.24/24
        gateway 192.168.1.254
        bridge-ports enp0s3
        bridge-stp off
        bridge-fd 0
        post-up echo 1 > /proc/sys/net/ipv4/ip_forward
        post-up   iptables -t nat -A POSTROUTING -s '192.168.1.0/24' -o enp0s3 -j MASQUERADE
        post-down iptables -t nat -D POSTROUTING -s '192.168.1.0/24' -o enp0s3 -j MASQUERADE
        post-up   iptables -t raw -I PREROUTING -i fwbr+ -j CT --zone 1
        post-down iptables -t raw -D PREROUTING -i fwbr+ -j CT --zone 1

Here is the route config on my LXC container in machine B (CT100) :

Code:
root@CT100:~# ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
2: eth0@if19: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
    link/ether fe:4b:f6:83:88:8e brd ff:ff:ff:ff:ff:ff link-netnsid 0
    inet 192.168.1.55/24 metric 1024 brd 192.168.1.255 scope global dynamic eth0
       valid_lft 85332sec preferred_lft 85332sec
    inet6 fe80::fc4b:f6ff:fe83:888e/64 scope link
       valid_lft forever preferred_lft forever
root@CT100:~# ip r
default via 192.168.1.254 dev eth0 proto dhcp src 192.168.1.55 metric 1024
192.168.1.0/24 dev eth0 proto kernel scope link src 192.168.1.55 metric 1024
192.168.1.254 dev eth0 proto dhcp scope link src 192.168.1.55 metric 1024
root@CT100:~# ping 8.8.8.8
PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.
^C
--- 8.8.8.8 ping statistics ---
11 packets transmitted, 0 received, 100% packet loss, time 10376ms

root@CT100:~# ping 192.168.1.254
PING 192.168.1.254 (192.168.1.254) 56(84) bytes of data.
From 192.168.1.55 icmp_seq=1 Destination Host Unreachable
From 192.168.1.55 icmp_seq=2 Destination Host Unreachable
From 192.168.1.55 icmp_seq=3 Destination Host Unreachable
^C
--- 192.168.1.254 ping statistics ---
4 packets transmitted, 0 received, +3 errors, 100% packet loss, time 3111ms
pipe 4
root@CT100:~# ping 192.168.1.24
PING 192.168.1.24 (192.168.1.24) 56(84) bytes of data.
64 bytes from 192.168.1.24: icmp_seq=1 ttl=64 time=0.032 ms
64 bytes from 192.168.1.24: icmp_seq=2 ttl=64 time=0.043 ms
^C
--- 192.168.1.24 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1141ms
rtt min/avg/max/mdev = 0.032/0.037/0.043/0.005 ms

I tried a lot of stuff, but i really can't see what's wrong in my configuration. If anyone could help me ! Thanks a lot by the way :)

EDIT

Bruuuh !

I've reinstalled everything with default values on Machine A, and it now works as it should ! I do not understand what i failed before, but it's all resolved for Machine A.

I guess i'll give an other try on machine B now :)

Have a nice day all
 
Last edited:

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!