wiki:Internal/OpenFlow/CLISetup

Version 16 (modified by akoshibe, 15 years ago) ( diff )

Configuring the switch through command line interface (CLI)

The IP8800/S3640-48T2XW and IP8800/S3640-24T2XW are the two models of NEC switch that support OpenFlow. This page is a how-to/log on configuring the IP8800/S3640-48T2XW NEC switch through the CLI.

References

For people literate in Japanese, a complete set of configuration guides may be found in the documents section of the NEC website.

console connection to the switch (6/11)

The switch uses regular RS-232 for the serial connection. The settings for the serial connection are the following:

  • speed: 9600
  • data bits: 8
  • stop bits: 1
  • Flow control: none
  • Parity: none

Minicom didn't seem to work too well no matter what settings were changed. Kermit was used to connect to the switch because default settings can be used directly and no changes need to be made. After installation (The Debian package is ckermit), use the following commands as root:

 C-Kermit>set line /dev/ttyS0
 C-Kermit>set carrier-watch off
 C-Kermit>connect

Ctrl-\ q ends the kermit session.

If the login prompt doesn't show up, pressing enter a couple of times should do the trick. The default username is operator, and the password, blank.

Making configuration changes through CLI

A lot of it looks like Cisco IOS. Type enable in the prompt to get to privileged mode. The '>' should become a '#'.

> ena
# 

The shorthand of a command can be used. The switch also does command completions when you hit tab. A full list of commands can be seen by typing ? at the prompt. Commands are often used in compound, so a ? can be used at any time to see what options are available:

# show interface ?
  gigabitethernet     The type of a port is specified in
                      10BASE-T/100BASE-TX/1000BASE-T/1000BASE-X line
  tengigabitethernet  The type of a port is specified in 10GBASE-R line

To actually configure the switch, you need to be in configuration mode. Type configure to enter configuration mode:

# configure      
(config)# 

If, at any time, you get confused as to which interface or what you are even configuring, command show will output the name of the interface and the configuration changes made to it so far:

(config-if)# show
interface gigabitethernet 0/27
  switchport mode access
  switchport access vlan 4
!

Telnet access to the switch (6/12)

To telnet to a switch, you need to set up an IP address for the switch. To do this, you need to not only set up a vlan interface to which the IP address belongs, but also permit telnet access.

  1. After entering configuration mode, create a vlan. Give it a name if you feel like it. The '!' before the prompt indicates that a change has been made, and you must use the command 'save' before exiting out of config mode to have the configuration changes apply.
    (config)# vlan 4
    !(config-vlan)# name "telnet"
    !(config-vlan)# exit
    !(config)# 
    
  1. Assign the port that is to be used for remote access the vlan you just created. the range of ports available save the 10GBe interfaces are 0/1-0/48.
    !(config)# interface gigabitethernet 0/27
    !(config-if)# switchport mode access 
    !(config-if)# swi acc vlan 4         
    !(config-if)# exit
    
  1. Assign an IP address and subnet mask to the vlan's interface:
    !(config)# interface vlan 4
    !(config-if)# ip address 192.168.10.1 255.255.255.0
    !(config-if)# exit
    !(config)#
    

 

  1. Allow login via telnet. This will limit the number of maximum simultaneous telnet connections to 3. save will allow config changes to survive a reboot, and gets rid of the annoying !'s.

!(config)# line vty 0 2
!(config-line)# exit
!(config)#   
!(config)# save
(config)# exit
# 

The telnet VLAN (4) was later changed to VLAN 1.

switch as DHCP server

The switch can be a DHCP server, so it was made so the laptop that'll be used to test if the telnet configs worked would get an address from the switch. This was later disabled since hosts on this switch would acquire IP addresses from a designated DHCP server. The commands for making the switch a DHCP server is here.

The right way to flash the switch (6/16)

The specific how-to's are on another article, but the general gist is to copy the firmware, license, and configuration files onto a SD card provided by NEC, and cold booting the switch off of it.

VLAN Configuration, based on convention (6/23)

The switch should follow the conventions used in other switches for which port corresponds to which VLAN, where the trunk is, ect. After week 2, the switch was booted back into normal mode (no SD card), and the VLANs statically set according to the following convention for networking SB9:

UsageportsVLAN
CM1-43
Control5-827
Data9-1228

Static VLAN Configuration

