HAYAGUI

FedoraCore3 + usbnet

はじめに

PC間をEthernetのクロスケーブルで接続するみたいに、 PC間をUSBのAコネクタで接続してTCP/IPを使えるUSBケーブル(SD-U2DLINK-A1)がパソコン工房にあったので、 買ってきました。メーカーの本家Web日本語Web。 内部のチップは ALi製のM5632 です。

サポートOSはWindowsだけですが、Linuxのusbnetドライバ(http://www.linux-usb.org/usbnet/)を使うことでLinuxでも使えそうなので、 やってみました。残念ながら、FreeBSDの4.11 も 5.3 も使えそうなものがありません。

使ってみる

2台のPCにFedoraCore3 をインストールしました。
[root@localhost ~]# uname -a
Linux localhost.localdomain 2.6.9-1.667 #1 Tue Nov 2 14:41:31 EST 2004 i686 i686 i386 GNU/Linux

[root@localhost ~]#
SD-U2DLINK-A1 をPCのUSBコネクタに挿すと、以下のようなメッセージが表示されます。
Apr 24 16:43:50 localhost kernel: usb 1-2: new full speed USB device using addre ss 3
Apr 24 16:43:55 localhost kernel: usb0: register usbnet at usb-0000:00:11.2-2, A Li M5632
Apr 24 16:43:55 localhost kernel: usbcore: registered new driver usbnet
ifconfig してみる。
[root@localhost ~]# ifconfig
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:8069 errors:0 dropped:0 overruns:0 frame:0
          TX packets:8069 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:12026442 (11.4 MiB)  TX bytes:12026442 (11.4 MiB)

[root@localhost ~]#
次に USB0 を指定して ifconfig します。
[root@localhost ~]# ifconfig usb0
usb0      Link encap:Ethernet  HWaddr CE:0D:51:1B:D6:DD
          BROADCAST 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)

[root@localhost ~]#
[root@localhost ~]# ip addr show usb0
4: usb0:  mtu 1500 qdisc noop qlen 1000
    link/ether ce:0d:51:1b:d6:dd brd ff:ff:ff:ff:ff:ff
[root@localhost ~]#
このネットワークインターフェイスのIPアドレスに 192.168.1.10 を設定します。
[root@localhost ~]# ifconfig usb0 192.168.1.10 netmask 255.255.255.0
[root@localhost ~]# ifconfig usb0
usb0      Link encap:Ethernet  HWaddr CE:0D:51:1B:D6:DD
          inet addr:192.168.1.10  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fe80::cc0d:51ff:fe1b:d6dd/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:5 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 b)  TX bytes:362 (362.0 b)

[root@localhost ~]#
[root@localhost ~]# ip addr show usb0
4: usb0:  mtu 1500 qdisc pfifo_fast qlen 1000
    link/ether ce:0d:51:1b:d6:dd brd ff:ff:ff:ff:ff:ff
    inet 192.168.1.10/24 brd 192.168.1.255 scope global usb0
    inet6 fe80::cc0d:51ff:fe1b:d6dd/64 scope link
       valid_lft forever preferred_lft forever
[root@localhost ~]#
ethtool でネットワークインターフェイスの状況をみます。
[root@localhost ~]# ethtool usb0
Settings for usb0:
        Current message level: 0x00000001 (1)
        Link detected: yes
[root@localhost ~]# ethtool -i usb0
driver: usbnet
version: 25-Aug-2003
firmware-version: ALi M5632
bus-info: usb-0000:00:11.2-2
[root@localhost ~]#
とりあえず ping してみる。
[root@localhost ~]# ping 192.168.1.10
PING 192.168.1.10 (192.168.1.10) 56(84) bytes of data.
64 bytes from 192.168.1.10: icmp_seq=0 ttl=64 time=0.299 ms
64 bytes from 192.168.1.10: icmp_seq=1 ttl=64 time=0.192 ms

--- 192.168.1.10 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1001ms
rtt min/avg/max/mdev = 0.192/0.245/0.299/0.055 ms, pipe 2
[root@localhost ~]#
もう一台のPCにも接続し、IPアドレスを 192.168.1.11 を設定します。

IPアドレスが 192.168.1.10 の localhost(ホスト名が未設定)機から、192.168.1.11 にping してみます。 できます。

[root@localhost ~]# ping 192.168.1.11
PING 192.168.1.11 (192.168.1.11) 56(84) bytes of data.
64 bytes from 192.168.1.11: icmp_seq=0 ttl=64 time=6.15 ms
64 bytes from 192.168.1.11: icmp_seq=1 ttl=64 time=5.86 ms
64 bytes from 192.168.1.11: icmp_seq=2 ttl=64 time=5.85 ms

--- 192.168.1.11 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2001ms
rtt min/avg/max/mdev = 5.858/5.959/6.154/0.151 ms, pipe 2
[root@localhost ~]#
では、192.168.1.11 に ssh ログインして ifconfig してみます。
[root@localhost ~]# ssh 192.168.1.11
The authenticity of host '192.168.1.11 (192.168.1.11)' can't be established.
RSA key fingerprint is 38:4a:4e:a2:cf:a3:84:b0:35:0c:71:89:5f:a9:49:31.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '192.168.1.11' (RSA) to the list of known hosts.
root@192.168.1.11's password:
Last login: Sun Apr 24 15:38:37 2005
[root@mico ~]# uname -a
Linux mico.hayagui.com 2.6.9-1.667 #1 Tue Nov 2 14:41:25 EST 2004 i686 i686 i386 GNU/Linux
[root@mico ~]# ifconfig
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:12 errors:0 dropped:0 overruns:0 frame:0
          TX packets:12 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:896 (896.0 b)  TX bytes:896 (896.0 b)

usb0      Link encap:Ethernet  HWaddr 32:E8:00:64:B2:DB
          inet addr:192.168.1.11  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fe80::30e8:ff:fe64:b2db/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:109 errors:0 dropped:0 overruns:0 frame:0
          TX packets:89 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:9946 (9.7 KiB)  TX bytes:18941 (18.4 KiB)

[root@mico ~]# ethtool -i usb0
driver: usbnet
version: 25-Aug-2003
firmware-version: ALi M5632
bus-info: usb-0000:00:07.2-1
[root@mico ~]# exit
logout

Connection to 192.168.1.11 closed.
[root@localhost ~]#
こんな感じに、普通のネットワークカードのように使えます。httpもできるので、便利便利。


戻る



(C)1999 - 2005 Kenji Ito All rights reserved.