kali本地网络配置

没落的情绪 2020-07-29 PM 915℃ 0条

一、临时配置IP
1、查看IP地址

ifconfig

2、临时配置IP

ifconfig eth0 192.168.1.53/24

eth0是第一块网卡,eth1是第二块网卡, /24指的是子网掩码,就是255.255.255.0

3、添加默认网关(配置默认路由)

route add default gw 192.168.1.1

4、配置DNS服务器

vim /etc/resolv.conf

二、永久配置IP
1、打开网络配置文件

vim /etc/network/interfaces

2、在iface lo inet loopback下面添加以下内容

auto eth0
iface eth0 inet static          #配置eth0使用静态地址
address 192.168.1.53        #配置eth0的固定IP地址
netmask 255.255.255.0      #配置子网掩码
gateway 192.168.1.1         #配置网关

3、如果原文件中有 iface eth0 inet dhcp 就在行首添加#注释掉 (这行是自动获取)
4、打开resolv.conf文件

vim /etc/resolv.conf

5、在文档最后插入DNS

# Generated by NetworkManager
nameserver 192.168.1.254
nameserver 8.8.8.8

6、重启网络服务

systemctl restart networking
标签: Linux

非特殊说明,本博所有文章均为博主原创。

评论啦~