| 78 | | echo "configure" >> $SERIAL |
| 79 | | sleep 1 |
| 80 | | echo "set interface management-ethernet eth0 address $IP_ADDR" >> $SERIAL |
| 81 | | sleep 1 |
| 82 | | echo "set vlans vlan-id 8" >> $SERIAL |
| 83 | | echo "set system services telnet connection-limit 7" >> $SERIAL |
| | 72 | 1. A bash script for range port configurations over serial. It supports a very limited number of configuration schemes: |
| | 73 | * VLAN creation |
| | 74 | * port VLAN/type assignment and deleting configurations |
| | 75 | * management interface configuration |
| | 76 | * "help" or "?" for a list of commands |
| 85 | | for i in `seq 1 48` |
| 86 | | do |
| 87 | | echo "set interface gigabit-ethernet ge-1/1/$i family ethernet-switching native-vlan-id 8" |
| 88 | | sleep 1 |
| 89 | | done >> $SERIAL |
| 90 | | |
| 91 | | echo "set interface gigabit-ethernet ge-1/1/47 family ethernet-switching port-mode trunk" >> $SERIAL |
| 92 | | echo "set interface gigabit-ethernet ge-1/1/47 family ethernet-switching native-vlan-id 1" >> $SERIAL |
| 93 | | echo "set interface gigabit-ethernet ge-1/1/47 family ethernet-switching vlan members 8" >> $SERIAL |
| 94 | | echo "commit" >> $SERIAL |
| 95 | | sleep 8 |
| 96 | | echo "save running-to-startup" >> $SERIAL |
| 97 | | echo "exit" >> $SERIAL |
| 98 | | echo "configs complete..." |
| 99 | | }}} |
| 100 | | To use it, run as root, specifying the IP address you want the switch to be set to and the serial interface to the switch. |
| 101 | | |
| 102 | | A more usable script for range port configurations can be found attached to this page. It supports a very limited number of configuration schemes in a mock-IP8800-like CLI: |
| 103 | | * VLAN creation |
| 104 | | * port VLAN/type assignment |
| 105 | | * management port configuration |
| 106 | | * "help" or "?" for a list of commands |
| 107 | | This script also has to be run as root. |
| | 78 | This script also has to be run as root, and assumes that your serial device is /dev/ttyUSB0. This should be modified accordingly. When run, the script gives you a mock-switch style CLI: |
| | 101 | 2. A similar script for configuring switches over the network (with its companion support library). The script assumes that you are on a machine that can access the network management VLAN. |
| | 102 | |
| | 103 | {{{ |
| | 104 | ~$ ./swconf.rb -h |
| | 105 | Allows configuration of multiple ports on a Quanta running XorPlus. |
| | 106 | Usage: ./swconf.rb [host] [port] |
| | 107 | -d, --debug Enable verbose debugging mode (default: off) |
| | 108 | -r, --dryrun Do a dry run (Do not actually send command - default: off) |
| | 109 | -h, --help Display this list |
| | 110 | }}} |
| | 111 | |
| | 112 | {{{ |
| | 113 | ~$ ./swconf.rb "s-sb" 10001 |
| | 114 | D, [2011-08-30T12:45:30.578119 #7325] DEBUG -- : host: s-sb port: 10001 |
| | 115 | > help |
| | 116 | clear - clear the screen |
| | 117 | delete - delete settings |
| | 118 | exit - exit script |
| | 119 | help - display this list |
| | 120 | iface [eth0|eth1] [IP addr] - Configure management interface address. Address is in CIDR form (e.g 172.16.0.30/16) |
| | 121 | ports [portrange] - Configure VLAN and mode of ports in a list of ports [portrange] |
| | 122 | save - Commit changes to memory |
| | 123 | vlan [VLAN ID] - instantiate a VLAN interface of tag [VLAN ID] |
| | 124 | }}} |
| | 125 | |
| | 126 | {{{ |
| | 127 | > ports 2..4,7 |
| | 128 | (ports)# help |
| | 129 | vlan [1..1020]: set native vlan for ports |
| | 130 | mode [access|trunk] |
| | 131 | delete: wipe out port settings |
| | 132 | range [portrange]: configure new range of ports |
| | 133 | exit: exit from port context |
| | 134 | }}} |
| | 135 | |
| | 136 | Both can be found as attachments to this page. |
| | 137 | |