最近写基于UDP的图像传输程序,遇到了network is unreachable的问题,ping我的PC发现ping不通,route中也没有任何东西,ifconfig没有IP地址
解决方法:
1 vi /etc/network/interfaces
auto lo
iface lo inet loopback
auto eth0
iface eth0 inet static
#按自己的实际情况改
address 192.168.1.19
netmask 255.255.255.0
gateway 192.168.1.1
2 编辑完毕重启网络服务:service networking restart
现在ifconfig可以看到已经添加了进去,问题得以解决