connection pb using open vswitch

wfamy

Active Member
Sep 9, 2019
5
0
41
52
HI all:

I try to install a new network in my proxmox6 using open vswitch.

I want to use vlan for my lxc container.


when i use the /etc/network/interfaces
Code:
auto lo
iface lo inet loopback
allow-ovs vmbr0
 iface vmbr0 inet static
 address 95.216.20.71
 netmask 255.255.255.192
 gateway 95.216.20.65
 ovs_type OVSBridge
 ovs_ports enp2s0
 up route add -net 95.216.20.64 netmask 255.255.255.192 gw 95.216.20.65 dev enp2s0
allow-vmbr0 enp2s0
 iface enp2s0 inet manual
 ovs_bridge vmbr0
 ovs_type OVSPort


i can use my lxc container connect on vmbr0 with and then can connect internet with

iptables -t nat -A POSTROUTING -s '95.216.20.71/26' -o vmbr0 -j MASQUERADE
ip route add 95.216.60.253/32 dev vmbr0


if i use the 2.2.1 exemple (https://pve.proxmox.com/wiki/Open_vSwitch)
Code:
# Loopback interface
auto lo
iface lo inet loopback

# Bridge for our enp2s0 physical interfaces and vlan virtual interfaces (our VMs will
# also attach to this bridge)
auto vmbr0
allow-ovs vmbr0
iface vmbr0 inet manual
  ovs_type OVSBridge
  # NOTE: we MUST mention enp2s0, vlan1, and vlan55 even though each
  #       of them lists ovs_bridge vmbr0!  Not sure why it needs this
  #       kind of cross-referencing but it won't work without it!
  ovs_ports enp2s0 vlan1 vlan55
  mtu 9000

# Physical interface for traffic coming into the system.  Retag untagged
# traffic into vlan 1, but pass through other tags.
auto enp2s0
allow-vmbr0 enp2s0
iface enp2s0 inet manual
  ovs_bridge vmbr0
  ovs_type OVSPort
  ovs_options tag=1 vlan_mode=native-untagged
# Alternatively if you want to also restrict what vlans are allowed through
# you could use:
# ovs_options tag=1 vlan_mode=native-untagged trunks=10,20,30,40
  mtu 9000

# Virtual interface to take advantage of originally untagged traffic
allow-vmbr0 vlan1
iface vlan1 inet static
  ovs_type OVSIntPort
  ovs_bridge vmbr0
  ovs_options tag=1
  ovs_extra set interface ${IFACE} external-ids:iface-id=$(hostname -s)-${IFACE}-vif
 address  95.216.20.71
 netmask  26
 gateway  95.216.20.65
 mtu 1500

I put my adresse in vmbr0 in vlan i add routing
up route add -net 95.216.20.64 netmask 255.255.255.192 gw 95.216.20.65 dev enp2s0 but nothing.

how can i connect my server to internet and create vlan?
 
After multiple try I write a simple howto using gui.
  1. remove interface ip v4 and v6
  2. add ovs-bridge and give the ip v4 AND V6. fill the gateway
  3. add ovs-int-port with or without network but no gateway. possible to create tag for vlan
  4. repeat 3 for your vlan
  5. then reboot