zxq6 发表于 2018-12-31 14:15:29

petalinux启动虚拟机映像后,不能和windows通信的一个解决方案

1.条件
a.windows环境下安装VMware,VMware里面安装Ubuntu,Ubuntu里面,使用petalinux-boot --qemu启动petalinux 镜像
b.将petalinux 的ip设置为自动获取。再通过如下命令设置其ip,gw,mask等
    ifconfig eth0 192.168.5.5 netmask 255.255.0.0
    route add default gw 192.168.5.1
c.ubuntu的网卡设置为桥接模式
d.这个时候,window是没法ping petalinux的,peta里面也没法ping window
e.物理路由器的ip地址是192.168.1.1
g.windows的ip是192.168.1.66
2.设置petalinux宿主主机的网桥
a.sudo apt-get install uml-utilities,安装网桥组件
b.sudo apt-get install bridge-utils
c.sudo brctl addbr br0,添加0号桥
d.sudo brctl addif br0 eth0,以下两个,是将宿主主机的物理网卡跟虚拟网卡连接起来
e.sudo brctl addif br0 tap0
f.sudo ifconfig br0 192.168.5.2 netmask 255.255.0.0 up,设置网桥的ip地址
g.sudo route add default gw 192.168.5.1,设置网桥的网关
h.sudo route add default gw 192.168.1.1,本行如果有需要再添加
i.ifconfig,应该看到如下信息

br0       Link encap:EthernetHWaddr 00:0c:29:91:3a:a8
          inet addr:192.168.5.2Bcast:192.168.255.255Mask:255.255.0.0
          inet6 addr: fe80::20c:29ff:fe91:3aa8/64 Scope:Link
          UP BROADCAST RUNNING MULTICASTMTU:1500Metric:1
          RX packets:94 errors:0 dropped:8 overruns:0 frame:0
          TX packets:50 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:6315 (6.3 KB)TX bytes:7818 (7.8 KB)

3.route -n ,应该看到如下信息

Destination   Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         192.168.5.1   0.0.0.0         UG    0      0      0 tap0
0.0.0.0         192.168.1.1   0.0.0.0         UG    0      0      0 eth0
0.0.0.0         192.168.1.1   0.0.0.0         UG    0      0      0 eth0
192.168.0.0   0.0.0.0         255.255.0.0   U   0      0      0 br0
192.168.1.0   0.0.0.0         255.255.255.0   U   1      0      0 eth0
192.168.5.0   0.0.0.0         255.255.255.0   U   0      0      0 tap0
192.168.6.0   0.0.0.0         255.255.255.0   U   0      0      0 tap1
192.168.7.0   0.0.0.0         255.255.255.0   U   0      0      0 tap2


ping的效果图:

wye11083 发表于 2018-12-31 15:33:16

linux下的虚拟机是不能直接和主机通信的,不知道为毛故意写成这样,用起来非常蛋疼,而且kvm开不了加速,radmin很卡,最后服务器又换回win10了。

haffman1 发表于 2018-12-31 16:37:31

装个虚拟机蛋疼搞个服务器啥问题都没
页: [1]
查看完整版本: petalinux启动虚拟机映像后,不能和windows通信的一个解决方案