1 saulo o. d. luiz laboratório 7 sistemas embarcados período 2010.2

12
1 Saulo O. D. Luiz Laboratório 7 Sistemas embarcados Período 2010.2

Upload: internet

Post on 17-Apr-2015

109 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: 1 Saulo O. D. Luiz Laboratório 7 Sistemas embarcados Período 2010.2

1 Saulo O. D. Luiz

Laboratório 7

Sistemas embarcados

Período 2010.2

Page 2: 1 Saulo O. D. Luiz Laboratório 7 Sistemas embarcados Período 2010.2

2 Saulo O. D. Luiz

Roteiro

• Configuração da Emulação de Ethernet via USB

Page 3: 1 Saulo O. D. Luiz Laboratório 7 Sistemas embarcados Período 2010.2

3 Saulo O. D. Luiz

Visão Geral

serial RS 232

console do OMAP (minicom)

Barramentode Ethernetsimulado

telnetd

Estação 2

USB

Page 4: 1 Saulo O. D. Luiz Laboratório 7 Sistemas embarcados Período 2010.2

4 Saulo O. D. Luiz

Configuração da Estação 2

• Configure a Estação 2 para reconhecer uma interface USB para emulação de Ethernet:

– sudo vi /etc/network/interfaces

– Adicione ao final do arquivo:

auto usb0

iface usb0 inet static

address 192.168.2.15

netmask 255.255.255.0

network 192.168.2.0

broadcast 192.168.2.255

up iptables -t nat -A POSTROUTING -o eth0 -s 192.168.2.15 -j MASQUERADE

up echo 1 > /proc/sys/net/ipv4/ip_forward

down iptables -t nat -D POSTROUTING -o eth0 -s 192.168.2.15 -j MASQUERADE

down echo 0 > /proc/sys/net/ipv4/ip_forward

Endereço IP para a interface USB (modifique-o conforme a sua rede)

Page 5: 1 Saulo O. D. Luiz Laboratório 7 Sistemas embarcados Período 2010.2

5 Saulo O. D. Luiz

Configuração da Estação 2

• Se ainda não instalados:

– sudo apt-get install telnetd

– sudo apt-get install netkit-inetd

• Iniciar o serviço inetd

– sudo /etc/init.d/inetd start

• Permitir acesso ao serviço telnet:

– sudo vi /etc/hosts.allow

– Adicionar ao final do arquivo a linha:

ALL: ALL

Page 6: 1 Saulo O. D. Luiz Laboratório 7 Sistemas embarcados Período 2010.2

6 Saulo O. D. Luiz

Porta USB do módulo H2

telnetd

Estação 2

plug padrão “A”

plug mini “B”

• Remova o cabo Ethernet da Estação 2

• Ligue o cabo USB entre OMAP e

Estação 2

Cabo USB qua acompanha o kit OMAP

Page 7: 1 Saulo O. D. Luiz Laboratório 7 Sistemas embarcados Período 2010.2

7 Saulo O. D. Luiz

Reconhecimento da conexão USB• Observe no console do OMAP:

/ $ tps65010: battery charging

udc: USB reset done, gadget ether

udc: USB reset done, gadget ether

udc: USB reset done, gadget ether

udc: USB reset done, gadget ether

usb0: full speed config #1: 8 mA, Ethernet Gadget, using CDC Ethernet

Page 8: 1 Saulo O. D. Luiz Laboratório 7 Sistemas embarcados Período 2010.2

8 Saulo O. D. Luiz

Reconhecimento da conexão USB

• No console da estação 2:

– dmesg

[17180326.332000] usb 3-2: new full speed USB device using uhci_hcd and address 2[17180326.512000] usb 3-2: configuration #1 chosen from 2 choices[17180326.724000] usb0: register 'cdc_ether' at usb-0000:00:1d.2-2, CDC Ethernet Device, 1a:86:ea:b3:c1:8c[17180326.724000] usbcore: registered new driver cdc_ether[17180326.848000] ip_tables: (C) 2000-2006 Netfilter Core Team[17180326.852000] Netfilter messages via NETLINK v0.30.[17180326.868000] ip_conntrack version 2.4 (8189 buckets, 65512 max) - 224 bytes per conntrack[17180337.128000] usb0: no IPv6 routers present

Page 9: 1 Saulo O. D. Luiz Laboratório 7 Sistemas embarcados Período 2010.2

9 Saulo O. D. Luiz

Reconhecimento da conexão USB

• No console da estação 2:

– ifconfig

...

usb0 Encapsulamento do Link: Ethernet Endereço de HW 0E:0E:91:C2:F5:E9 inet end.: 192.168.2.15 Bcast:192.168.2.255 Masc:255.255.255.0 endereço inet6: fe80::c0e:91ff:fec2:f5e9/64 Escopo:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Métrica:1 pacotes RX:0 erros:0 descartados:0 excesso:0 quadro:0 Pacotes TX:0 erros:4 descartados:0 excesso:0 portadora:0 colisões:0 txqueuelen:1000 RX bytes:0 (0.0 b) TX bytes:0 (0.0 b)

Page 10: 1 Saulo O. D. Luiz Laboratório 7 Sistemas embarcados Período 2010.2

10 Saulo O. D. Luiz

Configuração do OMAP

• No console do OMAP:

– ifconfig usb0 up 192.168.2.16

– ifconfig

...

usb0 Link encap:Ethernet HWaddr BA:A4:E9:14:A4:9B inet addr:192.168.2.16 Bcast:192.168.2.255 Mask:255.255.255.0 UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:38 errors:0 dropped:0 overruns:0 frame:0 TX packets:45 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:3290 (3.2 KiB) TX bytes:3029 (2.9 KiB)

Page 11: 1 Saulo O. D. Luiz Laboratório 7 Sistemas embarcados Período 2010.2

11 Saulo O. D. Luiz

Teste

• No console do OMAP:– ping 192.168.2.15

• No console da estação 2:– ping 192.168.2.16

• No console da estação 1 (esperamos obter Destination Host Unreachable):

– ping 192.168.2.15

– ping 192.168.2.16

Page 12: 1 Saulo O. D. Luiz Laboratório 7 Sistemas embarcados Período 2010.2

12 Saulo O. D. Luiz

Teste

• No console do OMAP:– telnet 192.168.2.15

– Faça login na Estação 2