在Kali系统配置临时IP和静态IP

本文详细介绍如何在Kali Linux中配置临时IP和静态IP,包括设置步骤、配置文件编辑及DNS服务器配置等内容,并提供了具体操作命令。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

在Kali系统配置临时IP和静态IP

虚拟机网卡采用桥接方式桥接网络,即kali系统的网络IP段与物理机的网络IP段相同,网关相同。

1. 查看物理机IP段,打开CMD,输入ipconfig ,得到ip段为 192.168.2.0段,网关为 192.168.2.1

D:\video\tmp>ipconfig

Windows IP 配置


无线局域网适配器 WLAN:

   连接特定的 DNS 后缀 . . . . . . . : ctc
   本地链接 IPv6 地址. . . . . . . . : fe80::a17a:1a55:c628:abbb%5
   IPv4 地址 . . . . . . . . . . . . : 192.168.2.9
   子网掩码  . . . . . . . . . . . . : 255.255.255.0
   默认网关. . . . . . . . . . . . . : 192.168.2.1

2.在kali系统里,设置临时IP,重启后IP会变化

编辑 /etc/network/interfaces 文件,在最末端加上

auto eth0  # 启动生效网卡

iface eth0 inet dhcp #设置网卡获取IP访问为 dhcp

在终端执行

systemctl restart networking # 重启网络服务

reboot # 重启kali

ifconfig eth0 192.168.2.53/24  #设置临时IP为192.168.2.53,重启失效

route add default gw 192.168.2.1 #设置默认网关 192.168.2.1 

3.在Kali系统里,设置静态IP,重启后IP不变

编辑 /etc/network/interfaces 文件,在最末端加上

address 192.168.2.53
netmask 255.255.255.0
gateway 192.168.2.1

把 iface eth0 inet dhcp 修改为 iface eth0 inet static

最后如下

cat /etc/network/interfaces

 

root@xg:~# cat /etc/network/interfaces
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

source /etc/network/interfaces.d/*

# The loopback network interface
auto lo
iface lo inet loopback
auto eth0
iface eth0 inet static
address 192.168.2.53
netmask 255.255.255.0
gateway 192.168.2.1

 

 4. 在Kali系统,设置DNS

配置Kali系统默认的DNS服务器,常用的国内 114.114.114.114,国外谷歌  8.8.8.8

在 /etc/resolv.conf 最末尾添加

nameserver 8.8.8.8
nameserver 114.114.114.114

如下 cat /etc/resolv.conf

 

 

root@xg:~# cat /etc/resolv.conf 
nameserver 8.8.8.8
nameserver 114.114.114.114

5.  重启网络服务

systemctl restart networking

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值