Configuration of the CM VLAN (VLAN 3) is shown here.

  1. Create and name VLAN
    (config)# vlan 3
    !(config-vlan)# name "CM"
    !(config-vlan)# exit
    
  1. Assign CM VLAN 3 to the desired ports. Unfortunately, you have to configure one port at a time. Luckily, you can use the up arrow key to go through previous commands to make things faster.
    !(config)# interface gi 0/1
    !(config-if)# switchport mode access
    !(config-if)# switchport acc vlan 3
    !(config)# interface gi 0/2
    !(config-if)# switchport mode access
    !(config-if)# switchport acc vlan 3
    !(config)# interface gi 0/3
    !(config-if)# switchport mode access
    !(config-if)# switchport acc vlan 3
    !(config)# interface gi 0/4
    !(config-if)# switchport mode access
    !(config-if)# switchport acc vlan 3
    

  1. After repeating steps 1 and 2 for the Control and Data VLANs (with correct port numbers and VLAN number, of course), configure the trunk ports:
    !(config-if)# interface gi 0/45
    !(config-if)# switchport mode trunk
    !(config-if)# switchport trunk allowed vlan 3,27,28
    !(config-if)# interface gi 0/46
    !(config-if)# switchport mode trunk
    !(config-if)# switchport trunk allowed vlan 3,27,28
    !(config-if)# interface gi 0/47
    !(config-if)# switchport mode trunk
    !(config-if)# switchport trunk allowed vlan 3,27,28
    !(config-if)# interface gi 0/48
    !(config-if)# switchport mode trunk
    !(config-if)# switchport trunk allowed vlan 3,27,28
    !(config-if)# exit
    !(config)# save
    (config)# exit
    

DHCP/BootP relay agent (6/24)

attempt was made but not knowing the DHCP server's address didn't help. Nevertheless, translations on how to set up a relay agent/ IP helper are here.

Native VLAN configuration (6/25)

A native VLAN was set up on the trunk ports so the switch will have an interface that can be assigned an IP address.

  1. Make a VLAN. Name the native VLAN.
    (config)# vlan 1
    (config-vlan)# name "Network"
    !(config-vlan)# exit
    
  2. Assign static IP address to the interface. we needed to find the switch's IP address with nslookup. This was actually done 7/2, after its MAC address was registered.
    !(config-vlan)# interface vlan 1
    !(config-if)# ip address 172.16.19.253 255.255.0.0
    
  3. Configure ports to be trunk ports, then specify the native VLAN
    !(config)# interface gi 0/48
    !(config-if)# switchport mode trunk 
    !(config-if)# switchport trunk native vlan 1
    
  4. Specify which VLANs are allowed on the trunk. This includes all VLANs that converge to this trunk, as well as the native VLAN for this trunk. If the port is already made to allow other VLANs, instead of using command switchport trunk allowed vlan 1,3,27,28 you can just add VLAN 1 by using the vlan add <vlan ID> context:
    !(config-if)# swi trunk allowed vlan add 1
    

so now the configurations for port 0/48 look like this:

!(config-if)# sh
interface gigabitethernet 0/48
  switchport mode trunk
  switchport trunk allowed vlan 1,3,27-28
  switchport trunk native vlan 1

Port speeds (7/17)

By default, the switch autonegociates. You can change this by going into configuration mode for each port, and changing settings using the speed command. The syntax:

  • speed auto [10|100|1000] - autonegociate. If a speed is specified, the port will be shut down by the switch if the host refuses to negotiate to the set speed.
  • speed [10|100|1000] - sets port to specific speed, no autonegociation

The port should be shut down before changing speed settings. This seems to allow the changes to take immediate effect, even before saving config changes. Each port needs to be configured separately, which makes it a bit annoying.

sw-sb09(config)#  interface gi 0/13
sw-sb09(config-if)# shutdown
!sw-sb09(config-if)# 
02/06 03:35:48 E3 PORT GigabitEthernet0/13 25011100 1350:000000000000 Port disabled administratively.
!sw-sb09(config-if)# speed auto 1000
!sw-sb09(config-if)# no shutdown      

SNMP (8/13)

For a explanation of SNMP: http://en.wikipedia.org/wiki/Simple_Network_Management_Protocol
In the IP8800 guide: http://www.nec.co.jp/ip88n/s36_sw/html/cfguide2/index.html
MIB references: http://www.alvestrand.no/objectid/

Configuring the IP8800

Use of SNMP (Simple Network Management Protocol) is not set by default; you must create access lists with IP addresses allowed to request information as a manager device. In this case, an ACL is created for all the interfaces of SB9, eth1:

