how to use ip command

MobileNet V3 图像分类 MobileNet V3 阅读详情

IP command is one of the most important and frequently used commands in Linux. In this blog post, we will discuss what IP command is, and how to use it effectively. IP command is used to display or manipulate the network interface parameters. It can be used to view network information about your network interfaces, configure them, and more.

Useful IP Commands in Linux

Here are some useful IP commands:

  • ip addr: This command will display/add/delete IP addresses in Linux
  • ip link: This command will display/add/delete network interfaces in Linux.
  • ip route: This command will display/add/delete routes in Linux.

Let’s take a look at these IP commands.

Check network interface info with ip link show command in Linux

The IP link show command can be used to display information about your network interfaces. This command will display all of the network interfaces on your systems. The command output will include the MAC address, MTU size, status, etc. Here is an example of the output of this command:

For example:

root@localhost:~# ip link show
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP mode DEFAULT qlen 1000
link/ether 08:00:27:a4:4c:fc brd ff:ff:ff:ff:ff:ff
3: wlan0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN mode DEFAULT qlen 1000
link/ether 44:94:fc:82:ec:6e brd ff:ff:ff:ff:ff:ff

As you can see from the output above, there are three interfaces on this system: lo, eth0, and wlan0.

  • The lo interface is the loopback interface, which is used for local communication on the system.
  • The eth0 interface is the Ethernet interface, which is used to connect to a network.
  • The wlan0 interface is the wireless interface, which is used to connect to a wireless network.

You can use the ip link show command to view information about any of these interfaces.

To view information about a specific interface, you can use the following syntax:

ip link show dev <interface name>

For example, to view information about the eth0 interface, you would use the following command:

root@localhost:~# ip link show dev eth0

2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP mode DEFAULT qlen 1000
link/ether 08:00:27:a4:4c:fc br

Configure network interface with ip link set command in Linux

To configure your network interfaces in Linux, you can use the ip link set command. This command is used to set various parameters of a network interface. For example, you can use this command to enable or disable a network interface.

The main reason to disable a network interface is to prevent it from being used. This can be useful in a number of situations. For example, if you are troubleshooting your network, you may want to disable an interface to see if that fixes the problem.

Or, if you are connected to a network that you don’t want to use, you may want to disable the interface to prevent your computer from using it.

To disable a network interface, you can use the following command:

ip link set eth0 down

This command will disable the eth0 interface. If you want to enable the interface, you can use the following command:

ip link set eth0 up

You can also use the ip link set command to change the MAC address of a network interface. To do this, you can use the following command:

ip link set eth0 address 00:11:22:33:44:55

This command will change the MAC address of the eth0 interface to 00:11:22:33:44:55.

Check IP address with ip addr show command in Linux

The ip addr show command can be used to display IP information about your network addresses. This command will display all of the IP addresses on your system. Here is an example of the output of this command:

For example:

root@localhost:~# ip addr show
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever

2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
link/ether 08:00:27:a4:4c:fc brd ff:ff:ff:ff:ff:ff
inet 10.0.2.15/24 brd 10.0.2.255 scope global eth0
valid_lft forever preferred_lft forever
inet6 fe80::a00:27ff:fea4:4cfc/64 scope link
valid_lft forever preferred_lft forever

3: wlan0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN qlen 1000
link/ether 44:94:fc:82:ec:6e brd ff:ff:ff:ff:ff:ff

As you can see from the output above, there are three interfaces on this system: lo, eth0, and wlan0.

Change IP Address with IP addr add/del Command in Linux

The ip addr add command is used to add an IP address to a network interface. For example, if you want to add the IP address 10.0.0.1/24 to the eth0 interface, you can use the following command:

ip addr add 10.0.0.1/24 dev eth0

The ip addr del command is used to delete an IP address from a network interface. For example, if you want to delete the IP address 10.0.0.1/24 from the eth0 interface, you can use the following command:

ip addr del 10.0.0.1/24 dev eth0

The ip addr flush command is used to flush the IP addresses from a network interface. This command will delete all of the IP addresses from a network interface. For example, if you want to flush the IP addresses from the eth0 interface, you can use the following command:

ip addr flush dev eth0

Check route table with ip route show command in Linux

The ip route show command is used to display the routing table in Linux. The routing table is a list of networks and their associated next-hop router. Here is an example of the output of this command:

For example:

root@localhost:/home/user# ip route show
10.0.2.0/24 dev eth0 proto kernel scope link src 10.0.2.15
169.254.0.0/16 dev eth0 scope link metric 1000
default via 10.0.2.2 dev eth0 proto static

As you can see from the output above, there are three routes in the routing table.

  • The first route is for the 10.0.2.0/24 network. This route says that the next-hop router for this network is 10.0.2.2 and that it can be reached via the eth0 interface.
  • The second route is for the 169.254.0.0/16 network. This route says that this network can be reached via the eth0 interface.
  • The third route is the default route. This route says that the next-hop router for all other networks is 10.0.2.2 and that it can be reached via the eth0 interface.

Change Route table With IP route add/del Command in Linux

