家中的路由器普遍通过DHCP向连接到此路由器的客户主机提供IP配置方式,但是一般都是动态IP;
假设需要静态IP配置到个人电脑,就要在路由器上进行配置IP和MAC地址映射关系。如上篇截图。路由器端配置完,继续在本地主机配置。
我的操作系统是Ubuntu16.04,默认使用NetworkManager管理网络连接,所以首先由禁用NetworkManager
1.stop and disable NetworkManager
sudo systemctl stop NetworkManager sudo systemctl disable NetworkManager
2.drop status of NetworkManger
sudo mv /var/lib/NetworkManager/NetworkManager.state /var/lib/NetworkManager/NetworkManager.state.bak
3.edit interfaces
sudo vim /etc/network/interfaces
# interfaces(5) file used by ifup(8) and ifdown(8) auto lo iface lo inet loopback auto wlan0 iface wlan0 inet static netmask 255.255.255.0 gateway 192.168.0.1 address 192.168.0.5 pre-up ip link set wlan0 up pre-up iwconfig wlan0 essid ssid wpa-ssid Tenda_68A3D8 # ssid wpa-psk wxfzwqhqq # password
4. config resolve.conf and add nameserver
sudo vim /etc/resolv.conf or sudo vim /etc/resolvconf/resolv.conf.d/base
nameserver 192.168.0.1
5. restart networking
sudo /etc/init.d/networking restart