1. 程式人生 > 其它 >Kali本地網路配置

Kali本地網路配置

技術標籤:Kali

文章目錄


1、檢視IP

1.1、檢視eth0網絡卡

#檢視第一塊網絡卡IP
ifconfig eth0 

1.2、檢視IP

iconfig

1.3、檢視路由表

#檢視路由表
route 

#檢視路由表
netstat -rn

1.4、開啟關閉eth0網絡卡

  • 開啟eth0
#開啟eth0
ifconfig eth0 up
  • 關閉eth0
#關閉eth0
ifconfig eth0 down

2、臨時配置IP地址

  • 臨時配置的IP,直到重啟網路服務。
#臨時配置IP
ifconfig eth0 192.168.80.150/24
#設定預設閘道器
route add default gw 192.168.1.1

3、配置DNS

3.1、配置路徑

  • 配置DNS伺服器
#配置DNS伺服器
ech0 nameserver 10.64.0.10>/etc/resolv.conf
  • DNS配置路徑
#DNS配置路徑
/etc/resolv.conf

4、永久配置IP地址

4.1、配置路徑

#配置路徑
/etc/network/interfaces

4.2、配置資訊

  • 路由器資訊
    在這裡插入圖片描述
  • 配置資訊
#配置資訊如下
# 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 dhcp
iface eth0 inet static		#靜態分配IP
address 192.168.80.153 #ip netmask 255.255.255.0 gateway 192.168.80.1

在這裡插入圖片描述

4.3、重啟服務

重啟網路服務有兩種方法。

方法一:

#重啟網路服務
systemctl restart networking

方法二:

#重啟網路服務
/etc/init.d/networking restart