首页 > 系统服务 > 详细

Ubuntu 16.04.4的网络配置

时间:2018-12-14 19:13:24      阅读:134      评论:0      收藏:0      [点我收藏+]
1、查看网卡状态
root@Ubuntu-Ansible:~# ifconfig -a
root@Ubuntu-Ansible:~# ip addr
root@Ubuntu-Ansible:~# ip route show

2、设置静态IP

root@Ubuntu-Ansible:~# vim /etc/network/interfaces

加入如下内容:

auto eth0
iface eth0 inet static
address 192.168.1.5
gateway 192.168.1.1
netmask 255.255.255.0 

3、配置DNS

root@Ubuntu-Ansible:~# vim /etc/resolvconf/resolv.conf.d/base

DNS修改如下文件,默认是空的,在里面加入DNS服务器,一行一个

nameserver 180.76.76.76          # 百度DNS
nameserver 223.5.5.5                # 阿里DNS

保存后执行:

root@Ubuntu-Ansible:~# /sbin/resolvconf -u

root@Ubuntu-Ansible:~# etc/init.d/resolvconf restart

4、查看DNS

root@Ubuntu-Ansible:~# cat /etc/resolv.conf

5、重启网络服务

root@Ubuntu-Ansible:~# /etc/init.d/networking restart

6、一般此时已经可以联网,ping www.baidu.com 是可以ping通的 ,若不行,请尝试:

重启网卡:
root@Ubuntu-Ansible:~# ifconfig eht0 down
root@Ubuntu-Ansible:~# ifconfig eht0 up
重启Ubuntu:
root@Ubuntu-Ansible:~# reboot

7、网络OK了,不能SSH远程连接,检查sshd服务

root@Ubuntu-Ansible:~# ps -e|grep ssh
root@Ubuntu-Ansible:~# apt-get install openssh-sever

8、启动ssh

root@Ubuntu-Ansible:~# /etc/init.d/ssh start
root@Ubuntu-Ansible:~# netstat -tlp

8、Ubuntu升级更新

root@Ubuntu-Ansible:~# apt-get update
root@Ubuntu-Ansible:~# apt-get upgrade
root@Ubuntu-Ansible:~# apt-get dist-upgrade
root@Ubuntu-Ansible:~# reboot

Ubuntu 16.04.4的网络配置

原文:http://blog.51cto.com/tangyade/2330627

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!