!sw-sb09(config)# access-list 1 permit 10.19.0.10 0.0.0.0
!sw-sb09(config)# access-list 1 permit 192.168.100.28 0.0.0.0
!sw-sb09(config)# access-list 1 permit 192.168.1.28 0.0.0.0
!sw-sb09(config)# access-list 1 permit 172.16.100.1 0.0.0.0
!sw-sb09(config)# sh access-list 
access-list 1 10 permit host 10.19.0.10
access-list 1 20 permit host 192.168.100.28
access-list 1 30 permit host 192.168.1.28
access-list 1 40 permit host 172.16.100.1

To add a block of IP's to the ACL, you need the starting IP address and wildcard (range of host addresses available) for that IP block. To add the Network VLAN subnet to the ACL:

access-list 1 50 permit 172.16.0.1 0.0.255.255

to include it in the snmp access list, use the following command:

sw-sb09(config)# snmp-server community "NET" rw 1

where "NET" is the group name, "rw" - read/write, as opposed to "ro", read-only, and "1" is the access list allowed.

Accessing MIBs on the IP8800

accessing it through the switch itsself is easy enough:

sw-sb09# snmp walk 1.3.6.1.2.1.1            

Name: sysDescr.0
Value: ALAXALA AX3640S AX-3640-48T2XW-L [AX3640S-48T2XW] Switching software Ver. 
10.7 [OS-L3L]

Name: sysObjectID.0
Value: ax3640s

Name: sysUpTime.0
Value: 25724205

Name: sysContact.0
Value: 

Name: sysName.0
Value: sw-sb09

Name: sysLocation.0
Value: 

Name: sysServices.0
Value: 78

From a manager device - snmpwalk

with snmpwalk from SB9:

root@sb9:~# snmpwalk -v 2c -c NET 172.16.100.10 1.3.6.1.2.1.1
SNMPv2-MIB::sysDescr.0 = STRING: ALAXALA AX3640S AX-3640-48T2XW-L [AX3640S-48T2XW] Switching software Ver. 10.7 [OS-L3L]
SNMPv2-MIB::sysObjectID.0 = OID: SNMPv2-SMI::enterprises.21839.1.2.11
DISMAN-EVENT-MIB::sysUpTimeInstance = Timeticks: (26201570) 3 days, 0:46:55.70
SNMPv2-MIB::sysContact.0 = STRING: 
SNMPv2-MIB::sysName.0 = STRING: sw-sb09
SNMPv2-MIB::sysLocation.0 = STRING: 
SNMPv2-MIB::sysServices.0 = INTEGER: 78

Using Ruby scripts

libsnmp reference: http://snmplib.rubyforge.org/doc/index.html

Ruby has libsnmp-ruby, a library for SNMP, available. SB9 didn't come with it, so it was installed:

apt-get install libsnmp-ruby

A messy irb test of the library:

irb(main):002:0> require 'snmp'
irb(main):004:0> agent_hostname = "172.16.100.10"
=> "172.16.100.10"
irb(main):005:0> agent_comm = "NET"
=> "NET"
irb(main):007:0> s = SNMP::Manager.new(:Host => agent_hostname, :Community =>agent_comm, :Port => 161)
=> #<SNMP::Manager:0xb79d5d98 @snmp_version=:SNMPv2c, @port=161, @transport=#<SNMP::UDPTransport:0xb79d5d5c @socket=#<UDPSocket:0xb79d5d34>>, @write_community="NET", @host="172.16.100.10", @retries=5, @community="NET", @mib=#<SNMP ... #this goes on for a while
irb(main):009:0> response = s.get(["1.3.6.1.2.1.1.1.0"])
=> #<SNMP::Response:0xb79c2d10 @error_index=0, @error_status=0, @request_id=856260869, @varbind_list=[#<SNMP::VarBind:0xb79c2900 @value="ALAXALA AX3640S AX-3640-48T2XW-L [AX3640S-48T2XW] Switching software Ver. 10.7 [OS-L3L]", @name=[1.3.6.1.2.1.1.1.0]>]>
irb(main):035:0> rstring = "#{response.varbind_list.to_s}"
=> "[name=1.3.6.1.2.1.1.1.0, value=ALAXALA AX3640S AX-3640-48T2XW-L [AX3640S-48T2XW] Switching software Ver. 10.7 [OS-L3L] (OCTET STRING)]"




Go back to OpenFlow index

Note: See TracWiki for help on using the wiki.