Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1825010
  • 博文数量: 276
  • 博客积分: 1574
  • 博客等级: 上尉
  • 技术积分: 2894
  • 用 户 组: 普通用户
  • 注册时间: 2010-05-26 23:23
个人简介

生活的美妙在于,不知道一下秒是惊艳还是伤神,时光流转,珍惜现在的拥有的时光

文章分类

全部博文(276)

文章存档

2017年(17)

2016年(131)

2015年(63)

2013年(2)

2012年(32)

2011年(31)

分类: 虚拟化

2015-08-31 13:50:43

1.安装软件包
yum install bridge-utils

目前的网卡状态:

[talen@sn192-168-1-65 etc]# ifconfig
eth0      Link encap:Ethernet  HWaddr 00:23:7D:33:CB:E4  
          inet addr:192.168.1.65  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fe80::223:7dff:fe33:cbe4/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:117061 errors:0 dropped:0 overruns:0 frame:0
          TX packets:132280 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:19007683 (18.1 MiB)  TX bytes:35575696 (33.9 MiB)

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:198975 errors:0 dropped:0 overruns:0 frame:0
          TX packets:198975 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:352654829 (336.3 MiB)  TX bytes:352654829 (336.3 MiB)

virbr0    Link encap:Ethernet  HWaddr 52:54:00:F9:2C:D6  
          inet addr:192.168.122.1  Bcast:192.168.122.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:131 errors:0 dropped:0 overruns:0 frame:0
          TX packets:94 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:13812 (13.4 KiB)  TX bytes:11630 (11.3 KiB)

vnet0     Link encap:Ethernet  HWaddr FE:54:00:A0:E5:31  
          inet6 addr: fe80::fc54:ff:fea0:e531/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:52 errors:0 dropped:0 overruns:0 frame:0
          TX packets:2567 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:500 
          RX bytes:7108 (6.9 KiB)  TX bytes:135250 (132.0 KiB)
修改宿主机的网卡配置
cd /etc/sysconfig/network-scripts
ifdown eth0  
ifdown eth0
修改eth0网卡的内容为:
DEVICE=eth0
HWADDR=00:23:7d:33:cb:e4
ONBOOT=yes
BRIDGE=br0 



新建文件ifcfg-br0,添加如下内容:

DEVICE=br0
ONBOOT=yes
TYPE=Bridge
BOOTPROTO=static
IPADDR=192.168.1.65
GATEWAY=192.168.1.1
STP=on
DELAY=0


重启网络服务:
service network restart
[root@sn192-168-1-65 network-scripts]# ifconfig
br0       Link encap:Ethernet  HWaddr 00:23:7D:33:CB:E4  
          inet addr:192.168.1.65  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fe80::223:7dff:fe33:cbe4/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:345 errors:0 dropped:0 overruns:0 frame:0
          TX packets:353 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:47760 (46.6 KiB)  TX bytes:71238 (69.5 KiB)

eth0      Link encap:Ethernet  HWaddr 00:23:7D:33:CB:E4  
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:128269 errors:0 dropped:0 overruns:0 frame:0
          TX packets:144974 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:20594100 (19.6 MiB)  TX bytes:38646348 (36.8 MiB)

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:217668 errors:0 dropped:0 overruns:0 frame:0
          TX packets:217668 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:376131837 (358.7 MiB)  TX bytes:376131837 (358.7 MiB)

virbr0    Link encap:Ethernet  HWaddr 52:54:00:F9:2C:D6  
          inet addr:192.168.122.1  Bcast:192.168.122.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:131 errors:0 dropped:0 overruns:0 frame:0
          TX packets:94 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:13812 (13.4 KiB)  TX bytes:11630 (11.3 KiB)

vnet0     Link encap:Ethernet  HWaddr FE:54:00:A0:E5:31  
          inet6 addr: fe80::fc54:ff:fea0:e531/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:52 errors:0 dropped:0 overruns:0 frame:0
          TX packets:2973 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:500 
          RX bytes:7108 (6.9 KiB)  TX bytes:156362 (152.6 KiB)


虚拟机网卡选择br0就可以了.

阅读(1366) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~