2011/10/09

Managing the Cisco SGE2000 switch from Linux remotely

Today I had to access a new switch fresh out the box to manage for the first time, the Cisco SGE2000 24-port Gigabit Switch!

To manage the switch remotely I chose to plug a second network interface card (NIC) in a general purpose linux server with Debian GNU/Linux. Here is the previous network configuration:

# cat /etc/network/interfaces

# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

# The loopback network interface
auto lo eth2
iface lo inet loopback

# The primary network interface
allow-hotplug eth2
iface eth2 inet static
        address 192.168.24.111
        netmask 255.255.255.0
        network 192.168.24.0
        post-up iptables-restore < /etc/iptables.up.rules


In my network the gateway is located at 192.168.24.1.
Why using the eth2 for the default network access? Well, I needed the server to have a wake-on-lan capable NIC.

As indicated in the the quick start guide, to configure the switch over IP with Web GUI you should connect a PC to any of the non-stacking ethernet ports with an Ethernet cable.

"The default static IP address is 192.168.1.254 and the default management VLAN for the static IP address is VLAN 1. The default user name is admin and the default password is admin."

Well, if you have a second NIC available in a linux box connected to the switch you just can use it to manage the switch. Remember that the first NIC is need to access remotely the linux box as usual. You don't just have to be physically there :-) Just plug the cable and do it from your desktop (may be from your home?).

The new network configuration is:


# cat /etc/network/interfaces
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

# The loopback network interface
auto lo eth2
iface lo inet loopback

#Switch management
auto eth0
allow-hotplug eth0
iface eth0 inet static
        address 192.168.1.111
        netmask 255.255.255.0
        network 192.168.1.0
        gateteway 192.168.1.254


# The primary network interface
allow-hotplug eth2
iface eth2 inet static
        address 192.168.24.111
        netmask 255.255.255.0
        network 192.168.24.0
        post-up iptables-restore < /etc/iptables.up.rules

The NIC that I will use to manage the switch is eth0 (I use the eth2 as the default because the wake-on-lan feature), the network and the gateway indicated here are needed because because we are avoiding to stand in front of the switch with a laptop connected directly. We talk now talk with switch directly.

The network configuration is now:

# ifconfig
eth0      Link encap:Ethernet  HWaddr 00:1c:c0:a1:7b:df 
          inet addr:192.168.1.111  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fe80::21c:c0ff:fea1:7bdf/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:719 errors:0 dropped:0 overruns:0 frame:0
          TX packets:401 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:369094 (360.4 KiB)  TX bytes:37445 (36.5 KiB)
          Memory:e3200000-e3220000

eth2      Link encap:Ethernet  HWaddr 5c:d9:98:9e:ab:7a 
          inet addr:192.168.24.111  Bcast:192.168.24.255  Mask:255.255.255.0
          inet6 addr: fe80::5ed9:98ff:fe9e:ab7a/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:34219 errors:0 dropped:0 overruns:0 frame:0
          TX packets:15991 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:10273485 (9.7 MiB)  TX bytes:3165535 (3.0 MiB)
          Interrupt:18 Base address:0x4000

lo        Link encap:Local Loopback 
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:3742 errors:0 dropped:0 overruns:0 frame:0
          TX packets:3742 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:18011813 (17.1 MiB)  TX bytes:18011813 (17.1 MiB)


The route table is now:

# route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
192.168.1.0     0.0.0.0         255.255.255.0   U     0      0        0 eth0
192.168.24.0    0.0.0.0         255.255.255.0   U     0      0        0 eth2
0.0.0.0         192.168.24.1    0.0.0.0         UG    0      0        0 eth2


And now we access the switch's web interface from the linux box. In my case I just started a vncserver (local port forwarding with ssh) and login remotely from my home :-)


























We can access the telnet interface as well:

$ telnet 192.168.1.254


Now you may need this administration guide.

Enjoy!