I
I
ivanushka88452019-08-19 10:17:42
linux
ivanushka8845, 2019-08-19 10:17:42

How to programmatically create multiple network interfaces?

There is one physical network interface. I want to create programmatically , say 10 and use them at the same time. Through the Linux API. Not via console.
How to do it, in which direction to dig?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
A
Antony, 2019-08-19
@RiseOfDeath

As I understand it, you want to do the same thing that can be done through ifconfig, only without ifconfig - directly kicking the system. (Are you sure that you really need this?)
Actually, there is libnetlink for this (which iproute uses), which can do everything that the system can do in general regarding network interfaces.
I recommend taking and looking at ifconfig sources, and using the debugger to see how it does what you need. the documentation for libnetlink, in my opinion, is worthless and incomplete (to put it mildly, a lot of what is used in ifconfig is not described at all) and, in my opinion, the API is not very convenient there.

L
Lynn "Coffee Man", 2019-08-19
@Lynn

Well, for example https://linuxconfig.org/configuring-virtual-networ... In
general, a search for linux virtual ethernet gives an answer in 5 seconds

A
Alexander, 2019-08-19
@UPSA

It may come in handy ...
As far as I remember, you need the bridge-utils package
sudo apt-get install bridge-utils
Or maybe not needed ... I don’t remember))) look
here
Meaning - you put the ip address not on the network card, but on the virtual interface .

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question