案例情景:
在linux驱动(arm)学习中,需要将开发板网口用网线直接和电脑网口连接,如果电脑不配置静态ip地址,那么开发板就ping不通电脑(因为此时电脑不会获取ip地址,开发板就没有目地地址来ping了)。
一、给电脑设置静态ip;
1、 sudo vim /etc/network/interfaces
没配置过静态ip地址的interfaces内容如下
# interfaces(5) file used by ifup(8) and ifdown(8)
auto lo
iface lo inet loopback
# interfaces(5) file used by ifup(8) and ifdown(8)
auto lo
iface lo inet loopback
auto eth0
iface eth0 inet static
address 192.168.1.4
gateway 192.168.1.1
netmask 255.255.255.0 3、警告!!!
如果此时重启,将不能链接网络。需要再如下配置