ifconfig

常用网络管理命令

断了今生、忘了曾经 提交于 2019-11-27 16:18:18
ifcfg命令家族: ifconfig命令:接口及地址查看和管理 使用:ifconfig [-a] [-v] [-s] [[ ] ] [root@node0 ~]# ifconfig #直接使用显示当前所有以启用接口信息 [root@node0 ~]# ifconfig -a #显示所有接口信息,包括down掉的接口 [root@node0 ~]# ifconfig -s #显示接口统计信息 Iface MTU RX-OK RX-ERR RX-DRP RX-OVR TX-OK TX-ERR TX-DRP TX-OVR Flg docker0 1500 0 0 0 0 0 0 0 0 BMU eth0 1500 348847 0 0 0 925801 0 0 0 BMRU lo 65536 33 0 0 0 33 0 0 0 LRU # ifconfig IFACE IP/MASK [up|down] # ifconfig IFACE IP netmask NETMASK [root@node0 ~]# ifconfig eth1 192.168.0.100/24 up [root@node0 ~]# ifconfig eth1 192.168.0.100 netmask 255.255.0.0 up #给eth1配置地址并启用 options: [-]promisc [root

Docker的网络模型

|▌冷眼眸甩不掉的悲伤 提交于 2019-11-27 14:56:21
网络名称空间的使用 net namespaces是6个名称空间中的一个,可用于隔离网络设备和服务,只有拥有同样网络名称空间的设备猜能看到彼此。而构造一个网络名称空间只需要用到ip netns及ip link相关的子命令即可,下面是一些简单用法。 ip netns add n1 #添加一个网络名称空间 ip netns add n2 ip netns list #查看当前的网络名称空间 ip link add name veth1.1 t ype veth peer name veth1.2 #创建一对虚拟网卡 ip link show #查看当前的网络接口 ip link set dev veth1.1 netns n1 #将veth1.1接到n1名称空间中,同样的方式设置veth1.2 ip netns exec n1 ip link set dev veth1.1 name eth0 #将n1名称空间的veth1.1命名为eth0 ip netns exec n1 ifconfig eth0 10.0.0.1/24 up #设置n1名称空间中的网络地址并激活使用 ip netns exec n2 ifconfig eth0 10.0.0.2/24 up ip netns exec n2 ping 10.0.0.1 #测试两个名称空间的网络 docker的四种网络模型

CentOS7系统ifconfig无法使用的解决方法

一个人想着一个人 提交于 2019-11-27 10:55:58
在使用 RAKsmart 美国服务器的时候,如果安装的CentOS7 操作系统 的话,可能会经常用到“ifconfig”命令。ifconfig命令大多是用于CentOS 6版本下面,主要用于查看网卡配置信息。 不过在CentOS 7系统中,一般则是使用“ip addr”来查看网卡配置信息,当然使用ifconfig也能达到同样的效果。不过并不是所有CentOS 7系统初始设置时都可以使用ifconfig命令,如下: [root@sqj ~]# ifconfig -bash: /usr/sbin/ifconfig: No such file or directory 出现上面的提示信息就说明CentOS 7系统是无法使用ifconfig命令的,那么怎么帮呢?这里可以安装网络工具来达到正常使用该命令: #yum search ifconfig 这样就能够查看到ifconfig命令所需要的安装包“net-tools.x86_64 ”,接下来只要安装这个软件就行了。 #yum -y install net-tools 这样安装完成后,就可以正常使用ifconfig命令来查看IP信息。 通过以上几个步骤就可以使得CentOS7系统能够正常的使用ifconfig命令了。如果大家在租用RAKsmart美国服务器的时候,如果出现CentOS7系统ifconfig无法使用的情况

How to get default gateway in Mac OSX

人盡茶涼 提交于 2019-11-27 09:01:45
问题 I need to retrieve the default gateway on a Mac machine. I know that in Linux route -n will give an output from which I can easily retrieve this information. However this is not working in Mac OSX(Snow Leopard). I also tried netstat -nr | grep 'default' , but I was hoping for a cleaner output like that produced by route -n in Linux/Unix. netstat -nr lists all the interfaces and the default gateway for them. Any kind of suggestion or a hint in the right direction will be appreciated. 回答1: You

Parse ifconfig to get only my IP address using Bash

