virtualbox虚机不同网段
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了virtualbox虚机不同网段相关的知识,希望对你有一定的参考价值。
环境:
主机:MacPro
虚拟化软件:VirtualBox
虚拟机1:
操作系统: Redhat 5.8 ,hostname :edu
网卡eth0:采用桥接
采用桥接的主要目的是为了在mac主机中能够使用CRT ssh 连接 edu(如果采用NAT方式,在mac中无法使用CRT ssh连接到虚拟机)
网卡eth1:采用internal方式,IP静态IP(我这里dhcp无法获取成功,不知道原因)
#ifconfig eth0 eth0 Link encap:Ethernet HWaddr 08:00:27:7E:42:4B inet addr:192.168.31.30 Bcast:192.168.31.255 Mask:255.255.255.0 inet6 addr: fe80::a00:27ff:fe7e:424b/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:79246 errors:0 dropped:0 overruns:0 frame:0 TX packets:30349 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:52963311 (50.5 MiB) TX bytes:5542244 (5.2 MiB)
[[email protected] ~]# cat /etc/sysconfig/network-scripts/ifcfg-eth0 # Intel Corporation 82540EM Gigabit Ethernet Controller DEVICE=eth0 BOOTPROTO=static HWADDR=08:00:27:7E:42:4B ONBOOT=yes IPADDR=192.168.31.30 NETMASK=255.255.255.0 GATEWAY=192.168.31.1 #PEERDNS=no
[[email protected] ~]# ifconfig eth1 eth1 Link encap:Ethernet HWaddr 08:00:27:53:19:F9 inet addr:10.10.10.10 Bcast:10.10.10.255 Mask:255.255.255.0 inet6 addr: fe80::a00:27ff:fe53:19f9/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:1998 errors:0 dropped:0 overruns:0 frame:0 TX packets:2473 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:246762 (240.9 KiB) TX bytes:231063 (225.6 KiB)
[[email protected] ~]# cat /etc/sysconfig/network-scripts/ifcfg-eth1 # Intel Corporation 82540EM Gigabit Ethernet Controller DEVICE=eth1 BOOTPROTO=static ONBOOT=yes HWADDR=08:00:27:53:19:f9 IPADDR=10.10.10.10 NETMASK=255.255.255.0
edu虚拟机可以上外网,可以和主机互通。
另外一台虚拟机2:edu clone
网卡eth1:采用internel模式
[[email protected] ~]# ifconfig eth0 eth1 Link encap:Ethernet HWaddr 08:00:27:CE:13:8B inet addr:10.10.10.20 Bcast:10.10.10.255 Mask:255.255.255.0 inet6 addr: fe80::a00:27ff:fece:138b/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:2273 errors:0 dropped:0 overruns:0 frame:0 TX packets:2419 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:226290 (220.9 KiB) TX bytes:304248 (297.1 KiB)
[[email protected] ~]# cat /etc/sysconfig/network-scripts/ifcfg-eth1 # Intel Corporation 82540EM Gigabit Ethernet Controller DEVICE=eth1 BOOTPROTO=static ONBOOT=yes HWADDR=08:00:27:ce:13:8b TYPE=Ethernet IPADDR=10.10.10.20 NETMASK=255.255.255.0
edu clone 可以和edu通过10这个同网段ip互通,不能连主机,不能上外网(想上外网可以把桥接的eth0启用起来,但是会妨碍到我实验,就用这种很2的方式好了)
edu上:
edu clone上:
一直想通过一台虚拟机设置网卡桥接,一台虚拟机设置网卡nat方式,不同网段来互通,
比如桥接的:192.168.31.0/24网段和nat的:192.168.73.0/24网段互通,并且能和主机通信,能上互联网.....不懂行不行
一直没有成功,网上也没找到详细可靠的操作步骤,就这样将就用好了,至少是不同网段的两台主机了
edu clone 通过crt Logon Action 使用:sshpass -p password ssh [email protected] 来登录
本文出自 “7628360” 博客,请务必保留此出处http://7638360.blog.51cto.com/7628360/1970057
以上是关于virtualbox虚机不同网段的主要内容,如果未能解决你的问题,请参考以下文章
virtualbox启动虚机报错:The VM session was closed before any attempt to power it on.
virtualbox启动虚机报错:The VM session was closed before any attempt to power it on.