Faça por sua conta e risco. Você é o responsável por tudo. Dicas, perguntas e sugestões são bem vindas (reclamações não).
Arquivos necessários (gerar ou fazer download)
Comprar equipamentos Cisco
Você pode adquirir equipamentos usados Cisco no MercadoLivre.com, eBay.com, etc. Existem alguns sites especializados em equipamentos usados. Apenas tome os cuidados necessários em compras nestes sites. Se você não tiver experiência suficiente, peça ajuda ou não compre.
Topologia
Desenhe a sua topologia, ou melhor, topologias. Vamos utilizar os equipamentos Cisco ligados a host PC's virtualizados pelo VMWare.
Para cada conexão física entre os equipamentos Cisco e o seu PC host, vamos utilizar uma interface de rede. Neste caso, você tem 2 opções: comprar interfaces de rede PCI com vários conectores (muito caro) ou comprar um hub USB com várias portas, várias interfaces USB/Ethernet (uma para cada conexão) e várias interfaces USB/Seriais (uma para cada equipamento Cisco) .
Sugestões de topologias (em construção)
Instalação de software
Ubuntu 12.04 LTS (sempre LTS)
Faça dowload e instale o Ubuntu 12.0.4 LTS do site www.ubuntu.com. Utilize o método NNF de instalação. Depois de instalado, atualize todos os softwares disponíveis.
$ sudo apt-get autoclean
$ sudo apt-get autoremove
$ sudo apt-get build-dep
$ sudo apt-get check
$ sudo apt-get clean
$ sudo apt-get update
$ sudo apt-get upgrade
Opcionalmente instalar um servidor SSH
$ sudo apt-get install openssh-server
Mais informações em https://help.ubuntu.com/community/SSH/OpenSSH/Configuring.
Criação do usuário "shutdown"
Para que você possa desligar remotamente, com segurança, o Ubuntu, é importante que você crie um usuário "shutdown". Ao fazer login com este usuário, o computador desliga com segurança. Para criar o usuário shutdown, realize os seguintes passos extraídos de http://askubuntu.com/questions/137483/how-to-create-a-shutdown-user-or-shutdown-account:
$ sudo adduser --system shutdown
$ sudo passwd shutdown
$ sudo vi /home/shutdown/desliga.sh
#!/bin/bash
/usr/bin/sudo
/sbin/shutdown -h now
$ sudo chown shutdown:nogroup /home/shutdown/desliga.sh
$ sudo chmod 500 /home/shutdown/desliga.sh
$ sudo gedit /etc/passwd
shutdown:x:???:65534::/home/shutdown:/bin/false
shutdown:x:???:65534::/home/shutdown:/home/shutdown/desliga.sh
$ sudo visudo
Cmnd_Alias SHUTDOWN=/sbin/shutdown -h now
shutdown ALL=NOPASSWD: SHUTDOWN
Pronto. Ao fazer login com o usuário shudown, o computador desliga!
Hub USB
Para suportar as diversas interfaces de rede e seriais, é necessário um hub USB. No meu caso, eu comprei um no DX.com (SKU 172301). Este eu não recomendo porque os conectores estão fora do padrão e o encaixe fica folgado, com problemas de contato elétrico.
E para piorar mais ainda a situação, depois de tudo instalado, percebi que todas as interfaces possuem o mesmo endereço MAC :(
Instalação das interfaces de rede
A interface de rede que eu usei foi comprada na DX.com (SKU 160154). Ela não vem com driver para Ubuntu, mas existem alguns disponíveis na Internet para download. Das 4 interfaces que eu comprei, uma veio com defeito. Uma segunda interface queimou um pouco depois, com pouquíssimo tempo de uso.
$ sudo apt-get install unrar
$ sudo make
$ sudo make install
$ sudo modprobe HG20F9
$ sudo rm /etc/udev/rules.d/70-persistent-net.rules
obs.: pode ser que o seu arquivo não tenha o nome de 70-persistent-net.rules, mas certamente será alguma coisa parecida, neste diretório.
$ sudo ifconfig
eth0 Link encap:Ethernet HWaddr 00:1b:fc:1d:cb:78
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
eth1 Link encap:Ethernet HWaddr 00:09:72:83:62:58
inet6 addr: fe80::209:72ff:fe83:6258/64 Scope:Link
UP BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:2 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 B) TX bytes:176 (176.0 B)
eth2 Link encap:Ethernet HWaddr 00:09:72:83:62:58
inet6 addr: fe80::209:72ff:fe83:6258/64 Scope:Link
UP BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:1 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 B) TX bytes:94 (94.0 B)
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:22 errors:0 dropped:0 overruns:0 frame:0
TX packets:22 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:1871 (1.8 KB) TX bytes:1871 (1.8 KB)
vmnet1 Link encap:Ethernet HWaddr 00:50:56:c0:00:01
inet addr:172.16.149.1 Bcast:172.16.149.255 Mask:255.255.255.0
inet6 addr: fe80::250:56ff:fec0:1/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:59 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
vmnet2 Link encap:Ethernet HWaddr 00:50:56:c0:00:02
inet addr:192.168.1.1 Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: fe80::250:56ff:fec0:2/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:59 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
vmnet3 Link encap:Ethernet HWaddr 00:50:56:c0:00:03
inet addr:192.168.3.1 Bcast:192.168.3.255 Mask:255.255.255.0
inet6 addr: fe80::250:56ff:fec0:3/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:59 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
vmnet8 Link encap:Ethernet HWaddr 00:50:56:c0:00:08
inet addr:172.16.213.1 Bcast:172.16.213.255 Mask:255.255.255.0
inet6 addr: fe80::250:56ff:fec0:8/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:59 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
wlan0 Link encap:Ethernet HWaddr 00:06:4f:96:38:ad
inet addr:10.0.0.7 Bcast:10.0.0.255 Mask:255.255.255.0
inet6 addr: fe80::206:4fff:fe96:38ad/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:503 errors:0 dropped:0 overruns:0 frame:0
TX packets:393 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:92558 (92.5 KB) TX bytes:172760 (172.7 KB)
$ sudo lsusb
Bus 001 Device 002: ID 1a40:0201 Terminus Technology Inc. Hub
Bus 003 Device 002: ID 046d:c52b Logitech, Inc. Unifying Receiver
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 001 Device 004: ID 1a40:0201 Terminus Technology Inc. Hub
Bus 001 Device 005: ID 067b:2303 Prolific Technology, Inc. PL2303 Serial Port
Bus 001 Device 006: ID 066b:20f9 Linksys, Inc.
Bus 001 Device 007: ID 067b:2303 Prolific Technology, Inc. PL2303 Serial Port
Bus 001 Device 008: ID 066b:20f9 Linksys, Inc.
Bus 001 Device 009: ID 067b:2303 Prolific Technology, Inc. PL2303 Serial Port
Bus 001 Device 010: ID 067b:2303 Prolific Technology, Inc. PL2303 Serial Port
As interfaces de rede USB são reconhecidas como sendo Linksys!
Como todas as interfaces possuem o mesmo endereço MAC, é necessário que o endereço seja modificado manualmente. Existem várias opções, uma delas é:
$ sudo ifconfig eth1 down
$ sudo ifconfig eth1 hw ether 00:09:72:83:62:01
$ sudo ifconfig eth1 up
$ sudo ifconfig eth2 down
$ sudo ifconfig eth2 hw ether 00:09:72:83:62:02
$ sudo ifconfig eth2 up
Observação: no meu caso, as interfaces com o mesmo endereço MAC eram as interfaces eth1 e eth2. Verifique quais interfaces você precisa mudar o endereço MAC com o comando "ifconfig" mostrado anteriormente.
Se o método anterior para modificar o endereço MAC não funcionar ou não for satisfatório, tente o seguinte método:
#!/bin/bash
# Placa Chinesa Meslin
# Adicionar a regra do UDEV em /etc/udev/rules.d
# USB device 0x066b:0x20f9 (usb)
# SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:09:72:83:62:58", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth5"
DEBUG=2 # set to 1 for debugging output
NOMESCRIPT="PLACA CHINESA DO MESLIN" # Usado no logger
PLACA="$1" #nome da placa (ethX)
NUM="$2" # numero da placa (X)
if [ $3 -eq 1 ]; then MAC="00:09:72:83:62:0"; fi
if [ $3 -eq 2 ]; then MAC="00:e0:4c:53:44:0"; fi
LOGFACILITY="kernel.info" # for debugging output
if [ $DEBUG -ge 0 ]; then logger "$LOGFACILITY" "$NOMESCRIPT" Placa nova: "$PLACA"; fi
if [ $DEBUG -ge 0 ]; then logger "$LOGFACILITY" "$NOMESCRIPT" NUM: "$NUM"; fi
ifconfig $PLACA hw ether $MAC$NUM
# pcm.sh <nome da interface ethX> <numero da interface eth> <1 -> placa chinesa, 2 -> placa brasileira vinda da china>
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:09:72:83:62:58", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="?*", RUN+="/root/pcm.sh %k %n 1", NAME="eth%n"
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:e0:4c:53:44:58", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="?*", RUN+="/root/pcm.sh %k %n 2", NAME="eth%n"
$ sudo chown root:root /root/pcm.sh
$ sudo chmod +x /root/pcm.sh
$ sudo chown root:root /etc/udev/rules.d/65-pcm.rules
$ sudo rm /etc/udev/rules.d/70-persistent-net.rules
Você ainda precisa instalar o pacote 802.1Q para fazer entroncamento. Os passos a seguir foram obtidos em http://ubuntuforums.org/showthread.php?t=703387.
sudo apt-get install vlan
sudo modproble 8021q
$ sudo gedit /etc/modules
# /etc/modules: kernel modules to load at boot time.
#
# This file contains the names of kernel modules that should be loaded
# at boot time, one per line. Lines beginning with "#" are ignored.
lp
rtc
8021q
Mais informações em http://blog.scottlowe.org/?s=VLAN+trunking.
Pronto!
Instalação das interfaces seriais
$ sudo lsusb
Bus 001 Device 002: ID 1a40:0201 Terminus Technology Inc. Hub
Bus 003 Device 002: ID 046d:c52b Logitech, Inc. Unifying Receiver
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 001 Device 004: ID 1a40:0201 Terminus Technology Inc. Hub
Bus 001 Device 005: ID 067b:2303 Prolific Technology, Inc. PL2303 Serial Port
Bus 001 Device 006: ID 066b:20f9 Linksys, Inc.
Bus 001 Device 007: ID 067b:2303 Prolific Technology, Inc. PL2303 Serial Port
Bus 001 Device 008: ID 066b:20f9 Linksys, Inc.
Bus 001 Device 009: ID 067b:2303 Prolific Technology, Inc. PL2303 Serial Port
Bus 001 Device 010: ID 067b:2303 Prolific Technology, Inc. PL2303 Serial Port
$ sudo ls -l /dev/ttyUSB?
crw-rw---- 1 root dialout 188, 0 Oct 5 19:22 /dev/ttyUSB0
crw-rw---- 1 root dialout 188, 1 Oct 5 19:23 /dev/ttyUSB1
crw-rw---- 1 root dialout 188, 2 Oct 5 19:23 /dev/ttyUSB2
crw-rw---- 1 root dialout 188, 3 Oct 5 19:20 /dev/ttyUSB3
$ sudo apt-get install ser2net
$ cat /etc/ser2net.conf
# This is the configuration file for ser2net. It has the following format:
# <TCP port>:<state>:<timeout>:<device>:<options>
<saída omitida>
2000:telnet:600:/dev/ttyS0:9600 8DATABITS NONE 1STOPBIT banner
2001:telnet:600:/dev/ttyS1:9600 8DATABITS NONE 1STOPBIT banner
3000:telnet:600:/dev/ttyS0:19200 8DATABITS NONE 1STOPBIT banner
3001:telnet:600:/dev/ttyS1:19200 8DATABITS NONE 1STOPBIT banner
$ sudo /etc/init.d/ser2net restart
* Restarting Serial port to network proxy ser2net
...done.
$ telnet lab 2000
No meu caso, eu modifiquei o arquivo com os seguintes valores:
3000:telnet:600:/dev/ttyUSB0:9600 8DATABITS NONE 1STOPBIT banner
3001:telnet:600:/dev/ttyUSB1:9600 8DATABITS NONE 1STOPBIT banner
3002:telnet:600:/dev/ttyUSB2:9600 8DATABITS NONE 1STOPBIT banner
3003:telnet:600:/dev/ttyUSB3:9600 8DATABITS NONE 1STOPBIT banner
4000:telnet:600:/dev/ttyS0:19200 8DATABITS NONE 1STOPBIT banner
4001:telnet:600:/dev/ttyS1:19200 8DATABITS NONE 1STOPBIT banner
Pronto!
Instalação do emulador de terminais
$ sudo apt-get install putty
$ sudo putty &
$ locate .desktop | grep putty
$ sudo gedit /usr/share/applications/putty.desktop
Mais informações em http://askubuntu.com/questions/118822/how-to-launch-application-as-root-from-unity-launcher.
Sugestão: crie diversas sessões dentro do PuTTY para cada interface serial. Eu criei as sessões chamadas "Serial 0", "Serial 1", "Serial 2" e "Serial 3". Para um efeito interessante do emulador de terminais (e para matar a saudade do fósforo verde), configure a aparência ("Appearance") com fonte "Terminal, 14-point" e a cor do texto (Default Foreground) com verde (0, 255, 0). Pode ser interessante também aumentar a quantidade de linhas no buffer do histórico - clique em "Window" e mude o valor do campo "Lines of scrollback" de 200 (que é o default) para 2000.
Pronto!
Instalação do VMWare Workstation
$ chmod +x VMware-Workstation-Full-10.0.0-1295980.x86_64.bundle
$ sudo ./VMware-Workstation-Full-10.0.0-1295980.x86_64.bundle
Pronto!
Configuração do VMWare e sua Rede Interna
Instalar o xRPD
Instale o xRPD para acesso remoto via Remote Desktop Connection do Windows:
$ sudo apt-get install xrdp
Mais informações em http://www.liberiangeek.net/2012/05/connect-to-ubuntu-12-04-precise-pangolin-via-windows-remote-desktop/.
Opcionalmente instalar o gnome connection manager
$ chmod +x gnome-connection-manager_1.1.0_all.deb
$ ./gnome-connection-manager_1.1.0_all.deb
Mais informações em http://cciedynamips.wordpress.com/2012/05/08/installing-setting-up-gnome-connection-manager/.
Outras fontes bibliográficas: