1. Article purpose[edit | edit source]
This article provides the basic information needed to start using the Linux kernel tool: ip [1].
2. Introduction[edit | edit source]
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™ | ||||||
---|---|---|---|---|---|---|---|---|
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 |
3. Installing the trace and debug tool on your target board[edit | edit source]
3.1. Using the STM32MPU Embedded Software distribution[edit | edit source]
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-base.bb
.
RDEPENDS:packagegroup-framework-tools-base-network = "\
ethtool \
iproute2 \
curl \
"
3.2. Using the STM32MPU Embedded Software distribution for Android™[edit | edit source]
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 | edit source]
Error creating thumbnail: Unable to save thumbnail to destination
|
Below information is related to the Android™ distribution Need to enable root access rights for any changes
adb root adb shell ...
su ... |
- 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: end0: <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 192.168.1.237/22 brd 192.168.3.255 scope global dynamic end0 valid_lft 172057sec preferred_lft 172057sec inet 192.168.0.4/32 scope global end0 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 end0
- To remove an IP adress
ip addr del 192.168.1.53 dev end0
- To enable an interface
ip link set end0 up
- To disable an interface
ip link set end0 down
- To check a route table
ip route show default via 192.168.3.254 dev end0 proto dhcp src 192.168.1.237 metric 1024 192.168.0.0/22 dev end0 proto kernel scope link src 192.168.1.237 192.168.3.254 dev end0 proto dhcp scope link src 192.168.1.237 metric 1024
- To add a static route
ip route add 192.168.2.0/16 via 192.168.1.1 dev end0
- To remove a static route
ip route del 192.168.2.0/16
- To set the default gateway
ip route add default via 192.168.1.1
5. To go further[edit | edit source]
Some usage examples are available for reference[2].
6. References[edit | edit source]
- Useful external links
Document link | Document Type | Description |
---|---|---|
IP Command example | Standard | Documentation from tecmint |
ifconfig vs ip | Standard | Documentation |