skydive-project / skydive

An open source real-time network topology and protocols analyzer
https://skydive.network
Apache License 2.0
2.66k stars 400 forks source link

Can routers and switches be discovered in the network topology? #1867

Open RunningXJ opened 5 years ago

RunningXJ commented 5 years ago

By the way, I run allinone mode on one physical machine, open a virtual machine on another machine, and also run allinone mode. Why in the virtual machine, open the browser and only display one machine, can't find another An agent

safchain commented 5 years ago

All the agents need to have the list of the analyzer set in their configuration file:

https://github.com/skydive-project/skydive/blob/master/etc/skydive.yml.default#L175

A usual deployment is

The standalone mode is there mostly for testing purpose, for a single node

RunningXJ commented 5 years ago

thanks! Can routers and switches be discovered in the network topology?

RunningXJ commented 5 years ago

I started with a binary file, then do I need to write the configuration file myself? The contents of the configuration file must be all there, or just add the configuration you want to use. Can a file like this be used? Analyzers:    - 127.0.0.1:8082 Agent: 192.168.4.18:8081

safchain commented 5 years ago

adding just what you need is enough. As an example, if you have 2 agents(host) and 1 analyzer

the configuration of the agents will be

analyzers:
  - <analyzer ip>:8082

so same config file for all the agents. Of course IP/Port of the analyzer have to be reachable by the agents.

For the router/switch discovery, I would say yes if they support LLDP. In that case the LLDP probe as to be enabled.

https://github.com/skydive-project/skydive/blob/master/etc/skydive.yml.default#L204

So need to add this in the agent config file

agent:
  topology:
    probes:
      - lldp
RunningXJ commented 5 years ago

thank for your time. i wrote like this:

analyzers:

agent:

is something wrong? When I start it shows, ERROR agent/agent.go:45 glob..func1 xj-virtual-machine: Can't start Skydive agent: Authentication type unknown or backend not defined for:

RunningXJ commented 5 years ago

if i just need to write: analyzers:

agent:

RunningXJ commented 5 years ago

I executed the skydive analyzer with a host. Other agents (host) executed skydive agent -c skydive.yml The contents of the configuration file are as follows: Analyzers:    - 192.168.4.120:8082

But it prompts me: ERROR websocket/client.go:557 (*Client).Start.func1 controller: Unable to create a WebSocket connection ws://192.168.4.120:8082/ws/agent/topology : dial tcp 192.168.4.120:8082: connect: Connection refused

But I did not disable the 8082 port

lebauce commented 5 years ago

@RunningXJ I suggest you first try to peer your agent and your analyzer together, then later set up the authentication.

Regarding the Connection refused error, by default the analyzer listens only on 127.0.0.1:8082 So you need to set the following configuration for the analyzer :

analyzer:
    listen: 192.168.4.120:8082
RunningXJ commented 5 years ago

thanks!I will try it!

RunningXJ commented 5 years ago

thank you very much ! it works! BTW, when I want to discover routers and switches, I assume that I know that router switches support lldp, so what configuration do I need to do for routers and switches? Or it can be found automatically

RunningXJ commented 5 years ago

When I start the agent on two hosts, why are the two nodes not connected together in the network topology? They are on the same subnet, one is 192.168.4.14 and the other is 192.168.4.15

lebauce commented 5 years ago

Did you enable the lldp probe as suggested by @safchain ?

agent:
  topology:
    probes:
      - lldp

