########## Make the physical network segment and Vm in the same network segment in the bridge mode ################## #
Br0: Configure Bridging for eth0
Edit/etc/sysconfig/network-scripts/ifcfg-eth0, enter:
# Vi/etc/sysconfig/network-scripts/ifcfg-eth0
Update it as follows:
Device = eth0
3 onboot = Yes
Ethtool_opts = "autoneg off speed 100 duplex full"
Bridge = br0
Hwaddr = B8: AC: 6f: 65: 31: E5
Save and close the file. Create/etc/sysconfig/network-scripts/ifcfg-br0, enter:
# Vi/etc/sysconfig/network-scripts/ifcfg-br0
Update it as follows (note options are case sensitive I. e. Bridge and bridge are two different options)
Device = br0
Type = Bridge
Bootproto = static
Onboot = Yes
Ipaddr = 10.10.21.70
Netmask = 255.255.255.255.192
Delay = 0
Save and close the file. Finally, create Static Routing file/etc/sysconfig/network-scripts/route-br0, enter:
# Vi/etc/sysconfig/network-scripts/route-br0
Edit it as follows:
10.0.0.0/8 via 10.10.21.122 Dev br0
Save and close the file. delete old/etc/sysconfig/network-scripts/route-eth0 (if exists ):
# Rm/etc/sysconfig/network-scripts/route-eth0
Service Network restart
######################################## ####################################
Nat-Based IP address translation converts the network segments of VM 192.168.1.0/24 to allow the VM to access the Internet, but the VM cannot be accessed from the Internet.
Reference:
Http://segmentfault.com/blog/koy/1190000000644069
Http://www.linuxidc.com/Linux/2012-05/61445.htm
[[Email protected] networks] # cd/etc/libvirt/qemu/networks
[[Email protected] networks] # SCP default. xml mynat. xml
[[Email protected] networks] # Cat mynat. xml modify the mynat CIDR block to 192.168.1.0/24
<Network>
<Name> mynat </Name>
<UUID> 504730bc-0a59-4fb7-a4a7-9b779fa4bf79 </UUID>
<Forward mode = 'nat '/>
<Bridge name = 'br0' STP = 'on' delay = '0'/>
<MAC address = '52: 54: 00: FD: Be: C8 '/>
<IP address = '1970. 168.1.1 'netmask = '1970. 255.255.0'>
<DHCP>
<Range start = '192. 168.1.2 'End = '192. 168.1.254'/>
</DHCP>
</IP>
</Network>
[[Email protected] networks] # virsh net-define mynat. xml
Network mynat defined from mynat. xml
[[Email protected] networks] # virsh net-autostart mynat
Network mynat marked as autostarted
[[Email protected] networks] # virsh net-start mynat
[[Email protected] networks] # brctl show
Bridge namebridge idstp enabledinterfaces
Br08000.525400fdbec8yes br0-nic
Br18000.000000000000 No
Pan08000.000000000000 No
Virbr08000.525400fdbec9yes virbr0-nic
[[Email protected] networks] #
This article is from the "devops" blog and will not be reposted!
Virt-manager bridge settings