how to set network on KVM

zomb

New Member
Feb 1, 2010
7
0
1
Hello,
I have PVE 1.8.
I install FreeBSD x64 on Fully virtualized (KVM).
In network I have to choose vmbr0 or NAT.
I have 5 ip. One on proxmox panel (vmbr0).
How can I redirect all traffic from other IP address to FreeBSD?
Please have exact instructions because once the server has died.

my /etc/network/interfaces:
Code:
auto lo
iface lo inet loopback

auto vmbr0
iface vmbr0 inet static
        address 91.204.161.140
        netmask 255.255.252.0
        gateway 91.204.160.254
        bridge_ports eth0
        bridge_stp off
        bridge_fd 0

Code:
:/etc# ifconfig
eth0      Link encap:Ethernet  HWaddr 20:cf:30:f0:80:ac
          inet6 addr: fe80::22cf:30ff:fef0:80ac/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:1074482 errors:0 dropped:0 overruns:0 frame:0
          TX packets:142504 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:275072765 (262.3 MiB)  TX bytes:43303682 (41.2 MiB)
          Interrupt:33 Base address:0xe000

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:48905 errors:0 dropped:0 overruns:0 frame:0
          TX packets:48905 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:15044276 (14.3 MiB)  TX bytes:15044276 (14.3 MiB)

tap104i0d0 Link encap:Ethernet  HWaddr 02:8e:3d:92:32:02
          inet6 addr: fe80::8e:3dff:fe92:3202/64 Scope:Link
          UP BROADCAST RUNNING PROMISC MULTICAST  MTU:1500  Metric:1
          RX packets:59 errors:0 dropped:0 overruns:0 frame:0
          TX packets:234495 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:500
          RX bytes:20178 (19.7 KiB)  TX bytes:15117100 (14.4 MiB)

venet0    Link encap:UNSPEC  HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
          UP BROADCAST POINTOPOINT RUNNING NOARP  MTU:1500  Metric:1
          RX packets:100832 errors:0 dropped:0 overruns:0 frame:0
          TX packets:159654 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:22042365 (21.0 MiB)  TX bytes:209497759 (199.7 MiB)

vmbr0     Link encap:Ethernet  HWaddr 20:cf:30:f0:80:ac
          inet addr:91.204.161.140  Bcast:91.204.163.255  Mask:255.255.252.0
          inet6 addr: fe80::22cf:30ff:fef0:80ac/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:1074916 errors:0 dropped:0 overruns:0 frame:0
          TX packets:142026 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:260041389 (247.9 MiB)  TX bytes:43141790 (41.1 MiB)

Reguards.
 
Last edited:
I find "System -> Create bridge device"
but if I add with "
Bridge Ports:" = eth0 :
"Error: unable to bridge device 'eth0' - device is already in use (vmbr0)"
if I add with "Bridge Ports:" = eth1 :
"Error: invalid interface name for bridge or bonding device "
Please help.
 
Think of the bridge like a "physical hub" with a port connected to your "real nick" of proxmox box (eth0 in your case) and where you can "plug" your guest ethx in the other ports.
You just have to create a VM and associate with a vmbr (in your case, you only have vmbr0).
Then your VM will have eth0, that is "plugghed" to vmbr0, and to wich you can assign whatever IP you want.
Don't be confused by the fact that vmbr0 has a IP itself, is ONLY to provide connectivity to proxmox box itself (i.e. ssh or web interface). If you have multiple eth in proxmox, and create vmbr1, vmbr2 etc you can leave those bridge WITHOUT ip (you should do so).
 
Correct, you already have vmbr0 "chained" to eth0 on your system, and is the way it have to be.
Then when you create a KVM VM, you have "Bridge" under network part (bottom of the create vm screen) and there you have to specify "vmbr0".
Install debian or whatever GNU/Linux distro you want in that vm and, INSIDE the VM, you will have eth0 (# ifconfig -a).
Set it up (in debian, /etc/network/interfaces) with whatever IP you need and ifup eth0 to bring it up.
At this point this VM, from a connectivity point of view, behaves exactly like a "real" PC.
So from the "real" world (i.e. a different PC) you can reach, if your routes/subnets are correct, that VM.
I suggest you to do some tests with your local IP, and only then try with public IP, since you could have other network issues (i.e. is your router configured correctly? Are you trying to reach the public IP going out with the same Adsl connection? (doesn't work), etc.).