安装ubuntu,配置可用的源,做好更新系统的准备,发现不能上网......
于是配置上网环境,因为实验室用的都是固定IP,所以要将Ubuntu设置为静态IP才可以。
方法如下:
(1)修改网络配置文件网络配置信息存储在/etc/network/interfaces文件中
sudo vi /etc/network/interfaces
vi打开,显示如下内容:
复制代码 代码如下:
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
# The loopback network interface
auto lo
iface lo inet loopback
配置文件中只有一个环回地址,即127.0.0.1。在下面添加:
复制代码 代码如下:
auto eth0 #指明网卡eth0在系统启动时自动加载
iface eth0 inet static #指明eth0采用ipv4地址,inet表示ipv4地址,inet6表示ipv6地址;static表示静态,dhcp表示动态
address 172.22.112.13 #静态ip
netmask 255.255.255.128 #子网掩码
gateway 172.22.112.1 #网关地址
:wq