转载:http://wiki.sylixos.com/index.php/Linux%E7%8E%AF%E5%A2%83%E5%BC%80%E5%8F%91%E6%8C%87%E5%8D%97php
Win7 64 + Vmware 11 + ubuntu14.04 32linux
u-boot 版本:u-boot-2015-04ubuntu
Linux kernel版本:linux-3.16.y网络
busybox版本:1_24_stable工具
交叉编译工具链:arm-linux-gnueabi-oop
sudo apt-get install uml-utilities sudo apt-get install bridge-utils
ls -l /dev/net/tun crw-rw-rwT 1 root root 10, 200 Apr 15 02:23 /dev/net/tun
# This file describes the network interfaces available on your system # and how to activate them. For more information, see interfaces(5). # The loopback network interface auto lo iface lo inet loopback # The primary network interface auto eth0 #NetworkManager#iface eth0 inet dhcp
# 通过试验发现,因为我用的是虚拟机,添加了三块虚拟网卡eth0对应的是NAT链接方式,eth2对应的是桥接方式,若是
# 将虚拟机的VMnet8和VMnet1禁止掉的话,eth2就不能工做,此时下面若是是bridge_ports eth2的话,qemu就没法联网了
# 可是发现eth0让然可用,因此这里设置了bridge_ports eth0. auto br0 iface br0 inet dhcp bridge_ports eth0
#!/bin/sh
echo sudo tunctl -u $(id -un) -t $1
sudo tunctl -u $(id -un) -t $1
echo sudo ifconfig $1 0.0.0.0 promisc up sudo ifconfig $1 0.0.0.0 promisc up echo sudo brctl addif br0 $1
sudo brctl addif br0 $1
echo brctl show brctl show sudo ifconfig br0 192.168.11.20
#!/bin/sh
echo sudo brctl delif br0 $1
sudo brctl delif br0 $1
echo sudo tunctl -d $1
sudo tunctl -d $1
echo brctl show brctl show
chmod +x /etc/qemu-ifup chmod +x /etc/qemu-ifdown
运行测试:测试
./qemu-system-arm ...... -net nic,vlan=0 -net tap,vlan=0,ifname=tap0
warning: could not configure /dev/net/tun: no virtual network emulation Could not initialize device 'tap'
/etc/qemu-ifup tap0