1

I am trying to develop a network monitoring windows application. Is there any way to detect whether physical firewall, routers and switches are running properly and not switched off or not working? Also I need to detect this from a client system connected to the LAN.

I guess for the switch a ping to its IP address is necessary?

For pinging switch, here is my code,

void PingSwitch()
{
    var ping = new Ping();

    if (!string.IsNullOrEmpty(this.IPV4Address))
    {
        PingReply pingReply = ping.Send(this.IPV4Address);

        if (pingReply.Status == IPStatus.Success)
            this.Background = Brushes.Green;
        else
            this.Background = Brushes.Red;
    }
}

How do I do with router and firewall?

Jehof
  • 34,674
  • 10
  • 123
  • 155
Matt
  • 1,953
  • 1
  • 19
  • 42
  • If they are 'managed' then they should have a protocol/API that you should be able to use, I don't think theres a generic one. But I'm not sure what you mean by 'working fine'? Do you mean you want an app that would open comms on every single port and try to reach something behind a firewall? – cjb110 Mar 20 '13 at 08:15
  • @cjb110 'working fine' means, the devices are running properly and not switched off or not working. – Matt Mar 20 '13 at 08:18
  • 1
    Do note that routers and switches might have ping turned off (that is, they do not respond to ICMP packages). You can check this [nmap tutorial](http://nmap.org/bennieston-tutorial/) to see how nmap does it. – default Mar 20 '13 at 08:21
  • That's rather vague for the type of kit your talking about. But one solution is you need a client/server combo. The server part sits on one side of the firewall/router/switch and the client sits on the other. If you open a comms between the two then you know the switch and router work, and by changing the port of the comms you can check the firewall. But really you need to look at the devices themselves to see if they have any kind of management features. – cjb110 Mar 20 '13 at 08:22
  • @Default what about physical firewall? – Matt Mar 20 '13 at 08:22
  • @Dhanesh not sure what you mean by "what about physical firewall". If it blocks ping? well, yeah. A firewall blocks traffic - that's what it's for. I'm just saying, I don't think you should rely on a ping to **any** node on the network if you want to be certain. – default Mar 20 '13 at 08:26
  • @Default I would like to detect if firewall is running properly. Firewall do not have ip address, so how will I check if firewall is working fine from my application? – Matt Mar 20 '13 at 08:30
  • @Dhanesh see [this question](http://stackoverflow.com/questions/6943205/detect-if-windows-firewall-is-blocking-my-program) to see how to communicate with the Windows Firewall. – default Mar 20 '13 at 08:36
  • @Default sorry I need to detect physical firewall(network device) not Windows firewall. – Matt Mar 20 '13 at 08:47

1 Answers1

0

For those who are interested I am posting the solution I got.

As @Default suggested I used nmap and doing stealth scan on Switch and Router from c# and for detecting firewall this post helped.

Community
  • 1
  • 1
Matt
  • 1,953
  • 1
  • 19
  • 42