TB_信息安全_点滴

collect info about work need

ubuntu查看network状态

2022-7-17 admin 网络


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

评论:

admin
2022-07-17 22:12
ubuntu dns设定文件 #vim /etc/reslov.conf

发表评论: