目标: 让一个网卡,支持多个IP
1. 修改配置文件(为了让重启之后仍然有用)
/etc/network/interfaces 文件内容如下:
auto lo
iface lo inet loopback
auto eth0
iface eth0 inet static
address 192.168.2.151
netmask 255.255.255.0
gateway 192.168.2.1
auto eth0:0 /*为了调试开发板,开发板IP是192.168.1.6,要向开发板传送bin文件*/
iface eth0:0 inet static
address 192.168.1.151
netmask 255.255.255.0
gateway 192.168.1.1
2. 重启网络服务
/etc/init.d/networking restart
3. 看运行是否正常
ping 192.168.1.150 /*我的Windows XP主机,嘿嘿*/
4. OK啦