arpa2 / mkroot

InternetWide Architecture Component Builders
1 stars 0 forks source link

Network infra: Declare bridges #22

Closed vanrein closed 4 years ago

vanrein commented 4 years ago

In internetwide/CMakeLists.txt, declare a number of bridge names. They are optional until one of the underlying scripts requires their name (because they want to inject interfaces into it, of course).

Presumed useful levels are (with iwo0 as a default scope, more could be imagined on the same machine if so desired).

There is no reason why all these interfaces have to be different bridges, but the ability to declare them separately is useful. Bridges are cheap! It makes sense to split these into separate network name spaces too, except that this makes them difficult to review by network administrators.

Each interface is described with

vanrein commented 4 years ago

When constructing networking scripts, avoid the name conflict risk of the local name creation,

... &&
ip link add kip0if0 type veth peer name kip0eth0 &&
ip link set kip0eth0 netns kip0ns &&
...

instead create the name directly in the target netns,

... &&
ip link add kip0if0 type veth peer name kip0eth0 netns kip0ns &&
...
vanrein commented 4 years ago

Currently using deprecated prestart hook. Move to new ones and hope to create the netns for the KIP Service.

vanrein commented 4 years ago

The prestart hook is the only option that seems to work, createContainer is not invoked at all.

vanrein commented 4 years ago

This is how far we can get now. Cannot create bridges (duh) or network namespace (pitty) because prestart is the only hook, and it won't accept such statements. So, no cleanup either.

vanrein commented 4 years ago

News alert! It is possible to set the netns on both interfaces when creating a pair,

ip link add test0 netns test type veth peer name test1 netns kip0ns

This is still missing functionality, so go for it!

vanrein commented 4 years ago

Finally resolved, with the bridges appearing in their own netns, using the trick above, in 023e2c13e347ea5e9b6429659f270f5e992d28aa in branch master. We now have a really flexible engine.