virtualbox虛機不同網段
阿新 • • 發佈:2017-10-01
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虛機不同網段