临时配置ip

ifconfig eth0 up              //端口启用
ifconfig eth0 down //端口关闭
ifconfig eth0 192.168.1.10 //只修改ip地址
ifconfig eth0 192.168.1.10/ 或者 ifconfig eth0 1.1.1.1 netmask 255.0.0.0

临时修改路由

route          //查看路由表
netstat -rn //查看路由表
route del default eth0 //删除eth0上的默认路由
route add default gw 192.168.1.1 //添加默认路由

修改配置文件修改网卡信息

/etc/network/interfaces

auto lo
iface lo inet loopback
allow-hotplug eth0
iface eth0 inet dhcp iface eth0 inet6 auto 修改为: auto lo
iface lo inet loopback
allow-hotplug eth0
auto eth0 # 增加了该选项,因为使用networking restart时系统启动 auto的网卡,如不加上则启动无反应
iface eth0 inet static # 配置了static 为静态ip | 自动获取 iface eth0 inet dhcp
address 192.168.1.4 # 设置ip地址
netmask 255.255.255.0 # 设置掩码
gateway 192.168.1.1 # 设置网关
dns-nameservers 223.5.5.5 # 错误的
 iface eth0 inet6 auto # 可写可不写

终端命令行下重启网络:service networking restart或 /etc/init.d/networking restart 。

报错信息

