Kali临时和静态IP地址配置方法
临时修改ip地址
1 ifconfig eth0 up //端口启用
2 ifconfig eth0 down //端口关闭
3 ifconfig eth0 192.168.1.10 //只修改ip地址
4 ifconfig eth0 192.168.1.10/24 或者 ifconfig eth0 1.1.1.1 netmask 255.0.0.0 //修改ip地址和掩码
临时修改网关
1 route //查看路由表
2 netstat -rn //查看路由表
3 route del default eth0 //删除eth0上的默认路由
4 route add default gw 192.168.1.1 //添加默认路由
永久修改ip地址和网关
进入配置文件
01 /etc/network/interfaces
02 # This file describes the network interfaces available on your system
03 # and how to activate them. For more information, see interfaces(5).
04
05 # The loopback network interface
06 auto lo
07 iface lo inet loopback
08
09 # The primary network interface
10 allow-hotplug eth0
11 iface eth0 inet dhcp
12 # This is an autoconfigured IPv6 interface
13 iface eth0 inet6 auto
14
15 修改为:
16 # This file describes the network interfaces available on your system
17 # and how to activate them. For more information, see interfaces(5).
18
19 # The loopback network interface
20 auto lo
21 iface lo inet loopback
22
23 # The primary network interface
24 allow-hotplug eth0
25 auto eth0 //增加了该选项,因为使用networking restart时系统启动 auto的网卡,如不加上则启动无反应
26 iface eth0 inet static //配置了static 为静态ip 静态ip怎么设置
27 address 192.168.1.4 //设置ip地址
28 netmask 255.255.255.0 //设置掩码
29 gateway 192.168.1.1 //设置网关
30 # This is an autoconfigured IPv6 interface
31 iface eth0 inet6 auto
配置dns
1 /f
2 nameserver 202.106.0.20
3 nameserver 202.106.46.151
4
5 修改为:
6 nameserver 202.106.0.20
7 nameserver 202.106.46.151
8 nameserver 8.8.8.8
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。
发表评论