ubuntu下面的网络配置文件为/etc/network/interfaces
所以如果想要修改网络相关配置,需要进入到该文件下。
1.dhcp配置
auto eth0
iface eth0 inet dhcp
2.静态网络配置
auto eth0
iface eth0 inet static
address 10.0.0.1
netmask 255.255.255.0
gateway 10.0.255.254
网络配置完成后使用/etc/init.d/networking restart 重新启动网络。
这样有线网络已经可以使用。
如果想要使用无线网络的话,配置如同有线网络。
但是我们需要启动无线网卡并且搜索可以检查到的无线网络。
ifconfig wlan0 up
iwlist wlan0 scan
然后继续连接无线网络。
iwconfig wlan0 essid ubuntu key 12345lenovo
如果报错,是因为ubuntu对于wpa密码支持不够。
wpa_passphrase ESSID KEY > xxx.conf
然后配置文件中配置改为如下
auto wlan0
iface wlan0 inet static
address 10.0.0.1
netmask 255.255.255.0
gateway 10.0.255.254
wpa_conf xxx.conf
然后重启网络即可。