Cisco Switchport mode by SNMP - perl

Do it have a way to access and add/change/remove the switchport mode option from a port by SNMP ?
I found no any information about it and seems to be not possible...
I'm curently searching a way to autoconfig ports using perl scripts and SNMP.
If anyone have a solution or even another way to do this, I'll be grateful.
Thanks.

What I understand from your post is, that you want to configure the vlans and trunks (or something else?) on multiple switches/routers . If thats true you better look on "VLAN Trunking Protocol". One of the best guides and explanation I found is that one- https://www.youtube.com/watch?v=jHw7OUqcg-g
The best way would probably be to prepare individual configuration and extract it via Console.
Otherwise I am still confuse what you really want to achieve. If they have IP assigned to a vlan/interface you can burst configuration via Telnet with a script. - But that looks like an overkill for this purpose.

Related

How to capture and forward SNMP messages using WinSNMP?

I'm fairly new to SNMP/WinSNMP and I'm trying to access what it would take to accept SNMP traffic on ports 161/162 and forward it to another device. I would like to be able to examine messages and possibly modify them before passing them to the device.
Would WinSNMP agent APIs be suitable for it? Are there any examples out there how to accomplish this in C++?
I'd appreciate any pointers.
Thanks.
Sounds like you want to make a Proxy Agent. There are already a great number of such implemented, so in order to avoid reinventing the wheel, do a web search for "windows snmp proxy" and see if you could use one of those products instead.

Using perl to talk to serial port for sat comms

This is probably an easy one, but I need to use perl to both talk to a serial port, and accept responses back from it - ideally something which would flag up to the rest of my programme that a new message has come back from the port so that I can process it?
The unit I'm using is called a RockBLOCK, it's a two-way satellite communicator module, plugs into the USB port, but presents itself as a normal serial device. Details here in case anyone is interested: http://rockblock.rock7mobile.com
Does anyone have any sample code for sending data plus also flagging if a message has come back? The first bit seems fairly straighforward, but the second less so...
Searching CPAN for the obvious terms gives me Device::SerialPort and Win32::SerialPort which both seem to do exactly what you need.

Finding out where the bandwidth is being used

Recently on some of our sites the bandwidth being used has risen tenfold and we want to know what is using it. All we have so far is the MRTG graphs that just say 'you used X much at this time'.
I would like to break down this information by service (ftp, http etc), direction (inbound or outbound), source and destination address and when.
To this end I have started logging all the packets through iptables. This seems to give me what I want at a very detailed level. Is there some tool that will take that log file and condense the information in some way.
Ideally it would provide information like:
1.1.1.1 send 123 bytes to 2.2.2.2 via http at 2011-02-24T10:03:17
Any ideas as to how I might achieve this or at least some pointers to making sense of the iptables log format.
A good tool for network analysis is Ethereal
Not sure if it will give you what you want exactly, but it will tell you what's going on with your network.
http://www.ethereal.com/

What's the best way to handle multiple outgoing connections in Perl?

I have three TCP servers I need to connect to, each with different protocols, but all in nonblocking mode. Right now my plan is essentially opening a new IO::Socket per each one and adding them to IO::Select, then looping through can_read(). The idea is based on how servers are usually written in Perl, but it seems like it could work for clients.
I'm wondering if this is the best way to do it, furthermore I'm also wondering how I can probe each connection for disconnection, and initiate a reconnection to it without disrupting the other sockets. Any code examples would be a great help, or at least some points in the right direction on how best to do this.
You may want to use AnyEvent, or POE. Just look through the documentation, it has some nice examples to help you learn your way around.

Is there a way to discover what different types of switches am I connected to?

I wanted to know if we could find out what type of switch our machine is directly connected to ..
For instance if I am connected to a Cisco,Brocade,foundry and Force10 switch .
Is it possible to write a perl script to find out the management address of the switch [without logging in]
Is it possible to write a perl script to find out the switch vendor and model number ...
Thanks for your suggestions.
EDIT: Wanted to add that I am directly connected to the switch .. I can disable the firewall on my machine ...
nmap is what you want. If that doesn't do it, the answer is probably "no". If you need the IP address of the switch, run traceroute/tracert to see what the next hop is.
There is no guaranteed way of being able to achieve this. It depends very much on how your switch has been configured and how open your network admins have made it.
If everything is completely open then the best way of finding out the type of switch is to use snmp. The net-snmp library for perl (see docs here) is a good place to start.
But that assumes that the management interface is exposed to your box.
There is no guarantee that it will be.
If it is then nmap (as suggested by others) may work. At least it might tell you if the management interface is accessible at which point you can use snmp to tell you the rest.
Traceroute might yield some more information, but only if the address used for it's routing is the same as the management address. (and assuming that your "switch" is really a "router". If not then this won't yield any useful information.)
ping might yield some information about the manufacturer, but only if it hasn't been configured to proxy-arp.
On Cisco switchs if CDP is activated you should be able to see CDP traffic on your wire which will indicate switch model, name and switch port you are connected to.
Don't know for other brands.
Not really. In the modern world of firewalled, packet-modifying, NATed subnetworks, you really can't do anything reliably to inspect a network from a client machine.
That said, trying nmap on your router might tell you something interesting. Or it might not. The results are entirely up to the admins of your network.
follow the wire
You can ping it to get its Ethernet address, and then look it up in one of the vendor code lists.