nano /etc/network/interfaces /etc/network/interfacesbak #备份原有配置文件
nano /etc/network/interfaces #编0 W B ~ q i - ,辑网网卡配置文件
auto lo
iface lo inet loop! O ) G Q 8 a dback
auto eth0 #开机自动连接网络
in [ 8 ( +face eth0 inet static #static表示使用固定ip,dhcp表述使用动态ip
address 1/ x 79- 4 J , D2.168.1.10 #设置ip地址举例为192.160 R |8.1.10
netmask 255.255.255.0 #设置子网掩码
gateway 192.168.1.1 #设置网关
ctrl+o #保存配置
ctrl+x #退出
2、设置dns
cp /[ ~ 4 p dem 4 / 5 Dtc/resolv.conf /etc/resolv.confbak #备份原有dns配置文件
nano /etc/rZ s # ^ Pesolv.c$ Y ( X 8 donf #编辑配置文件! K 9,添加以下内容
nameserver 8.8.8.8 #设置首选dns
nameserver 8.8.4.4 #设置备用dns
ctrl+o #保存配置
ctrl+x #退出
3、重启网络
/etc/init.d/networking restart #重启网络
至此,IP地址、网关、DNS配置完成[ Z b ;,} # _ { s M W v A现在r b w ( y系统已经可以上网了。
如需了解更多有关于Ubuntu知识点,可关注利联科技的网络安全方面。h G r ] y G ~有_ 3 P ! 1 ) E L更多关于服务器内的知识点在等着你发掘
发表评论