zoukankan      html  css  js  c++  java
  • kali_网络配置

    前提

    查看设置的vmware网络模式

    NAT模式

    1.打开虚拟网络编辑器

    2.管理员更改设置

    3.根据自己的需要更改虚拟机的网段

    4.设置网关IP

    5.查看物理机上的虚拟网络适配器是否启动(很多时候虚拟机的网络出现问题就是这个导致的)

    6.进入kali虚拟机设置网络
    vim打开网络配置文件

    root@kali:~# vim /etc/network/interfaces
    

    按i写入如下的配置文件,保存退出

    source /etc/network/interfaces.d/*
    auto lo
    iface lo inet loopback
    auto eth0
    iface eth0 inet static
    address 你的IP地址
    netmask 你的子网掩码
    gateway 你的网关
    nameserver 你的DNS地址
    

    然后重启网络,生效配置

    root@kali:~# systemctl restart networking
    
    

    临时配置网络(重启系统就会失效)

    临时设置IP地址

    root@kali:~# ifconfig eth0 192.168.139.222/24
    
    

    临时设置网关地址

    root@kali:~# route add default gw 192.168.139.140
    
    

    配置DNS地址

    root@kali:~# echo nameserver 8.8.8.8 >/etc/resolv.conf
    
    

    脚本

    在测试情况中,可能需要频繁的修改网络设置,这里我写的有一个简单的脚本

    #!/bin/bash
    net_path=/etc/network/interfaces
    
    echo -e "e[1;32;41m The default network acquisition mode is static acquisition, if you want to modify it, please enter DHCPe[0m"
    read connection
    if [ "$connection"  = "DHCP" ];then
        connection="dhcp"
    else
        connection="static"
    fi
    echo -e "e[1;32;41m Please enter IP addresse[0m"
    read IP
    echo -e "e[1;32;41m If you need to specify a DNS address press y,Or press any key to use the default address(114.114.114.114)e[0m"
    read DNS_var
    if [ "$DNS_var"  = "y" ];then
        echo "OK!Please enter DNS address"
    	read DNS
    else
        DNS=114.114.114.114
    fi
    echo -e "e[1;32;41m Please enter Gateway addresse[0m"
    read GATEWAY
    echo -e "e[1;32;41m If you need to specify a subnet mask press y,Or press any key to use the default address(255.255.255.0)e[0m"
    read NETMASK_var
    if [ "$NETMASK_var"  = "yes" ];then
        echo "OK!Please enter subnet mask address"
    	read NETMASK
    else
        NETMASK=255.255.255.0
    fi
    
    
    echo "source /etc/network/interfaces.d/*" >$net_path
    echo "auto lo" >>$net_path
    echo "iface lo inet loopback" >>$net_path
    echo "auto eth0" >>$net_path
    echo "iface eth0 inet "$connection"" >>$net_path
    echo "address "$IP"" >>$net_path
    echo "netmask "$NETMASK"" >>$net_path
    echo "gateway "$GATEWAY"" >>$net_path
    echo "nameserver "$DNS"" >>$net_path
    
    systemctl restart networking
    
    ping -c 1 www.baidu.com >/dev/null 2>&1
    if [ "$?" = 0 ];then
        echo "Your network configuration is successful!"
    else
        echo "YYour network configuration failed, please check and try again!"
    fi
    

    拉到kali里面运行就好了

  • 相关阅读:
    QT中的qmake详解
    Qt setStyleSheet 添加背景色/背景图片(取消背景色,读取本地文件作为背景色)
    目标HttpController在ASP.NET Web API中是如何被激活的:目标HttpController的选择
    分页写法小结
    SharePoint 2013 搜索高级配置(Search Scope)
    Scut游戏服务器免费开源框架-3
    物理数据模型(PDM)->概念数据模型 (CDM)->面向对象模型 (OOM):适用于已经设计好数据库表结构了。
    一种不错的扩展方式
    ORM框架
    代码最简化
  • 原文地址:https://www.cnblogs.com/hxlinux/p/14456855.html
Copyright © 2011-2022 走看看