I need to fetch the IPaddress assigned by the operator after a successful 3G or LTE data call.
$adb shell netcfg >> doesnt have the assigned IP address.
I tried adb shell dumpsys
and grep ip address, but in vain. Any help/pointers?
How to get ip address of your device using adb? Run the command adb shell ip addr show wlan0 to show the IP address of your device.
Use the set network command to configure an IP address from the command line. The set network command includes the following parameters: ip=device ip: The IP address for the device. gateway=gateway: The network gateway IP address.
Try this command, it will help you to get ipaddress
adb shell ifconfig tiwlan0
tiwlan0 is the name of the wi-fi network interface on the device. This is generic command for getting ipaddress,
adb shell netcfg
It will output like this
usb0 DOWN 0.0.0.0 0.0.0.0 0×00001002 sit0 DOWN 0.0.0.0 0.0.0.0 0×00000080 ip6tnl0 DOWN 0.0.0.0 0.0.0.0 0×00000080 gannet0 DOWN 0.0.0.0 0.0.0.0 0×00001082 rmnet0 UP 112.79.87.220 255.0.0.0 0x000000c1 rmnet1 DOWN 0.0.0.0 0.0.0.0 0×00000080 rmnet2 DOWN 0.0.0.0 0.0.0.0 0×00000080
Try:
adb shell ip addr show rmnet0
It will return something like that:
3: rmnet0: <UP,LOWER_UP> mtu 1500 qdisc htb state UNKNOWN qlen 1000
link/[530]
inet 172.22.1.100/29 scope global rmnet0
inet6 fc01:abab:cdcd:efe0:8099:af3f:2af2:8bc/64 scope global dynamic
valid_lft forever preferred_lft forever
inet6 fe80::8099:af3f:2af2:8bc/64 scope link
valid_lft forever preferred_lft forever
This part is your IPV4 assigned by the operator
inet 172.22.1.100
This part is your IPV6 assigned by the operator
inet6 fc01:abab:cdcd:efe0:8099:af3f:2af2:8bc
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With