轉載: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