临时配置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. Python Socket网络编程详解

    Socket 简介 socket通常也称作"套接字",用于描述IP地址和端口,是一个通信链的句柄,应用程序通常通过"套接字"向网络发出请求或者应答网络请求. s ...

  2. 关于checkbox选中问题总结

    (1)ng-checked的值只是用来决定初始状态时选中还是为选中,ng-model  才是随着复选框是否被选中,来实时改变它绑定变量的值. (2)如果初始状态ng-checked和ng-model指 ...

  3. calcite 理论

    https://blog.csdn.net/yunlong34574/article/details/46375733 https://cloud.tencent.com/developer/arti ...

  4. 每日英语:Booming Tech Sector Redraws the Map

    China's high-tech companies have made their mark on the nation's economy. Now, with growing cash and ...

  5. python2/3中 将base64数据写成图片,并将图片数据转为16进制数据的方法、bytes/string的区别

    1.python2将base64数据写成图片,并将数据转为16进制字符串的方法 import binascii img = u'R0lGODlhagAeAIcAAAAAAAAARAAAiAAAzABE ...

  6. 在java代码中,用xslt处理xml文件

    http://blog.csdn.net/zhou_lei/article/details/2661735 ********************************************** ...

  7. Java后端测试概述

    [本文出自天外归云的博客园] 多种单测技术 1. 要学会Spring MVC/Boot测试中自带的mock方法. 2. 学会junit中的方法,对于注解的使用等. 3. 学会使用结合第三方Mockit ...

  8. python zeromq 使用

    Reference: http://blog.csdn.net/kwsy2008/article/details/49464663 本篇博客将介绍zmq应答模式,所谓应答模式,就是一问一答,规则有这么 ...

  9. WCF数据契约

    当使用DataMember时,和访问符无关,及时使用了private,成员都是可见的.相反如果使用static,为不可见. 上述的两个数据成员是等效的,如果是等效的话 数据成员的顺序也必须是相同的. ...

  10. 常用Git命令清单(转)

    文/阮一峰 我每天使用 Git ,但是很多命令记不住. 一般来说,日常使用只要记住下图 6 个命令,就可以了.但是熟练使用,恐怕要记住 60-100 个命令. 下面是我整理的常用 Git 命令清单.几 ...