虚拟机下Linux联网配置

以virtualbox为例, 其实VMware他们俩设置基本上相同,只是virtualbox更轻量级一些,使用起来更方便:

- 虚拟机外部设置

  • 使用桥接方式联网
    在virtualbox【设置】页面中点击【网络选项】,在【连接方式(A)】中选择“桥接网卡”,混杂模式中选择“全部允许”。
    外部设置完成了,若linux虚拟机已经启动,则需要重启才能生效。

- 虚拟机内部(Linux)设置

网络接口配置文件
[root@localhost ~]# cat /etc/sysconfig/network-scripts/ifcfg-eth0
Intel Corporation 82545EM Gigabit Ethernet Controller (Copper)
TYPE=Ethernet #网卡类型
DEVICE=eth0 #网卡接口名称
ONBOOT=yes #系统启动时是否自动加载(默认为no,改为yes)
BOOTPROTO=dhcp
重新导入ifcfg-eth0网络配置文件
[root@localhost ~]# /etc/init.d/network reload
Shutting down interface eth0: [ OK ]
Shutting down loopback interface: [ OK ]
Bringing up loopback interface: [ OK ]
Bringing up interface eth0: [ OK ]

- 打完收工

网卡接口关闭与激活
[root@localhost ~]# ifdown eth0 #关闭网络
[root@localhost ~]# ifup eth0 #启动网络

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值