The ip route add command is used to add a route to the routing table. For example, if you want to add a route for the 10.0.3.0/24 network, you can use the following command:

ip route add 10.0.3.0/24 via 10.0.2.3 dev eth0

The ip route del command is used to delete a route from the routing table. For example, if you want to delete the route for the 10.0.3.0/24 network, you can use the following command:

ip route del 10.0.3.0/24 via 10.0.2.3 dev eth0

Conclusion

In this article, we have covered the IP command in Linux. We have explained what the IP command is and how it can be used to configure network interfaces and routes. We have also provided a list of some useful IP commands.

基于 Qt 的轻量化工业组态软件设计与实现 本文设计并实现了一种基于Qt框架的轻量化工业组态软件,解决了传统组态软件体积庞大、部署复杂等问题。该软件采用模块化架构,集成可视化图形编辑、设备数据采集、脚本扩展等核心功能,具有跨平台运行、资源占用低、启动速度快等特点。通过关键技术优化,实现了高效稳定的数据采集、脚本控制和网络通信,可广泛应用于工业机器人HMI、小型PLC监控等轻量化场景。测试结果表明,该软件体积约30MB,运行内存占用60-80MB,启动时间1.2秒,满足工业轻量化监控需求。未来可扩展更多工业组件和协议支持,进一步提升应用价值。 阅读详情

相关推荐

【技术实践指南】Python解析FactSet Revere供应链数据:构建企业级断裂与重构监测指标

本文提供了一份企业级Python实践指南,详细解析如何利用FactSet Revere供应链数据库,构建供应链断裂与重构监测指标。内容涵盖数据清洗、关系对筛选、时间序列处理及核心指标(断裂、恢复、转移)的工程化实现,旨在帮助数据工程师与分析师搭建自动化、可解释的供应链风险监控系统。

weixin_29051811的博客 936

linux双网卡上网问题

一、测试环境说明 内存 1G 2核 磁盘 50G 网卡1 仅主机(Host-Only)网络 宿主通信 网卡2 NAT 上网 系统 CentOS-7-x86_64-Minimal-1804 虚拟硬盘文件类型 VDI 动态分配 USB控制器 不启用 声音 不启用root密码 root123 (1)软件工具: vbox(5.2.20 r125813), Centos...

weixin_30537391的博客 978

实验室LIMS系统选型指南:从赛默飞到金现代,5大主流方案横评

本文深入分析了实验室LIMS系统选型的5大核心维度,包括架构选择、行业适配性、合规性设计、智能化程度和成本模型。通过对比赛默飞、金现代等主流厂商的优劣势,提供实战避坑策略,帮助实验室管理者做出明智决策,提升运营效率和合规水平。

plum99的博客 259

How To Use Ip Command In Linux with Examples

How To Use Ip Command In Linux with Examples

张同光 (Tongguang Zhang):Hello everyone ! 851

JLink版本不兼容?手把手教你解决APM32F003F6P6在Keil中烧写闪退和报错

本文详细解析了APM32F003F6P6在Keil中烧写闪退和报错的解决方案,重点介绍了JLink版本兼容性问题。通过实测不同版本组合,推荐使用JLink 7.20a或6.86b与Keil 5.25的黄金组合,并提供详细的降级驱动和工程配置步骤,帮助开发者高效解决烧写困境。

weixin_33694620的博客 418

Exploring Automated Distractor Generation for Math Multiple-choice Questions via Large Language Mode

多项选择题(MCQ)在几乎所有级别的教育中都无处不在,因为它们易于管理、评分,并且是评估和实践中可靠的格式。MCQ最重要的方面之一是干扰因素,即旨在针对真实学生常见错误或误解的不正确选项。迄今为止,对于教师和学习内容设计师来说,制作高质量的干扰物的任务在很大程度上仍然是一个劳动和时间密集型的过程,其可扩展性有限。在这项工作中,我们研究了数学MCQ领域的自动干扰物生成任务,并探索了从上下文学习到微调的各种基于大型语言模型(LLM)的方法。

c_cpp_csharp的专栏 317

How to use the netsh command to set an IP address.

Basic netsh firewall commands for CMD.

zing's blog 613

反光柱定位算法中的移动机器人姿态计算原理-经典三边定位最小二乘法计算定位-直接法计算定位

(二)计算姿态方式是我们已经通过最小二乘得到了小车在地图中的位置或者是雷达在地图中的位置,又因为我们知道雷达与小车的安装坐标,所以可以求解出一其中一个坐标的知量,通过小车在地图中坐标与雷达在地图中坐标可以得到一条向量,通过计算向量在地图中的角度就能得到姿态了。与最小二乘三边测量法相比,新算法在动态调整、优化过程和鲁棒性方面优势明显,尤其适合动态环境下的机器人定位,而最小二乘三边测量法在动态复杂环境中精度相对较低。(一)与(二)的区别主要是在计算姿态上的算法不同。经典三边定位最小二乘法 (法一)

苏凯的博客 1141

How to use FTP from the command line.

How to use FTP from the command line. FTP (File Transfer Protocol) allows you to transfer files between your PC and other Internet systems (hosts). You can transfer files, work with local or remote

Keith 1143

