码迷,mamicode.com
首页 > 其他好文 > 详细

KVM之配置桥接网卡

时间:2019-06-27 15:02:55      阅读:276      评论:0      收藏:0      [点我收藏+]

标签:sys   system   centos   netmask   add   ast   listen   ack   type   

配置桥接网卡

添加桥接网卡br0,注释掉已有的eth0配置

[root@ubuntu01 ~]# vi /etc/network/interfaces
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
#auto eth0
#iface eth0 inet dhcp

auto br0
iface br0 inet static
        address 192.168.31.10
        netmask 255.255.255.0
        broadcast 192.168.31.255
        gateway 192.168.31.2
        bridge_ports eth0
        bridge_fd 9
        bridge_hello 2
        bridge_maxage 12
        bridge_stp off

重启网络后,就可以看到桥接网卡的配置了:

[root@ubuntu01 ~]# brctl show 
bridge name     bridge id               STP enabled     interfaces
br0             8000.000c29acc95e       no              eth0
virbr0          8000.000000000000       yes
[root@ubuntu01 ~]# ip add
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast master br0 state UP group default qlen 1000
    link/ether 00:0c:29:ac:c9:5e brd ff:ff:ff:ff:ff:ff
    inet6 fe80::20c:29ff:feac:c95e/64 scope link 
       valid_lft forever preferred_lft forever
3: br0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
    link/ether 00:0c:29:ac:c9:5e brd ff:ff:ff:ff:ff:ff
    inet 192.168.31.10/24 brd 192.168.31.255 scope global br0
       valid_lft forever preferred_lft forever
    inet6 fe80::20c:29ff:feac:c95e/64 scope link 
       valid_lft forever preferred_lft forever
4: virbr0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default qlen 1000
    link/ether 32:33:c1:58:2a:87 brd ff:ff:ff:ff:ff:ff
    inet 192.168.122.1/24 brd 192.168.122.255 scope global virbr0
       valid_lft forever preferred_lft forever

创建虚拟机

virt-install 的--network选项指定bridge:

[root@ubuntu01 ~]# virt-install     --name=centos_vm_01     --virt-type=kvm     --ram=1024     --cdrom=/data/iso/CentOS-V6.5.23.iso     --disk path=/data/img/disk01.raw     --network bridge=br0     --graphics vnc,listen=0.0.0.0     --noautoconsole

KVM之配置桥接网卡

标签:sys   system   centos   netmask   add   ast   listen   ack   type   

原文地址:https://www.cnblogs.com/wshenjin/p/11096847.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!