Difference between revisions of "IP Linux command line"
[quality revision] | [quality revision] |
m
|
Template:ArticleApprovedVersion
Contents
1 Article purpose[edit]
This article provides the basic information needed to start using the Linux kernel tool: ip [1].
2 Introduction[edit]
The following table provides a brief description of the tool, as well as its availability depending on the software packages:
: this tool is either present (ready to use or to be activated), or can be integrated and activated on the software package.
: this tool is not present and cannot be integrated, or it is present but cannot be activated on the software package.
Tool | STM32MPU Embedded Software distribution | STM32MPU Embedded Software distribution for Android™ Only supported for STM32MP15x lines ![]()
|
||||||||
---|---|---|---|---|---|---|---|---|---|---|
Name | Category | Purpose | Starter Package | Developer Package | Distribution Package | Starter Package | Developer Package | Distribution Package | ||
ip | Monitoring tools |
ip[1] shows / manipulates routing, devices, policy routing and tunnels of network interfaces. ip replaces the deprecated command ifconfig |
![]() |
![]() |
![]() |
![]() |
Coming soon
![]() |
![]() |
3 Installing the trace and debug tool on your target board[edit]
3.1 Using the STM32MPU Embedded Software distribution[edit]
ip is installed by default (/sbin/ip) and is ready to be used with all STM32MPU software packages.
which ip /sbin/ip
It is integrated into the Weston image distribution by using the following meta-st package recipie to enable the iproute2 module: meta-st/meta-st-openstlinux/recipes-st/packagegroups/packagegroup-framework-tools.bb
.
RDEPENDS_packagegroup-framework-tools-network-base = "\
ethtool \
iproute2 \
"
3.2 Using the STM32MPU Embedded Software distribution for Android™[edit]
![]() |
Coming soon |
ip is installed by default (/system/bin/ip) and is ready to be used with all STM32MPU software packages for Android™.
which ip
/system/bin/ip
It is integrated in Android image distribution through Android base makefile: build/make/target/product/core_minimal.mk
:
# Base modules (will move elsewhere, previously user tagged) PRODUCT_PACKAGES += \ BackupRestoreConfirmation \ CompanionDeviceManager \ ... ims-common \ ip \ ip-up-vpn \ ...
4 Getting started[edit]
- To check network interfaces
ip addr show 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000 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: can0: <NOARP,ECHO> mtu 16 qdisc noop state DOWN group default qlen 10 link/can 3: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000 link/ether 00:80:e1:42:43:65 brd ff:ff:ff:ff:ff:ff inet 10192.99168.1.237/22 brd 10192.99168.3.255 scope global dynamic eth0 valid_lft 172057sec preferred_lft 172057sec inet 10192.99168.0.4/32 scope global eth0 valid_lft forever preferred_lft forever inet6 fe80::280:e1ff:fe42:4365/64 scope link valid_lft forever preferred_lft forever 4: sit0@NONE: <NOARP> mtu 1480 qdisc noop state DOWN group default qlen 1000 link/sit 0.0.0.0 brd 0.0.0.0
- To assign an IP address to an interface
ip addr add 192.168.1.53 dev eth0
- To remove an IP adress
ip addr del 192.168.1.53 dev eth0
- To enable an interface
ip link set eth0 up
- To disable an interface
ip link set eth0 down
- To check a route table
ip route show default via 10192.99168.3.254 dev eth0 proto dhcp src 10192.99168.1.237 metric 1024 10192.99168.0.0/22 dev eth0 proto kernel scope link src 10192.99168.1.237 10192.99168.3.254 dev eth0 proto dhcp scope link src 10192.99168.1.237 metric 1024
- To add a static route
ip route add 10192.99168.02.0/16 via 192.168.1.1 dev eth0
- To remove a static route
ip route del 10192.99168.02.0/16
- To set the default gateway
ip route add default via 192.168.1.1
5 To go further[edit]
Some usage examples are available for reference[2].
6 References[edit]
- Useful external links
Document link | Document Type | Description |
---|---|---|
IP Command example | Standard | Documentation from tecmint |
ifconfig vs ip | Standard | Documentation |
<noinclude> {{ArticleBasedOnModel | [[Trace and debug tools article model]]}} {{ArticleMainWriter | Jean-PhilippeR}} {{ ArticleApprovedVersion | Jean-PhilippeR | Jean-ChristopheT, AlexandreT | No previous approved version | PhilipS - 22Nov'18 - 9716 | 23Nov'18 }} [[Category:Linux monitoring tools]]</noinclude> == Article purpose == This article provides the basic information needed to start using the Linux kernel tool: '''ip''' <ref name=ipmanpage/>. == Introduction == {{:Trace_and_debug_tools_assignment_table_template}}<onlyinclude> | [[IP Linux command line|ip]] | [[:Category:Monitoring tools|Monitoring tools]] | style="text-align:left;" | '''ip'''<ref name=ipmanpage>https://linux.die.net/man/8/ip</ref> shows / manipulates routing, devices, policy routing and tunnels of network interfaces.<br> {{highlight|'''ip''' replaces the deprecated command [[Ifconfig|ifconfig]]}} || {{Y}} || {{Y}} || {{Y}} | colspan="3" | {{UnderConstruction}}| {{Y}} || {{Y}} || {{Y}}|-</onlyinclude> |} == Installing the trace and debug tool on your target board == === Using the STM32MPU Embedded Software distribution === '''ip''' is installed by default (/sbin/ip) and is ready to be used with all STM32MPU software packages. {{Board$}} which ip /sbin/ip It is integrated into the Weston image distribution by using the following meta-st package recipie to enable the iproute2 module: <code>''meta-st/meta-st-openstlinux/recipes-st/packagegroups/packagegroup-framework-tools.bb''</code>. RDEPENDS_packagegroup-framework-tools-network-base = "\ ethtool \ {{green|'''iproute2'''}} \ " === Using the STM32MPU Embedded Software distribution for Android™ ==={{UnderConstruction}} == Getting started == * '''ip''' is installed by default (/system/bin/ip) and is ready to be used with all STM32MPU software packages for Android™. {{Board$}} which ip /system/bin/ip It is integrated in Android image distribution through Android base makefile: <code>''build/make/target/product/core_minimal.mk''</code>: # Base modules (will move elsewhere, previously user tagged) PRODUCT_PACKAGES += \ BackupRestoreConfirmation \ CompanionDeviceManager \ ... ims-common \ {{green|'''ip \'''}} ip-up-vpn \ ... == Getting started == {{Android | Need to enable root access rights for any changes *Using ADB shell is ADB link available: {{PC$}} adb root {{PC$}} adb shell {{Board$}} ... *Using uart console shell: {{Board$}} su {{Board$}} ... }} * To check network interfaces {{Board$}} ip addr show 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000 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: can0: <NOARP,ECHO> mtu 16 qdisc noop state DOWN group default qlen 10 link/can 3: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000 link/ether 00:80:e1:42:43:65 brd ff:ff:ff:ff:ff:ff inet 10.99192.168.1.237/22 brd 10.99192.168.3.255 scope global dynamic eth0 valid_lft 172057sec preferred_lft 172057sec inet 10.99192.168.0.4/32 scope global eth0 valid_lft forever preferred_lft forever inet6 fe80::280:e1ff:fe42:4365/64 scope link valid_lft forever preferred_lft forever 4: sit0@NONE: <NOARP> mtu 1480 qdisc noop state DOWN group default qlen 1000 link/sit 0.0.0.0 brd 0.0.0.0 * To assign an IP address to an interface {{Board$}} ip addr add 192.168.1.53 dev eth0 * To remove an IP adress {{Board$}} ip addr del 192.168.1.53 dev eth0 * To enable an interface {{Board$}} ip link set eth0 up * To disable an interface {{Board$}} ip link set eth0 down * To check a route table {{Board$}} ip route show default via 10.99192.168.3.254 dev eth0 proto dhcp src 10.99192.168.1.237 metric 1024 10.99192.168.0.0/22 dev eth0 proto kernel scope link src 10.99192.168.1.237 10.99192.168.3.254 dev eth0 proto dhcp scope link src 10.99192.168.1.237 metric 1024 * To add a static route {{Board$}} ip route add 10.99.0192.168.2.0/16 via 192.168.1.1 dev eth0 * To remove a static route {{Board$}} ip route del 10.99.0192.168.2.0/16 * To set the default gateway {{Board$}} ip route add default via 192.168.1.1 == To go further == Some usage examples are available for reference<ref>https://www.linuxtechi.com/ip-command-examples-for-linux-users/</ref>. == References ==<references /> * Useful external links {| ! scope=col | Document link ! scope=col | Document Type ! scope=col | Description |- | [http://www.tecmint.com/ip-command-examples IP Command example] | Standard | Documentation from tecmint |- | [https://tty1.net/blog/2010/ifconfig-ip-comparison_en.html '''ifconfig''' vs '''ip'''] | Standard | Documentation |} {{ ArticleBasedOnModel | Trace and debug tools article model }} {{ PublicationRequestId | 9716 | 22Nov'18 }} [[Category:Linux monitoring tools]]
(2 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
== Article purpose == |
== Article purpose == |
||
This article provides the basic information needed to start using the Linux kernel tool: '''ip''' <ref name=ipmanpage/>. |
This article provides the basic information needed to start using the Linux kernel tool: '''ip''' <ref name=ipmanpage/>. |
||
Line 19: | Line 10: | ||
{{highlight|'''ip''' replaces the deprecated command [[Ifconfig|ifconfig]]}} |
{{highlight|'''ip''' replaces the deprecated command [[Ifconfig|ifconfig]]}} |
||
|| {{Y}} || {{Y}} || {{Y}} |
|| {{Y}} || {{Y}} || {{Y}} |
||
− | | |
+ | || {{Y}} || {{Y}} || {{Y}} |
|- |
|- |
||
</onlyinclude> |
</onlyinclude> |
||
Line 30: | Line 21: | ||
/sbin/ip |
/sbin/ip |
||
− | It is integrated into the Weston image distribution by using the following meta-st package recipie to enable the iproute2 module: ''meta-st/meta-st-openstlinux/recipes-st/packagegroups/packagegroup-framework-tools.bb''. |
+ | It is integrated into the Weston image distribution by using the following meta-st package recipie to enable the iproute2 module: <code>''meta-st/meta-st-openstlinux/recipes-st/packagegroups/packagegroup-framework-tools.bb''</code>. |
RDEPENDS_packagegroup-framework-tools-network-base = "\ |
RDEPENDS_packagegroup-framework-tools-network-base = "\ |
||
ethtool \ |
ethtool \ |
||
Line 37: | Line 28: | ||
=== Using the STM32MPU Embedded Software distribution for Android™ === |
=== Using the STM32MPU Embedded Software distribution for Android™ === |
||
− | {{ |
+ | '''ip''' is installed by default (/system/bin/ip) and is ready to be used with all STM32MPU software packages for Android™. |
+ |
{{Board$}} which ip
|
||
+ | /system/bin/ip |
||
+ | |||
+ | It is integrated in Android image distribution through Android base makefile: <code>''build/make/target/product/core_minimal.mk''</code>: |
||
+ | # Base modules (will move elsewhere, previously user tagged) |
||
+ | PRODUCT_PACKAGES += \ |
||
+ | BackupRestoreConfirmation \ |
||
+ | CompanionDeviceManager \ |
||
+ | ... |
||
+ | ims-common \ |
||
+ | {{green|'''ip \'''}} |
||
+ | ip-up-vpn \ |
||
+ | ... |
||
== Getting started == |
== Getting started == |
||
+ | {{Android | Need to enable root access rights for any changes |
||
+ | *Using ADB shell is ADB link available: |
||
+ | {{PC$}} adb root |
||
+ | {{PC$}} adb shell |
||
+ | {{Board$}} ... |
||
+ | *Using uart console shell: |
||
+ | {{Board$}} su |
||
+ | {{Board$}} ... |
||
+ | }} |
||
+ | |||
* To check network interfaces |
* To check network interfaces |
||
{{Board$}} ip addr show |
{{Board$}} ip addr show |
||
Line 52: | Line 66: | ||
3: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000 |
3: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000 |
||
link/ether 00:80:e1:42:43:65 brd ff:ff:ff:ff:ff:ff |
link/ether 00:80:e1:42:43:65 brd ff:ff:ff:ff:ff:ff |
||
− | inet |
+ | inet 192.168.1.237/22 brd 192.168.3.255 scope global dynamic eth0 |
valid_lft 172057sec preferred_lft 172057sec |
valid_lft 172057sec preferred_lft 172057sec |
||
− | inet |
+ | inet 192.168.0.4/32 scope global eth0 |
valid_lft forever preferred_lft forever |
valid_lft forever preferred_lft forever |
||
inet6 fe80::280:e1ff:fe42:4365/64 scope link |
inet6 fe80::280:e1ff:fe42:4365/64 scope link |
||
Line 75: | Line 89: | ||
* To check a route table |
* To check a route table |
||
{{Board$}} ip route show |
{{Board$}} ip route show |
||
− | default via |
+ | default via 192.168.3.254 dev eth0 proto dhcp src 192.168.1.237 metric 1024 |
− | + | 192.168.0.0/22 dev eth0 proto kernel scope link src 192.168.1.237 |
|
− | + | 192.168.3.254 dev eth0 proto dhcp scope link src 192.168.1.237 metric 1024 |
|
* To add a static route |
* To add a static route |
||
− | {{Board$}} ip route add |
+ | {{Board$}} ip route add 192.168.2.0/16 via 192.168.1.1 dev eth0 |
* To remove a static route |
* To remove a static route |
||
− | {{Board$}} ip route del |
+ | {{Board$}} ip route del 192.168.2.0/16 |
* To set the default gateway |
* To set the default gateway |
||
Line 109: | Line 123: | ||
| Documentation |
| Documentation |
||
|} |
|} |
||
+ | |||
+ | {{ ArticleBasedOnModel | Trace and debug tools article model }} |
||
+ | {{ PublicationRequestId | 9716 | 22Nov'18 }} |
||
+ | |||
+ | [[Category:Linux monitoring tools]] |