'Reverse engineering' networking.

If it doesn't relate to Debian, but you still want to share it, please do it here

'Reverse engineering' networking.

Postby edbarx » 2017-01-24 08:39

If the moderators judge this topic as unacceptable, please delete it. By this topic I do not intend to do anything illegal. My aim is to understand what is going on under the hood when a network interface like wlan0 is set up by low level utilities like ifup and ifdown.

This is my analyses till now. If someone is able to give more details or to direct me to a good reading resource that will save me this investigation, it will be almost too good to be true. Networking is a vast subject as there are very diverse means of connecting computers.

On my machine with wlan0 up and active, this is what I found:
Code: Select all
/run/dhclient.wlan0.pid
Text Data: pid of running dhclient daemon

pgrep dhclient gives pid of running dhclient
How dhclient is run:
"dhclient -v -pf /run/dhclient.wlan0.pid -lf /var/lib/dhcp/dhclient.wlan0.leases wlan0"

wpa_supplicant.wlan0.pid
Text Data:pid of running wpa_supplicant

pgrep wpa_supplicant gives pid of running wpa_supplicant
How wpa_supplicant is run:
"/sbin/wpa_supplicant -s -B -P /run/wpa_supplicant.wlan0.pid -i wlan0 -D nl80211,wext -C /run/wpa_supplicant"
Debian == { > 30, 000 packages }; Debian != systemd
The worst infection of all, is a false sense of security!
It is hard to get away from CLI tools.
User avatar
edbarx
 
Posts: 5383
Joined: 2007-07-18 06:19
Location: 35° 50 N, 14 º 35 E

Re: 'Reverse engineering' networking.

Postby reinob » 2017-01-24 10:09

What do you want to know?

For ethernet you need:
(1) interface up
(2) an address

like "ifconfig eth0 up 192.168.0.1"

If you don't want a fixed address, you need a DHCP client (like dhclient).

For wi-fi you need, between (1) and (2), to associate with an AP. This is what wpa_supplicant does.
(note that wpa_supplicant can also be used for Ethernet)

With that you have network connectivity.
If you also need Internet, you normally would set-up a default route via your router.

This is however neither offtopic nor "reverse engineering" (unless you want to know how/when systemd-networkd works and when not ;-)
reinob
 
Posts: 497
Joined: 2014-06-30 11:42

Re: 'Reverse engineering' networking.

Postby edbarx » 2017-01-24 10:17

reinob wrote:This is however neither offtopic nor "reverse engineering" (unless you want to know how/when systemd-networkd works and when not ;-)

You are probably right. That is why I wrote reverse engineering in single quotes. The 'investigation' is somewhat on those lines.
Debian == { > 30, 000 packages }; Debian != systemd
The worst infection of all, is a false sense of security!
It is hard to get away from CLI tools.
User avatar
edbarx
 
Posts: 5383
Joined: 2007-07-18 06:19
Location: 35° 50 N, 14 º 35 E

Re: 'Reverse engineering' networking.

Postby millpond » 2017-02-10 05:08

ifup and ifdown, and ifconfig are C binary files. Their main job is to write the system's Routing Tables. I dont know what relation systemd has to if files, or even if they are written to act independant of them.

I would start researching the Routing Tables, looking at the (hopefully commented) source codes for both the if apps, as well as the net daemons.

Linux, as Open Source is *designed* to be reverse engineered. Use debug files for symbols . However its rather pointless with source available.
millpond
 
Posts: 582
Joined: 2014-06-25 04:56


Return to Offtopic

Who is online

Users browsing this forum: No registered users and 4 guests

fashionable