If so - and if the agents are on the same switch of course -, agents should be linked though a switch (displayed in orange in the Web UI, as in https://user-images.githubusercontent.com/4539421/46472598-04ae5080-c7de-11e8-8824-9158f8633a26.png)

lebauce commented 5 years ago

Skydive does not link agents if they are on the same L3 network. You need to use LLDP or use the fabric probe :

analyzer:
  topology:
    fabric:
    - TOR1[Name=tor1] -> TOR1_PORT1[Name=port1, MTU=1500]
    - TOR1_PORT1 -> *[Type=host, Name=agent1]/eth1
    - TOR1[Name=tor1] -> TOR1_PORT2[Name=port2, MTU=1500]
    - TOR1_PORT2 -> *[Type=host, Name=agent2]/eth1

You need to replace agent1 and agent2 with the respective hostnames of your agents, and eth1 with the name of the network interface connected to the switch

RunningXJ commented 5 years ago

If I enable the lldp probe, then do I only need to do the following configuration on the node where the agent is runing: for example: Analyzers:    - 192.168.4.120:8082 Agent:    Topology:      Probes:       - lldp

RunningXJ commented 5 years ago

BTW,if I enable the lldp probe,can I also discover the router in the topology? Because lldp is a link layer protocol, it is found that most of them can configure lldp for the switch, but rarely see to configure the router.

safchain commented 5 years ago

As stated by @lebauce routers(L3) won't be reported you need to provide the topology using the configuration : https://github.com/skydive-project/skydive/blob/master/etc/skydive.yml.default#L84

another solution is to use Ansible : http://skydive.network/blog/ansible-library.html

or the Node/Edge API : http://skydive.network/blog/topology-rules.html

RunningXJ commented 5 years ago

For example, the switch needs to support lldp before it can be probed. What protocol does the router need to support?

RunningXJ commented 5 years ago

I have one machine for 192.168.4.14, another machine for 192.168.4.15, switch for Cisco, SG92-24. This switch has LLDP enabled. My agent configuration is as follows: Analyzers:    - 192.168.4.120:8082 Agent:    Topology:      Probes:        - lldp\ The analyzers are configured as follows: Analyzer:           Listen: 192.168.4.120:8082 Agent:    Topology:       Probes:        - lldp

Why is there no switch in my network topology diagram?

lebauce commented 5 years ago

Without the logs, it's a bit difficult. Can you set the logging level to debug with:

logging:
  level: DEBUG

and paste the logs in the issue ? Thanks

RunningXJ commented 5 years ago

The following is the analysis node:

The following is the agent node:

lebauce commented 5 years ago

@RunningXJ The logs are incomplete. Screenshots are not the best way to send logs. Could you put the complete logs as text ? Thanks

RunningXJ commented 5 years ago

The last question has been resolved. I don't know much about this fabric network architecture, but according to online information, this TOR, or the concept of the switch? I mean whether it supports the discovery of routers for Layer 3 networks? Thanks

lebauce commented 5 years ago

The last question has been resolved.

So the LLDP probe is now working ? So you should now have a node for the Cisco switch with 2 ports attached to this switch. Then each Skydive agent should be linked to one of these ports. Right ?

I mean whether it supports the discovery of routers for Layer 3 networks?

Skydive does not support any L3 discovery. Only L2 discovery through the LLDP probe. If you have 2 agents that are not connected to the same L2 network, you can use the fabric probe as stated in my previous comment (https://github.com/skydive-project/skydive/issues/1867#issuecomment-502681521). This is simply a static configuration that describes manually the link between the nodes. The sample configuration I posted :

Of course, if the LLDP probe worked properly, this fabric configuration should not be necessary.

Hope this helps

RunningXJ commented 5 years ago

yes,it works! The two nodes I mentioned earlier can already be connected together as follows: The discovery of the L3-network will not be added in the future. In addition, I am currently trying to find an open source or free tool to discover the physical network environment and form a visual network topology. Do you have any suggestions?

lebauce commented 5 years ago

There is a chance that L3 discovery will be added in the future (we already discussed about it but I can't tell you when it will be done).

RunningXJ commented 5 years ago

Hahaha, I will continue to pay attention, can you give me some suggestions for finding tools? Thank you

15367060916 commented 3 years ago

My question is similar to yours. There are two hosts and one switch. The host numbers are set to 192.168.1.100 and 192.168.1.50 respectively. I am not sure whether my switch has activated the LLDP probe, so I manually grab the port information in the form of fiber configuration. Why are there no two host nodes and one switch in my topology diagram.@lebauce @RunningXJ

15367060916 commented 3 years ago

This is my configuration file: analyzer: listen:192.168.1.15:8082 fabric:

analyzers:

agent1:

15367060916 commented 3 years ago

BTW,I would like to ask whether the same configuration is required on each host, that is, each host needs to be configured with the same analyzer address and two host agents. My current topology map is only my own host node, and I can't see another host, including the switch. @safchain

All the agents need to have the list of the analyzer set in their configuration file:

https://github.com/skydive-project/skydive/blob/master/etc/skydive.yml.default#L175

A usual deployment is

  • one analyzer
  • multiple agents

The standalone mode is there mostly for testing purpose, for a single node