Assigning private IP to a container from host which is connected to a private vSwitch network.

farbod

New Member
Apr 30, 2023
6
0
1
Hello,
I have a Hetzner server with Proxmox installed.
I have connected my host to a vSwitch and assigned a private IP to it.
now i want to assign another IP from that private network to one of my containers.
I have connected 5 Proxmox nodes to this network and they can communicate with no problem.
but i want to my container also be in that private network to communicate with other containers on private network or other nodes.
here is my nodes network configuration;
Code:
source /etc/network/interfaces.d/*

auto lo
iface lo inet loopback

iface lo inet6 loopback

auto enp35s0
iface enp35s0 inet static
        address 65.109.111.229/26
        gateway 65.109.111.193
        post-up echo 1 > /proc/sys/net/ipv4/ip_forward
        post-up echo 1 > /proc/sys/net/ipv4/conf/enp35s0/proxy_arp
        up route add -net 65.109.111.192 netmask 255.255.255.192 gw 65.109.111.193 dev enp35s0
# route 65.109.111.192/26 via 65.109.111.193

iface enp35s0 inet6 static
        address 2a01:4f9:3051:3e22::2/64
        gateway fe80::1

auto enp35s0.4001
iface enp35s0.4001 inet static
        address 192.168.100.4/24
        mtu 1400

auto vmbr1
iface vmbr1 inet static
        address 65.109.111.229/26
        bridge-ports none
        bridge-stp off
        bridge-fd 0
        bridge_maxwait 0
# Our Host will be the Gateway for all VM's
# Some basic bridge configuration

  up route add -host 135.181.175.0 dev vmbr1
  up route add -host 135.181.175.1 dev vmbr1
  up route add -host 135.181.175.2 dev vmbr1
  up route add -host 135.181.175.3 dev vmbr1
  up route add -host 135.181.175.4 dev vmbr1
  up route add -host 135.181.175.5 dev vmbr1
  up route add -host 135.181.175.6 dev vmbr1
  up route add -host 135.181.175.7 dev vmbr1

My host uses a vswitch with vlanID 4001 and mtu 1400.
 

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!