目录
1配置IP
1.配置临时IP
2.配置永久IP
┌──(rootkali)-[~]
└─# ifconfig eth0 192.168.0.5/24
┌──(rootkali)-[~]
└─# route add default gw 192.168.0.1
1.刚开始添加route时会显示网络不可达
需要进入vim /etc/network/interfaces 添加 dhcp
auto eth0
iface eth0 inet dhcp
2.重启kali,这里我选择桥接模式就成功,NAT模式添加不成功。
重新添加一遍ip和route。
┌──(rootkali)-[~] └─# route add default gw 192.168.0.1 ┌──(rootkali)-[~] └─# ifconfig eth0: flags=4163
mtu 1500 inet 192.168.0.5 netmask 255.255.255.0 broadcast 192.168.0.255 inet6 fe80::20c:29ff:fef3:4ff5 prefixlen 64 scopeid 0x20 ether 00:0c:29:f3:4f:f5 txqueuelen 1000 (Ethernet) RX packets 5 bytes 387 (387.0 B) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 8 bytes 656 (656.0 B) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
3.添加DNS服务器
┌──(rootkali)-[~]
└─# vim /etc/resolv.conf
nameserver 114.114.114.114
需要进入vim /etc/network/interfaces刚才配置的 dhcp注释掉
添加iface,address,netmask,gateway
auto eth0
#iface eth0 inet dncp
iface eth0 inet static
address 192.168.0.6
netmask 255.255.255.0
gateway 192.168.0.1
重启网络服务
┌──(rootkali)-[~]
└─# systemctl restart networking
ifconfig 检查一下ip设置是否成果,ping一下看是否成功
└─# ping baidu.com
64 bytes from 39.156.66.10 (39.156.66.10): icmp_seq=1 ttl=51 time=30.2 ms
64 bytes from 39.156.66.10 (39.156.66.10): icmp_seq=2 ttl=51 time=30.0 ms