1.设置ip
sudo ifconfig eth0 192.168.1.121
2.设置网关
sudo route add default gw 192.168.1.1 eth0
3.设置dns
sudo -i
echo "nameserver 8.8.8.8" > /etc/resolve.conf
真实有效,这篇博客转自https://www.cnblogs.com/dakewei/p/10424453.html