I am quite new(5-6 months) to embedded Linux programming in C and python. I have with me 2 Linux based devices connected to a network.
I am trying to collect the IP address generated by the ethernet and wlan interface and populate it on a web application.
Now Device 1 is giving me 2 IP addresses on the wlan interface. This is after I run ip a
.
Namely 10.17.36.31/24
and 10.17.36.33/24
And Device 2 is also giving me 2 IP addresses but both are same.
They are both 10.61.44.27/24
and 10.61.44.27/22
Now I can implement the logic to get the correct IP from these 2 results, but I am not able to figure out where these IP addresses are coming from?
I don't have fundamental knowledge on networking, so not able to understand the output of the ip a
command.
Any guidance to a material that clearly describes networking in linux devices would be helpful. Specifically on how to understand what the output of ip a
signifies. And also what exactly is the difference between scope global and scope global secondary , and what are they? What is brd, what does /24 and /22 mean. Trying to find answers to all these questions.
Device 1:
5: eth0: <NO-CARRIER,BROADCAST,MULTICAST,DYNAMIC,UP> mtu 1500 qdisc pfifo_fast state DOWN group default qlen 1000
link/ether aa:bb:cc:dd:ee:ff brd ff:ff:ff:ff:ff:ff
6: wlan0: <BROADCAST,MULTICAST,DYNAMIC,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
link/ether bb:cc:aa:ee:dd:gg brd ff:ff:ff:ff:ff:ff
inet 10.17.36.31/24 brd 10.61.44.255 scope global wlan0
valid_lft forever preferred_lft forever
inet 10.17.36.33/24 brd 10.61.47.255 scope global secondary wlan0
valid_lft forever preferred_lft forever
inet6 aaaa::bbbb:2222:ffff:eeee/64 scope link
valid_lft forever preferred_lft forever
Device 2:
5: eth0: <NO-CARRIER,BROADCAST,MULTICAST,DYNAMIC,UP> mtu 1500 qdisc pfifo_fast state DOWN group default qlen 1000
link/ether aa:bb:cc:dd:ee:ff brd ff:ff:ff:ff:ff:ff
6: wlan0: <BROADCAST,MULTICAST,DYNAMIC,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
link/ether bb:cc:aa:ee:dd:gg brd ff:ff:ff:ff:ff:ff
inet 10.61.44.27/24 brd 10.61.44.255 scope global wlan0
valid_lft forever preferred_lft forever
inet 10.61.44.27/22 brd 10.61.47.255 scope global wlan0
valid_lft forever preferred_lft forever
inet6 aaaa::bbbb:2222:ffff:eeee/64 scope link
valid_lft forever preferred_lft forever