Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to get info about the bridged interface of a node? #331

Open
chlohr opened this issue Jan 15, 2025 · 4 comments
Open

How to get info about the bridged interface of a node? #331

chlohr opened this issue Jan 15, 2025 · 4 comments
Assignees
Labels

Comments

@chlohr
Copy link

chlohr commented Jan 15, 2025

Related Bug

No response

Feature Description

Hello,
Let'say I've started a node with: kathara vstart --eth 0:A --bridged -n pc1
What should I do to get IP of this bridged interface ?
Something answering "Hey, node pc1 is at 172.17.0.2"
Many thanks!
Regards

Solution

No response

Alternative Solutions

No response

Additional Context

No response

@Skazza94
Copy link
Member

Hi @chlohr,
Kathará does not directly manage the Layer3 of the network (it is set up by the user through the startup files and Docker).
Therefore, there is no straightforward way to know the bridged IP address from Kathará.

You need to "ask" the device about the IP address.

If you know the eth number, for example eth3, you can obtain the IP address by running:

kathara exec <device_name> -- ip addr show dev eth3

If you need a machine-readable output, you can try the following:

kathara exec <device_name> -- ip -j addr show dev eth3

Will give you a JSON output.

@Skazza94 Skazza94 self-assigned this Jan 15, 2025
@chlohr
Copy link
Author

chlohr commented Jan 15, 2025

Many thanks for your message.

I guess the right way to do this is to ask Docker:

docker inspect ` kathara linfo -n pc1 | sed -ne 's,.*Container Name: \(.*\) .*,\1,p' ` | jq -r '.[0].NetworkSettings.Networks.bridge.IPAddress'

But this is rather complex. Is there a more simple way?

@chlohr
Copy link
Author

chlohr commented Jan 15, 2025

Another suggestion (not necessarily simpler):

 docker inspect --format='{{println .NetworkSettings.Networks.bridge.IPAddress}}' `docker ps --filter 'label=name=pc1' --format '{{.ID}}'`

@Skazza94
Copy link
Member

Hi @chlohr,
both your solutions are fine.

But this is rather complex. Is there a more simple way?

As I already mentioned before, Kathará does not handle the IP stack (even if the bridged is managed by Docker). Therefore we do not expose any API to retrieve IP addresses (which might also be unassigned to interfaces).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants