临时配置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. 【Unity】6.1 Unity中的C#脚本基础知识

    分类:Unity.C#.VS2015 创建日期:2016-04-16 一.简介 1.常用的C#数据类型 这里简单介绍用Unity开发游戏时,最常用的一些数据类型. (1)基本类型 int.float. ...

  2. Flink papers

    Around 2009 the Stratosphere research project started at the TU Berlin which a few years later was s ...

  3. nginx 并发数问题思考:worker_connections,worker_processes与 max clients

    我相信,很多人都跟我一样,看书都不会太细致也不太认真思考,感觉书中讲的东西都应该是对的,最近读书时我发现以前认为理所当然的东西事实上压根都没有弄明白,最终的结果是,书是别人的,书中的知识也是别人的. ...

  4. 李洪强iOS经典面试题

    李洪强iOS经典面试题 1. struct和class的区别 swift中,class是引用类型,struct是值类型.值类型在传递和赋值时将进行复制,而引用类型则只会使用引用对象的一个"指 ...

  5. 光照渲染[Unity]

    http://www.unitymanual.com/m/Manual/RenderingPaths.html http://wenku.baidu.com/view/54eca9e09b896802 ...

  6. RAID常见问题集锦+底部案例

    磁盘阵列(Redundant Arrays of Inexpensive Disks,RAID),有“价格便宜具有冗余能力的磁盘阵列”之意.原理是利用数组方式来作磁盘组,配合数据分散排列的设计,提升数 ...

  7. replace()的使用方法

    replace() 方法用于在字符串中用一些字符替换另一些字符,或替换一个与正则表达式匹配的子串. 数字类型的必须转换成字符串才能使用replace,否则会报错

  8. js实现上传图片本地预览功能以及限制图片的文件大小和尺寸大小

    方法一: js: /**     * 上传图片本地预览方法     * @param {Object} fileObj 上传文件file的id元素  fresh-fileToUpload      * ...

  9. Lintcode:Longest Common Subsequence 解题报告

    Longest Common Subsequence 原题链接:http://lintcode.com/zh-cn/problem/longest-common-subsequence/ Given ...

  10. Web性能压力测试工具之WebBench

    在运维工作中,压力测试是一项很重要的工作.比如在一个网站上线之前,能承受多大访问量.在大访问量情况下性能怎样,这些数据指标好坏将会直接影响用户体验.但是,在压力测试中存在一个共性,那就是压力测试的结果 ...