夙愿已清 提交于 2019-11-27 07:41:01
I want to edit the bashrc file to have a simple function called "myip" to run. As you might guess, the function myip prints only my internal IP address of my machine. The far as I got working, this is the script: ifconfig en1 | awk '{ print $2}' | sort Which got my this output: 10.0.0.12 options=1<PERFORMNUD> flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> fe80::daa2:5eff:fe96:ba2f%en1 d8:a2:5e:96:ba:2f autoselect active I'm working on Mac OS X. How can I get this done? Etan Reisner Both the following work here (CentOS 5). ip addr show eth0 | awk '$1 == "inet" {gsub(/\/.*$/, "", $2);

linux网络基础设置

五迷三道 提交于 2019-11-27 05:53:26
查看及检测网络: 1.使用ifconfig命令查看网络接口: 查看活动的网络接口,活动已激活 ifconfig b. 查看所有网络接口,禁用的接口也可以查出 ifconfig -a c. 查看指定的网络接口,无论接口是否处于激活状态 ifconfig 设备名 ifconfig 命令包含的信息: RX packets 接收数据包 TX packets 发送数据包 2. 使用ip 、ethool命令查看网络接口信息 a. 查看网络接口的数据链路层信息 ip link 查看网络接口层的网络层信息、 ip a (ip address、ip add) 查看指定网络接口速率、模式信息 ethtool mii –tool 查看链路是否通 3. 查看主机名、路由表 A. hostname 查看主机名 B. 查看路由表 1>.使用route查看路由表(route –n =netstat -rn) 2>.使用netstat -r查看路由表 (-n 不执行DNS反向查找,直接显示数字形式的IP地址) 4.查看网络连接情况 netstat -r 显示路由表信息 -l 查看监听(listen)状态下的网络信息 -a 显示当前主机中所有的网络连接信息 -n 以数字的形式显示相关信息 -p 显示与网络连接相关的进程号 5.ping、traceroute、nslookup命令 1>.测试网络连通性:ping -c

CentOS7下解决ifconfig command not found的办法

南笙酒味 提交于 2019-11-27 05:34:30
注:本办法仅限于可联网的机器,即在安装时设置了IP地址和DNS可正常上网。 解决办法如下: 1 进入 /etc/sysconfig/network-scripts/ifcfg-ens33 中 将 ONBOOT=no 改为 ONBOOT=yes 退出保存 2 重启网卡: service network restart 3 确认ifconfig命令是否未安装 在sbin目录下输入ls,看又没有ifconfig。没有即为未安装 4 安装net-tool插件,此插件中带有此命令 安装命令: sudo yum install net-tools 遇见暂停选择“y” 等待安装完成,再次输入ifconfig,成功。 来源: https://www.cnblogs.com/Tony100/p/11347696.html

31.网络相关 firewalld、netfilter 5表5链 iptables语法

↘锁芯ラ 提交于 2019-11-27 04:50:21
10.11 Linux网络相关 10.12 firewalld和netfilter 10.13 netfilter5表5链介绍 10.14 iptables语法 (拓展:末尾有端口映射,jpg) ' 10.11 Linux网络相关: ~1. ifconfig 查看网卡ip (yum install net-tools) centos7默认没有ifconfig这个命令,需要安装。ifconfig查看起来更加清爽 但是可以用ip addr 来查看 ifconfig -a 当你的网卡down掉的时候,或者没有ip的时候,ifconfig是不显示的。加上-a就可以显示 ~2.ifup ens33/ifdown ens33 ifdown ens33 ens33这个网卡断掉(也叫down掉) ifup ens33 down掉之后,ifup重新连接 用在增加一个网卡或者更改一个网关,但不想重启全部的网络服务,就可以用ifdown ifup指定一个来用。远程连接的时候不要ifdown掉,但是可以这样用ifdown ens33 && ifup ens33 ~3. 设定虚拟网卡ens33:1 后面lvs keepalived的时候,会用到这个虚拟网卡 操作步骤详见实例3. ~4.mii-tool ens33 查看网卡是否连接 我们连接了网线,不在机房(可看灯有没有亮),远程连接的时候

Parse ifconfig to get only my IP address using Bash

浪尽此生 提交于 2019-11-27 04:00:17
问题 I want to edit the bashrc file to have a simple function called "myip" to run. As you might guess, the function myip prints only my internal IP address of my machine. The far as I got working, this is the script: ifconfig en1 | awk '{ print $2}' | sort Which got my this output: 10.0.0.12 options=1<PERFORMNUD> flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> fe80::daa2:5eff:fe96:ba2f%en1 d8:a2:5e:96:ba:2f autoselect active I'm working on Mac OS X. How can I get this done? 回答1: Both the

LINUX探路-网络

主宰稳场 提交于 2019-11-27 03:37:43
linux网络一直是linux学习中比较困难的问题,所以现在整理下网络相关知识供参考,其实,很多人对网络都有一些基础认识,但是真正遇到网络问题,还是不知道从哪下手,归根到底,1、是对网络知识了解太少,2、网络工具或命令使用不纯熟。 一、首先介绍几个命令: (一)检查和监测网络 1、ifconfig [网络设备] [参数] ifconfig 命令用来查看和配置网络设备。当网络环境发生改变时可通过此命令对网络进行相应的配置。 ifconfig eth0 up/down 启动/关闭指定网卡 ifconfig eth0 192.168.101.12 修改IP地址 ifconfig eth0 add/del 33ffe:3240:800:1005::2/64 为网卡eth0配置IPv6地址 ifconfig详解可以看: https://xp9802.iteye.com/blog/2120351 2、netstat [选项] netstat命令是一个监控TCP/IP网络的非常有用的工具,它可以显示路由表、实际的网络连接以及每一个网络接口设备的状态信息。 -a或--all:显示所有连线中的Socket; -n或--numeric:直接使用ip地址,而不通过域名服务器; -p或--programs:显示正在使用Socket的程序识别码和程序名称; -t或--tcp:显示TCP传输协议的连线状况;