温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

服务器:Ubuntu设置IP地址、网关、DNS

发布时间:2020-08-07 23:32:02 来源:ITPUB博客 阅读:279 作者:xikunyun 栏目:网络安全

服务器 1、设置IP地址、网关
nano /etc/network/interfaces  /etc/network/interfacesbak   #备份原有配置文件
nano /etc/network/interfaces   #编辑网网卡配置文件
auto lo
iface lo inet loopback
auto eth0  #开机自动连接网络
iface eth0 inet static   #static表示使用固定ip,dhcp表述使用动态ip
address 192.168.21.168   #设置ip地址
netmask 255.255.255.0  #设置子网掩码
gateway 192.168.21.2    #设置网关
ctrl+o   #保存配置
ctrl+x   #退出
2、设置dns
cp  /etc/resolv.conf   /etc/resolv.confbak    #备份原有dns配置文件
nano /etc/resolv.conf   #编辑配置文件,添加以下内容
nameserver 8.8.8.8   #设置首选dns
nameserver 8.8.4.4   #设置备用dns
ctrl+o   #保存配置
ctrl+x   #退出
系统运维 www.osyunwei.com 温馨提醒:qihang01原创内容©版权所有,转载请注明出处及原文链接
3、重启网络
/etc/init.d/networking restart   #重启网络

向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI