اول اینکه تنظیمات پیشفرض را پاک می کنیم
If he leaves it in a NAT format where there's DHCP, he has to NAT through iptables. The host has to have ip forwarding turned on in /etc/sysctl.conf.
If he destroys the default virbr0, he can attach the vm to the bridge created with the physical interface on the machine. Thus, he'll get DHCP from another source and can get out, without having to deal with NAT and iptables from the host.
, I destroy the initial virbr0 interface. I don't want to deal with another NAT when I have another router that does it already
me: how can i destroys the default virbr0 and attach the vm to the bridge created with the physical interface on the machine?
virsh net-destroy default virsh net-undefine default
service libvirtd restart
That's how you destroy the initial interface virbr0
I too don't need the virbr interface, everything is through the br0
If you have virt-manager at your disposal, you'd open the virtual machine, click details, click your NIC, and set the source device to the bridge that's available.
I think attaching it to eth0 is fine enough, because I think virsh will get the idea
It ends up creating a vnet0 anyway
$ cat /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
TYPE=Ethernet
UUID=c067570d-a2ec-4824-b9ff-21df7a00aff4
ONBOOT=yes
NM_CONTROLLED=yes
# BOOTPROTO=none
HWADDR=30:85:a9:3a:b5:75
DEFROUTE=yes
PEERROUTES=yes
IPV4_FAILURE_FATAL=yes
IPV6INIT=no
NAME="System eth0"
# IPADDR=192.168.1.250
# NETMASK=255.255.255.0
# DNS2=8.8.4.4
# GATEWAY=192.168.1.1
# DNS1=8.8.8.8
USERCTL=no
BRIDGE=br0
نمی دونم چرا نت ماسک رو اینجا می گذارم قطع میشه به محض اینکه بر می دارم درست میشه
me : in /etc/sysconfig/network-scripts/ifcfg-br0 i should set internet static ip of just like what you set?
set the IP of the eth0 interface
$ cat /etc/sysconfig/network-scripts/ifcfg-br0
DEVICE="br0"
NM_CONTROLLED="yes"
ONBOOT=yes
TYPE=Bridge
BOOTPROTO=none
IPADDR=192.168.1.250
PREFIX=24
GATEWAY=192.168.1.1
DNS1=8.8.8.8
DNS2=8.8.4.4
DEFROUTE=yes
IPV4_FAILURE_FATAL=yes
IPV6INIT=no
NAME="System br0"
#cat /etc/sysconfig/network
NETWORKING=yes
HOSTNAME=host.ir
GATEWAY=brr0
حالا برنامه virt manager
را باز می کنیم در و از قسمت تنظیمات
guest
از بخش
nic روی
vnet0(Bridge brr0)
را انتخاب می کنیم.
یا اینکه
virsh attach-interface debian_serv bridge brr0 vnet0
me: what about net config on guest?
COnfigure it on the guest according to what your network operator wants.
If there's no DHCP, it needs a static address according to your network.