Contabo VMS server without internet

Caju

New Member
Dec 13, 2023
8
0
1
I've been trying to solve this problem for a few hours, seeing posts from some users but I really don't know how to solve it.

All VMS on my new server with proxmox the internet does not work. The internet on the proxmox server works, but I don't know how to make it work. I've read several files and it's not working. Does anyone have any tips?

my vm
1702434180519.png

1702434215669.png


1702434306422.png


/etc/network/interfaces

1702434492926.png
 
Hello,

based on the /etc/network/interfaces of your host, i assume you try to achieve a masquerading setup [1] ?

If so, there are some mistakes in your config.
Currently vmbr1 has eth1 as bridge port and vmbr0 has eth0 as bridge port, therefore eth0 connected to vmbr0 currently has the IP address XX.XX.193.76 - which works and is desired.
But in the next step you would configured eth1 bridged to vmbr1 with the ip 192.168.1.1 which, i assume you wanted to use for your internal vm network ? In your current setup this is not the case, you'll want to change it to:

Code:
# your NIC outward facing to your router with static ip-address
auto eth0
iface eth0 inet static
    address X.X.193.76/24
    gateway X.X.193.1
   
# your internal vm network not bridge, but isolated
auto vmbr0
iface vmbr0 inet static
    address 192.168.1.1
    bridge-ports none
    bridge-stp off
    bridge-fd 0
   
    # rules to forward and masquerade the traffic of the vms t
    echo 1 > /proc/sys/net/ipv4/ip_forward
    post-up iptables -t nat -A POSTROUTING -s '192.168.1.0/24'-o eth0 -j MASQUERADE
    post-down iptables -nat -D POSTROUTING -s '192.168.1.0/24' -o eth0 -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

If my assumptions were wrong just let me know :)

[1] https://pve.proxmox.com/wiki/Network_Configuration
 
Last edited:
You also need to give your VM an IP address, this doesn't happen automatically if you don't use cloud-init or have SDN set up.
 
  • Like
Reactions: _gabriel
Hello, you must use vmbr0
iptables -t nat -A POSTROUTING -s '192.168.1.0/24' -o vmbr0 -j MASQUERADE
and so on.
 
Hello everyone, thanks for the answers, you are incredible. But I'm still a little confused, networking isn't my strong point, I'm just a student :)
What should I do now ? change my todo nano /etc/network/interfaces


Using the configuration sent above?

Thank you again
 
Hello everyone, thanks for the answers, you are incredible. But I'm still a little confused, networking isn't my strong point, I'm just a student :)
What should I do now ? change my todo nano /etc/network/interfaces


Using the configuration sent above?

Thank you again
If my assumptions on your setup were correct (please check and as questions if you have any),
the host config i send should create a masquerading setup.
And as @news stated correctly your vms then should get IP addresses in the range 192.168.1.2 - 192.168.1.254
which can be configured like this:
Code:
iface ensXYZ inet manual

auto vmbr0
iface vmbr0 inet static
    address 192.168.0.2/24
    gateway 192.168.0.1
    bridge-ports ensXYZ
    bridge-stp off
    bridge-fd 0
(192.168.1.1 is your host working as the gateway)

But before copy pasting anything first try to understand what you are configuring
 
Last edited:
I'm really lost, I was using proxmox to manage some VMs in my house, I found it very practical, so I decided to put my VMs in the cloud, that's when this nightmare started.
In the cloud (accounting) the server comes with a standard configuration.
My vms don't collect IPs, it's very strange.

1702461095147.png
 
As I and @hd-- have already written, you also have to give the VM an IP address. If you don't use a cloud init and don't use SDN, PVE can't give your VM an IP address, then you have to configure and store it manually within the VM.

See here:
And as @news stated correctly your vms then should get IP addresses in the range 192.168.1.2 - 192.168.1.254
which can be configured like this:
Code:
iface ensXYZ inet manual

auto vmbr0
iface vmbr0 inet static
address 192.168.0.2/24
gateway 192.168.0.1
bridge-ports ensXYZ
bridge-stp off
bridge-fd 0
(192.168.1.1 is your host working as the gateway)
 
I understood! :)
In the case of iface ensXYZ, I need to replace it with eth0, right? ----> iface eth0 and ---> bridge-ports eth0 as shown in the image below
Thank guys

1702464320720.png
 
My Vm, do I need to run some command to apply this configuration or just restart?

1702465574652.png
 
you can update the network config with
# ifreload -a
 
It didn't work, I think I'll reinstall the system and start all over again, I see that in the virtual machine there is a Cloud-Init option, maybe that would be easier?

I just need my vms to use the internet, and communicate externally. data is not so secure.


1702467560260.png
 
As you can see from the screenshot, the interfaces in your VM are called ens18 and ens19, so you have to set that instead of vmbr0 or eth0.

I see that in the virtual machine there is a Cloud-Init option
The setup of Cloud-Init is documented in the Wiki, but I doubt whether it is easier than correcting a network configuration. https://pve.proxmox.com/wiki/Cloud-Init_Support

Just to avoid misunderstandings. You basically have to do a network configuration on the node and also within the VM. Both configurations are basically independent of each other, for example your VM doesn't know anything about your setup on the node and doesn't have to.

A virtual machine should always be viewed in isolation from the node. It is always a separate operating system, as if you had two laptops in front of you - both have to be configured so that they can be connected to the network. Just because you have configured laptop 1, laptop 2 will not automatically work.
 
As you can see from the screenshot, the interfaces in your VM are called ens18 and ens19, so you have to set that instead of vmbr0 or eth0.


The setup of Cloud-Init is documented in the Wiki, but I doubt whether it is easier than correcting a network configuration. https://pve.proxmox.com/wiki/Cloud-Init_Support

Just to avoid misunderstandings. You basically have to do a network configuration on the node and also within the VM. Both configurations are basically independent of each other, for example your VM doesn't know anything about your setup on the node and doesn't have to.

A virtual machine should always be viewed in isolation from the node. It is always a separate operating system, as if you had two laptops in front of you - both have to be configured so that they can be connected to the network. Just because you have configured laptop 1, laptop 2 will not automatically work.

Yes thanks for the answer, i will try fix then....I've been trying to resolve this for almost a week lol
I just don't understand why my VM installs the network card.
any idea ?
1702469037336.png


1702469082110.png


1702469144703.png
 
1. you can remove one network device from the vm if not needed. Select the VM in the GUI -> Hardware -> select one of the two Network devices and delete them
2. in the VM: if the ip a output and the /etc/network/interfaces content is still up to date, then the config update did not work
 
Add the following to your network configuration within the VM and then see if it works.

Code:
iface ens18 inet manual

auto ens18
iface ens18 inet static
    address 192.168.1.2/24
    gateway 192.168.1.1

However, this requires that you have configured your node correctly and that the network settings have also been applied and are active.
 
1. you can remove one network device from the vm if not needed. Select the VM in the GUI -> Hardware -> select one of the two Network devices and delete them
2. in the VM: if the ip a output and the /etc/network/interfaces content is still up to date, then the config update did not work
removed and leave just this one, but same result, nothing :(


1702470320859.png
 
can you please provide us with the content of
Code:
/etc/network/interfaces
of your host?
how did you configure the network inside the VMs?