R语言中如何获取前向选择(forward selection)选出的变量

前向选择是一种常用的特征选择方法,可以在给定一个预测模型的情况下,逐步添加变量来确定最佳的预测模型。在R语言中,可以使用适当的函数和库来执行前向选择,并获取选出的变量。以下是一个详细的步骤,展示了如何使用R语言执行前向选择并获得选出的变量。通过按照上述步骤,你可以使用R语言执行前向选择,并获取选出的变量。记住,前向选择是一种特征选择方法,可以根据不同的评估指标选择最佳的预测模型。接下来,准备用于前向选择的数据。使用"summary"函数查看前向选择的摘要,并使用"which"函数获取被选中的变量。

WangWEel的博客 924

从零开始讲DDR(7)——modelsim独立仿真DDR4

本文主要内容为DDR4 MIG ip核仿真,modelsim独立仿真DDR4。在进行DDR仿真的时候,我们会面临一个以往常规仿真不存在的问题:DDR本身并不是一个我们通过RTL代码设计出来的部件,常规的模块或者IP仿真,都是基于RTL代码就能进行的,但是回顾一下我们DDR的开发流程,调用的IP核也只是MIG ip,其本质是一个DDRC+DDRPYH的组合,并不能模拟任何DDR本身的行为,因此,在进行仿真之前,我们首先要做的就是获取DDR的仿真模型。

apple_53311083的博客 3229

How to Use the Nmap Command

#Linux #Command #Nmap

yuguo_im的博客 1273

用 Joule 点燃 ABAP 开发者的舞台感:SAP BTP 上的 ABAP AI 能力实战解读

摘要:SAP推出的Joule for developers和ABAP AI功能为开发者提供了智能辅助工具,旨在优化ABAP开发流程。主要功能包括上下文感知的代码预测补全、代码解释、单元测试生成和开发问题实时解答。这些能力特别适合应对Cloud环境下ABAP开发的复杂约束,如Clean Core原则和受限语法范围。通过减少重复劳动和提升代码理解效率,该工具帮助开发者将注意力集中在业务逻辑而非技术细节上。随着企业加速向S/4HANA迁移,这些AI功能将在遗留代码改造和云适配中发挥更大作用,建议团队将其纳入工程体

2007 年 ~ 2025 年,深耕 SAP 技术 18 年 299

How to Use the Dig Command

#Linux #Command #Dig

yuguo_im的博客 1040

STM32F407中文手册

STM32f407中文手册 本参考手册面向应用开发人员,提供有关使用 STM32F405xx/07xx、STM32F415xx/17xx、 STM32F42xxx 和 STM32F43xxx 微控制器存储器与外设的完整信息。STM32F405xx/07xx、STM32F415xx/17xx、STM32F42xxx 和 STM32F43xxx 构成一个微 控制器系列,各产品具有不同的存储器大小、封装和外设。有关订购信息以及器件的机械与电气特性,请参见数据手册。有关 ARM Cortex™-M4F 内核的信息,请参见《Cortex™-M4F 技术参考手册》。

SIMATIC S7-1200, S7-1500 PID 控制[手册]

SIMATIC S7-1200, S7-1500 PID 控制[手册]

How to Use the Netstat Command

#Linux #Command #Netstat

yuguo_im的博客 1025

数学建模模型总结

这是本人在两年内准备参加数学建模竞赛搜集到的模型资料,已经经过了本人的筛选和整理,希望能够对准备参加数学建模竞赛的学弟学妹们提供一些帮助!

How to Use the Scp Command

#Linux #Command #Scp

yuguo_im的博客 678

jre9下载 jdk9

(Java SE Runtime Environment 9.0) 9.0u175 官方最新版 【x86|x64】

How to Use the SSH Command

#Linux #Command #SSH

yuguo_im的博客 744

How to Use the Ping Command

#Linux #Command #Ping

yuguo_im的博客 658

How to Use the Tcpdump Command

#Linux #Command #Tcpdump

yuguo_im的博客 878

How to Use the Nslookup Command

#Linux #Command #Nslookup #DNS

yuguo_im的博客 619

How to Use the Ifconfig Command

#Linux #Command #Ifconfig

yuguo_im的博客 432

How to Use the Traceroute Command

#Linux #Command #Traceroute

yuguo_im的博客 552

How to Use the stat Command on Linux

The Linux command shows you much more detail than does. Take a peek behind the curtain with this informative and configurable utility. We'll show you how to use it.The command is great at what it does---and it does a lot---but with Linux, it seems that t

allway2的博客 687

How to Use the Sysctl Command

#Linux #Sysctl

yuguo_im的博客 489

How to use tcpdump command on Linux

The command can be used to capture network traffic on a Linux system. It’s a versatile command line utility that network administrators often rely on for troubleshooting.What you’ll come to find is that the amount of networking traffic captured on an inte

allway2的博客 176

How to Use the Netcat Command

#Linux #Command #Netcat

yuguo_im的博客 628
上一篇: Openssl 如何生成证书
下一篇: 利用Linux find刪除特定时间的文件
曹大卫779
博客等级 码龄6年 70粉丝 37原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值