root@bogon:~# /etc/init.d/networking restart
[....] Restarting networking (via systemctl): networking.serviceJob for networking.service failed because the control process exited with error code.
See "systemctl status networking.service" and "journalctl -xe" for details.
failed!
root@bogon:~# vim /etc/network/interfaces
root@bogon:~# systemctl status networking.service
● networking.service - Raise network interfaces
Loaded: loaded (/lib/systemd/system/networking.service; enabled; vendor prese
Active: failed (Result: exit-code) since Sun -- :: CST; 58s ago
Docs: man:interfaces()
Process: ExecStartPre=/bin/sh -c if [ "$CONFIGURE_INTERFACES" != "no" ] &
Process: ExecStart=/sbin/ifup -a --read-environment (code=exited, status=
Main PID: (code=exited, status=/FAILURE) 4月 :: bogon systemd[]: Starting Raise network interfaces...
4月 :: bogon ifup[]: Not enough information: "dev" argument is requ
4月 :: bogon ifup[]: ifup: failed to bring up eth0
4月 :: bogon systemd[]: networking.service: Main process exited, code=
4月 :: bogon systemd[]: networking.service: Failed with result 'exit-c
4月 :: bogon systemd[]: Failed to start Raise network interfaces.
lines -/ (END)

注意代码后面不能有注释,否则报错,需要把注释删除掉

# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(). 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.135
netmask 255.255.255.0
gateway 192.168.2.1

修改dns配置文件

缺点: 重启后会消失

/etc/resolv.conf
nameserver 202.106.0.20
nameserver 202.106.46.151 修改为:
nameserver 202.106.0.20
nameserver 202.106.46.151
nameserver 8.8.8.8

Kali配置网卡静态信息的更多相关文章

  1. 虚拟机桥接网卡下配置centOS静态IP

    前面我们讲了怎么去配置asterisk,但是配置完了,是没有什么效果出现的,因为asterisk相当于一个服务器,我们需要一个客户端去给它连接起来,如果你是在自己的机子上装了虚拟机,那最好配一下cen ...

  2. linux配置网卡IP地址命令详细介绍及一些常用网络配置命令

    linux配置网卡IP地址命令详细介绍及一些常用网络配置命令2010-- 个评论 收藏 我要投稿 Linux命令行下配置IP地址不像图形界面下那么方 便,完全需要我们手动配置,下面就给大家介绍几种配置 ...

  3. 改动网卡IP信息

    改动网卡IP信息的情况有非常多种,只是从大体上能够分为两种,一种是暂时改动,重新启动网络服务后改动便会失效:一种是永久改动,重新启动网络服务后才会生效.一般暂时改动应用在暂时的动作中,我们通过分类名字 ...

  4. 手动配置网卡配置文件ifcfg-eth0

    linux 其他知识目录 原文链接:https://www.cnblogs.com/arvintang/p/5990599.html 网络接口配置文件[root@localhost ~]# cat / ...

  5. (转)linux配置网卡的命令

    linux配置网卡的命令 原文:http://blog.51cto.com/lanxianting/1754923 1.配置命令 如果一台服务器需要通外网,能被远程连接,就得给这个台服务器配置ip,子 ...

  6. CentOS配置网卡以及克隆

    上一篇的虚拟机安装完成后是可以上网的,但是ip地址是动态的,因为后期的需要,我们要配置下网卡,改成静态的IP地址 1.打开终端,输入 ifconfig 查看虚拟机中的网卡,发现时ens33而不是平常见 ...

  7. Ubuntu18.04 配置网卡、替换软件源

    2019/10/29, Ubuntu Server 18.04 摘要:Ubuntu Server 18.04 采用netplan作为网络配置管理,修改IP使其连上网络,修改替换软件源 修改网卡配置 首 ...

  8. 日常工作问题解决:centos7下配置网卡以及查询网卡UUID

    目录 1.配置网卡 1.1 网卡查看命令:ifconfig -a 1.2 网卡配置文件说明 1.3 重启网络服务 2.查看确认网卡UUID 2.1 网卡配置文件正常时 2.2 网卡配置文件不可用或者配 ...

  9. Linux下设置网卡静态ip

    Linux下设置网卡静态ip 如果是服务器版,没有图形界面只用用命令行修改配置文件 如果是客户端版本,可以用图形界面 配置的前提是要在root用户下才能重启网卡服务 图形界面: system-conf ...

随机推荐

  1. WebClient请求帮助类

    /// <summary> /// 通过JSON方式发送POST请求 /// 将返回结果按JSON方式解析 /// </summary> public static class ...

  2. 菜鸟调错(二)——EJB3.0部署消息驱动Bean抛javax.naming.NameNotFoundException异常

    在部署EJB的消息驱动Bean时遇到了如下的错误: ERROR [org.jboss.resource.adapter.jms.inflow.JmsActivation] (WorkManager(2 ...

  3. 深入云存储系统Swift核心组件:Ring实现原理剖析

    http://www.cnblogs.com/yuxc/archive/2012/06/22/2558312.html 简介 OpenStack是一个美国国家航空航天局和Rackspace合作研发的开 ...

  4. 每日英语:China Pipeline Explosions Kill 52

    BEIJING—The death toll from a pair of oil pipeline explosions on Friday in the eastern China port ci ...

  5. 【delphi】Byte数组与String类型的转换

    string string = AnsiString = 长字符串,理论上长度不受限制,但其实受限于最大寻址范围2的32次方=4G字节: 变量Str名字是一个指针,指向位于堆内存的字符序列,字符序列起 ...

  6. Pythonic版二分查找

    [本文出自天外归云的博客园] 前提:升序数组,待查元素在数组中. 二分查找:就是一个递归函数c.待查元素a,当前数组中位数b,如果b=a则返回b的索引,b>a则在b左侧的子数组中调用函数c,否则 ...

  7. 1. AutoEncoder介绍

    1. AutoEncoder介绍 2. Applications of AutoEncoder in NLP 3. Recursive Autoencoder(递归自动编码器) 4. Stacked ...

  8. 基于jQuery滑动分步式进度导航条代码

    分享一款基于jQuery滑动分步式进度导航条代码.这是一款基于jquery实现的网站注册动态步骤导航条代码.效果图如下: 在线预览   源码下载 实现的代码. html代码: <div id=& ...

  9. 华为路由器GRE配置

    1. 协议简介 gre(generic routing encapsulation,通用路由封装)协议是对某些网络层协议(如ip 和ipx)的数据报进行封装,使这些被封装的数据报能够在另一个网络层协议 ...

  10. Tomcat的JVM和连接数设置

    Tomcat的JVM和连接数设置 Windows环境下修改“%TOMCAT_HOME%\bin\catalina.bat”文件,在文件开头增加如下设置:set JAVA_OPTS=-Xms256m - ...