码迷,mamicode.com
首页 > 系统相关 > 详细

49 Linux操作系统原理、虚拟化技术基础原理

时间:2016-12-24 23:30:34      阅读:416      评论:0      收藏:0      [点我收藏+]

标签:虚拟化

04 虚拟化技术基础原理


一、配置虚拟化网络

1、编辑配置文件

#关闭NetworkManager

[root@localhost ~]# service NetworkManager stop

[root@localhost ~]# chkconfig NetworkManager off   

[root@localhost ~]# chkconfig --list NetworkManager

NetworkManager  0:关闭  1:关闭  2:关闭  3:关闭  4:关闭  5:关闭  6:关闭

[root@localhost ~]# yum -y install bridge-utils

[root@localhost ~]# cd /etc/sysconfig/network-scripts/

[root@localhost network-scripts]# cp ifcfg-eth0 ifcfg-br0

[root@localhost network-scripts]# vim ifcfg-br0 

修改

DEVICE=eth0

DEVICE=br0

修改

TYPE=Ethernet

TYPE=Bridge

[root@localhost network-scripts]# vim ifcfg-eth0 

DEVICE=eth0

BOOTPROTO=none

NM_CONTROLLED=no

ONBOOT=yes

TYPE=Ethernet

BRIDGE=br0

IPV6INIT=no

NAME="System eth0"

[root@localhost network-scripts]# service network restart 

[root@localhost network-scripts]# ifconfig

br0       Link encap:Ethernet  HWaddr 00:0C:29:F1:37:B9  

 inet addr:192.168.1.62  Bcast:192.168.1.255  Mask:255.255.255.0

 inet6 addr: fe80::20c:29ff:fef1:37b9/64 Scope:Link

 UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1

 RX packets:288 errors:0 dropped:0 overruns:0 frame:0

 TX packets:120 errors:0 dropped:0 overruns:0 carrier:0

 collisions:0 txqueuelen:0 

 RX bytes:23746 (23.1 KiB)  TX bytes:16803 (16.4 KiB)


eth0      Link encap:Ethernet  HWaddr 00:0C:29:F1:37:B9  

 inet6 addr: fe80::20c:29ff:fef1:37b9/64 Scope:Link

 UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1

 RX packets:57325 errors:0 dropped:0 overruns:0 frame:0

 TX packets:3235 errors:0 dropped:0 overruns:0 carrier:0

 collisions:0 txqueuelen:1000 

 RX bytes:11649764 (11.1 MiB)  TX bytes:249757 (243.9 KiB)

 Interrupt:19 Base address:0x2000 


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:65536  Metric:1

 RX packets:0 errors:0 dropped:0 overruns:0 frame:0

 TX packets:0 errors:0 dropped:0 overruns:0 carrier:0

 collisions:0 txqueuelen:0 

 RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)

[root@localhost network-scripts]# brctl show

bridge name     bridge id               STP enabled     interfaces

br0             8000.000c29f137b9       no              eth0


#启用STP

[root@localhost network-scripts]# brctl stp br0 on

[root@localhost network-scripts]# brctl show      

bridge name     bridge id               STP enabled     interfaces

br0             8000.000c29f137b9       yes             eth0


二、命令方式


[root@localhost ~]# brctl show

bridge name     bridge id               STP enabled     interfaces

[root@localhost ~]# brctl addbr br0

[root@localhost ~]# ifconfig eth0 0 up

[root@localhost ~]# brctl show     

bridge name     bridge id               STP enabled     interfaces

br0             8000.000000000000       no

[root@localhost ~]# brctl addif br0 eth0

[root@localhost ~]# ifconfig br0 192.168.1.61/24 up

[root@localhost ~]# route add default gw 192.168.1.254

[root@localhost ~]# ifconfig

br0       Link encap:Ethernet  HWaddr 00:0C:29:5A:FE:D5  

          inet addr:192.168.1.61  Bcast:192.168.1.255  Mask:255.255.255.0

          inet6 addr: fe80::20c:29ff:fe5a:fed5/64 Scope:Link

          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1

          RX packets:431 errors:0 dropped:0 overruns:0 frame:0

          TX packets:127 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:0 

          RX bytes:41011 (40.0 KiB)  TX bytes:15891 (15.5 KiB)


eth0      Link encap:Ethernet  HWaddr 00:0C:29:5A:FE:D5  

          inet6 addr: fe80::20c:29ff:fe5a:fed5/64 Scope:Link

          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1

          RX packets:14050 errors:0 dropped:0 overruns:0 frame:0

          TX packets:2197 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:1000 

          RX bytes:5399019 (5.1 MiB)  TX bytes:157286 (153.5 KiB)

          Interrupt:19 Base address:0x2000 


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:65536  Metric:1

          RX packets:8 errors:0 dropped:0 overruns:0 frame:0

          TX packets:8 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:0 

          RX bytes:958 (958.0 b)  TX bytes:958 (958.0 b)

  


本文出自 “追梦” 博客,请务必保留此出处http://sihua.blog.51cto.com/377227/1885735

49 Linux操作系统原理、虚拟化技术基础原理

标签:虚拟化

原文地址:http://sihua.blog.51cto.com/377227/1885735

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