How to configure 1 NIC, 2 Public IPV4s, one to be used for pfSense?

farhood

New Member
Dec 16, 2022
3
1
3
Hello.

I'm trying to configure my proxmox setup in a way that my main ipv4 is used by the host itself (the routed configuration in here), while the secondary ipv4 is used by the pfSense VM and then propagated by that to other VMs.

Based on Hetzner documentations I have changed my `/etc/network/interfaces/` to this:

Code:
source /etc/network/interfaces.d/*

auto lo
iface lo inet loopback
iface lo inet6 loopback

auto enp41s0
iface enp41s0 inet static
  address <MAIN_IPV4>
  netmask 255.255.255.255
  gateway <GATEWAY>
  pointopoint <GATEWAY>

iface enp41s0 inet6 static
  address <MAIN_IPV6>
  netmask 64
  gateway fe80::1
  up sysctl -p


auto vmbr0
iface vmbr0 inet static
  address <MAIN_IPV4>
  netmask 255.255.255.255
  bridge_ports none
  bridge_stp off
  bridge_fd 0

  # Additional ips
  up ip route add  <SECONDARY_IPV4>/32 dev vmbr0
 

auto vmbr1
iface vmbr1 inet static
  address 192.168.10.0/24
  bridge_ports none
  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.10.0/24' -o vmbr0 -j MASQUERADE
  post-down iptables -t nat -D POSTROUTING -s '192.168.10.0/24' -o vmbr0 -j MASQUERADE


auto vmbr101
iface vmbr101 inet static
  address 192.168.50.0/24
  bridge-ports none
  birdge-stp off
  bridge-fd 0


The vmbr1 is a legacy bridge that I will remove later, which was configured before the decision of switching to pfSense.
The problem I have currently is that I do not have any internet connection on my pfSense (WAN is vmbr0, LAN is vmbr101) , or the VM that is configured to use vmbr1.


This is my previous configuration that had internet working in my vmbr1 connection. I cant really find out why its not working anymore.

Code:
### Hetzner Online GmbH installimage

source /etc/network/interfaces.d/*

auto lo
iface lo inet loopback
iface lo inet6 loopback

#auto enp41s0
iface enp41s0 inet manual

auto vmbr0
iface vmbr0 inet static
  address <MAIN_IPV4>
  netmask 255.255.255.255
  gateway <GATEWAY>
  pointopoint <GATEWAY>
  bridge_ports enp41s0
  bridge_stp off
  bridge_fd 1
 

auto vmbr1
iface vmbr1 inet static
  address 192.168.10.0/24
  bridge_ports none
  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.10.0/24' -o vmbr0 -j MASQUERADE
  post-down iptables -t nat -D POSTROUTING -s '192.168.10.0/24' -o vmbr0 -j MASQUERADE
 
  • Like
Reactions: titanen

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!