In this post I will be talking about how to configure some virtual machines behind Nat, and some using public failover IP. So in the end, you will have two subnetwork at proxmox. All the instructions took place at Ovh provider.
When you buy dedicated server at Ovh, You will get one public Ip address. From this Ip you can configure forwarding rules using iptables, so those devices will be available from Internet. You can also configure postrouting rules. They can make your machines will access internet. But network in Proxmox can be configured more complex, I mean we can add next failover Ip, we can create net subnet behind Nat etc.I had the following problem. My 3 VM (database, Apache server and Windows Server) were behind Nat and they used local Ips from this class 10.0.3.0/24. They could seen each other, they could access Internet. Gateway to the Internet was Ovh's server Ip. It was working till time, when I got another task. I should have moved vm from other server to this server and the vm uses public ip too. So it was problem, because 2 services in Proxmox cannot use the same port (80, www) and be visible in Internet simultaneously.
There are a few steps, how to make it working.
- Proxmox network configuration of dedicated server
- Proxmox network configuration of VMs on hardware level
- Network configuration of Vms inside Vm
First step is to configure network of the dedicated server and we will do this through editing /etc/network/interfaces file. We won't do this through Proxmox interfaces, because it's very poor and you won't achieve all the options we need. In this file we create to local interfaces vmbr0 (with public failover ip) and vmbr1 (local network). Then we connect them to gateway and we will configure iptables rules, so all of the machines will have internet access and some of them will be visible from Internet.
Below is network configuration of the dedicated server. To protect my server address, I put xxx in place of Ip octet. It's an address as you bought from Ovh hosting provider.
Short explanation: eno1 is a physical interface but must be set to manual, not static. Otherwise nat subnet or failover ip subnet won't work. vmbr0 interface has all the addresses as physical interface and it bridges eno1 interface. vmbr1 doesn't bridge any interface. It uses ip forward (you must enable it, because by default in unix systems it's disabled) ans masquerade. All the machines within vmbr1 network can see each other. If you want to grant access to the Internet to the machines, you must add prerouting rule for iptables. If you want to have vm's services available on Internet, you must add prerouting rules for iptables.
Now I will show you my Proxmox network interfaces and how Vms are configured.
ethernets:
ens18:
addresses:
- 51.xx.yy.yy/32
nameservers:
addresses:
- 8.8.8.8
- 208.67.222.222
search: []
optional: true
routes:
- to: 0.0.0.0/0
via: 51.xx.xx.254
on-link: true
version: 2
Next important thing. In order to use failover ip, you must set up its mac address. It can't be a random address! So, when you buy failover ip in Ovh panel, then click on 'Add virtual mac' and copy the mac to the virtual machine network interface.
Last, but not least, I will show you how network is configured on Ubuntu machine (behind nat, Vm 207) and Windows Server machine Vm 202.
network:
ethernets:
ens18:
addresses:
- 10.0.3.8/24
gateway4: 10.0.3.1
nameservers:
addresses:
- 208.67.222.222
- 8.8.8.8
search: []
# optional: true
# routes:
# - to: 0.0.0.0/0
# via: 10.0.3.1
# on-link: true
version: 2
Note: 10.0.3.1 is a local gateway.
0 komentarzy:
Prześlij komentarz
Podziel się swoimi myślami.Spam nie będzie tolerowany.