Mobilfunkrouter (Alcatel L850V) mit FreeBSD

Aus Port23Wiki
(Unterschied zwischen Versionen)
Wechseln zu: Navigation, Suche
(Konfiguration FreeBSD)
(Konfiguration Alcatel onetouch L850V 4G+)
Zeile 120: Zeile 120:
 
nd6 options=21<PERFORMNUD,AUTO_LINKLOCAL>
 
nd6 options=21<PERFORMNUD,AUTO_LINKLOCAL>
   
Mit DHCP kann eine IP-Adresse angefordert werden:
+
Mit DHCP kann eine IP-Adresse angefordert werden (IPv6 geht z. Z. mit O2 SIM-Karte nicht):
   
 
ue0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
 
ue0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
Zeile 132: Zeile 132:
 
Je nachdem ob der Mobilfunkprovider IPv6 unterstützt gibt es auch eine IPv6 Adresse per stateless Autoconfiguration.
 
Je nachdem ob der Mobilfunkprovider IPv6 unterstützt gibt es auch eine IPv6 Adresse per stateless Autoconfiguration.
   
Beispiel bei Linux (andere SIM-Karte):
+
Beispiel bei Linux (Mit Congstar/Telekom SIM-Karte):
   
 
enp0s22f2u1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
 
enp0s22f2u1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500

Version vom 21. Mai 2020, 15:50 Uhr


Konfiguration eines Mobilfunkrouters mit FreeBSD und einem LTE-Stick "Alcatel onetouch L850V 4G+"

USB-Mobilfunksticks werden in der Regel aus Sicht des Betriebssystems entweder über eine serielle Schnittstelle und AT-Kommandos angesprochen oder sie stellen eine Ethernet Schnittstelle bereit. Über DHCP kann eine IPv4 Adresse konfiguriert werden. IPv6 wird mittels Stateless Address Autoconfiguration (Router Advertisements) konfiguriert.

Konfiguration Alcatel onetouch L850V 4G+

Der LTE-Stick Alcatel onetouch L850V 4G+ stellt eine Ethernet Schnittstelle zur Verfügung und hat ein eigenes Web-Interface.

Leider befinden sich die meisten Stick nicht per Default in diesem Modus. Per default stellen sie einen USB-Speicherstick dar wo sich die Windows-Software zur Installation befindet. Diese Software schaltet unter Windows den Modus des Sticks um.

Diese Umschaltung erfolgt unter FreeBSD (und Linux) mit dem Tool usb_modeswitch.

Das Tool kann mit dem Befehl: "pkg install usb_modewitch" installiert werden.

Nach Einstecken des Sticks stellt sich dieser so dar:

Auszug aus dmesg:

ugen3.2: <Alcatel MobileBroadBand> at usbus3
umass0 on uhub3
umass0: <Mass Storage> on usbus3
umass0:  SCSI over Bulk-Only; quirks = 0x4000
umass0:2:0: Attached to scbus2
da0 at umass-sim0 bus 0 scbus2 target 0 lun 0
da0: <ONETOUCH ESTORIL 2.31> Removable Direct Access SCSI-2 device
da0: 40.000MB/s transfers
da0: Attempt to query device size failed: NOT READY, Medium not present
da0: quirks=0x2<NO_6_BYTE>
cd0 at umass-sim0 bus 0 scbus2 target 0 lun 1
cd0: <ONETOUCH ESTORIL 2.31> Removable CD-ROM SCSI-2 device
cd0: 40.000MB/s transfers
cd0: 50MB (25600 2048 byte sectors)
cd0: quirks=0x10<10_BYTE_ONLY>
usbconfig
ugen3.2: <Alcatel MobileBroadBand> at usbus3, cfg=0 md=HOST spd=HIGH (480Mbps) pwr=ON (500mA)

bzw.:

usbconfig dump_device_desc

ugen3.2: <Alcatel MobileBroadBand> at usbus3, cfg=0 md=HOST spd=HIGH (480Mbps) pwr=ON (500mA)
 bLength = 0x0012 
 bDescriptorType = 0x0001 
 bcdUSB = 0x0201 
 bDeviceClass = 0x0000  <Probed by interface class>
 bDeviceSubClass = 0x0000 
 bDeviceProtocol = 0x0000 
 bMaxPacketSize0 = 0x0040 
 idVendor = 0x1bbb 
 idProduct = 0xf000 
 bcdDevice = 0x0228 
 iManufacturer = 0x0001  <Alcatel>
 iProduct = 0x0002  <MobileBroadBand>
 iSerialNumber = 0x0003  <0123456789ABCDEF>
 bNumConfigurations = 0x0001 

Mit folgendem Befehl kann der Stick umgeschaltet werden:

usb_modeswitch -v 0x1bbb -p 0xf000 -c /usr/local/share/usb_modeswitch/1bbb:f000

Look for target devices ...
No devices in target mode or class found"Alcatel onetouch L850V 4G+"
Look for default devices ...
Found devices in default mode (1)
Access device 002 on bus 003
Get the current device configuration ...
Current configuration number is 1
Use interface number 0
with class 8
Use endpoints 0x01 (out) and 0x81 (in)
Looking for active drivers ...
OK, driver detached
Set up interface 0
Use endpoint 0x01 for message sending ...
Trying to send message 1 to endpoint 0x01 ...
OK, message successfully sent
Read the response to message 1 (CSW) ...
Response reading failed (error -9)
Device is gone, skip any further commands
-> Run lsusb to note any changes. Bye!

Die ProductID wurde von 0xf000 nach 0x0195 umgeschaltet:

ugen3.2: <Alcatel MobileBroadBand> at usbus3, cfg=0 md=HOST spd=HIGH (480Mbps) pwr=ON (500mA)

 bLength = 0x0012 
 bDescriptorType = 0x0001 
 bcdUSB = 0x0201 
 bDeviceClass = 0x0000  <Probed by interface class>
 bDeviceSubClass = 0x0000 
 bDeviceProtocol = 0x0000 
 bMaxPacketSize0 = 0x0040 
 idVendor = 0x1bbb 
 idProduct = 0x0195 
 bcdDevice = 0x0228 
 iManufacturer = 0x0001  <Alcatel>
 iProduct = 0x0002  <MobileBroadBand>
 iSerialNumber = 0x0003  <0123456789ABCDEF>
 bNumConfigurations = 0x0001 

Generell erfolgt das Ansteuern von USB-Tethering Geräten über drei Verfahren:

https://www.freebsd.org/doc/handbook/network-usb-tethering.html

- Android™ devices generally use the urndis(4) driver.
- Apple® devices use the ipheth(4) driver.
- Older devices will often use the cdce(4) driver.

Der "Alcatel onetouch L850V 4G+" wird mittels dem urndis Treiber angesprochen. Dafür muß das Modul if_urndis geladen werden:

kldload if_urndis

dann steht die Ethernet Schnittstelle zur Verfügung.

ue0: flags=8802<BROADCAST,SIMPLEX,MULTICAST> metric 0 mtu 1500
       ether ee:3a:f2:5f:b3:55
       nd6 options=21<PERFORMNUD,AUTO_LINKLOCAL>

Mit DHCP kann eine IP-Adresse angefordert werden (IPv6 geht z. Z. mit O2 SIM-Karte nicht):

ue0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
      ether ee:3a:f2:5f:b3:55
      inet6 fe80::ec3a:f2ff:fe5f:b355%ue0 prefixlen 64 scopeid 0x4
      inet 192.168.1.145 netmask 0xffffff00 broadcast 192.168.1.255
      nd6 options=23<PERFORMNUD,ACCEPT_RTADV,AUTO_LINKLOCAL>

Das Webinterface des LTE-Sticks kann über die Adresse 192.168.1.1 erreicht werden.

Je nachdem ob der Mobilfunkprovider IPv6 unterstützt gibt es auch eine IPv6 Adresse per stateless Autoconfiguration.

Beispiel bei Linux (Mit Congstar/Telekom SIM-Karte):

enp0s22f2u1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
       inet 192.168.1.137  netmask 255.255.255.0  broadcast 192.168.1.255
       inet6 fe80::5de4:43ff:3bc6:5df6  prefixlen 64  scopeid 0x20<link>
       inet6 2a01:598:b900:d225:ce81:ac1c:c048:1b60  prefixlen 64 scopeid 0x0<global>
       ether 5a:b9:ef:c3:80:5a  txqueuelen 1000  (Ethernet)
       RX packets 15244  bytes 14222973 (13.5 MiB)
       RX errors 0  dropped 0  overruns 0  frame 0
       TX packets 13772  bytes 4661913 (4.4 MiB)
       TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

Konfiguration FreeBSD

Damit der Router für ein kleines LAN eingesetzt werden kann soll noch NAT für IPv4 und IPv6-to-IPv6 NETWORK PREFIX TRANSLATION (NPTv6) für IPv6 konfiguriert werden. Dazu soll der FreeBSD Paketfilter soll folgendermassen konfiguriert werden:

- NAT für IPv4 
- IPv6-to-IPv6 NETWORK PREFIX TRANSLATION (NPTv6)

Ausschnitt aus der Manpage von ipfw:

IPv6-to-IPv6 NETWORK PREFIX TRANSLATION (NPTv6)

    ipfw supports in-kernel IPv6-to-IPv6 network prefix translation as	de-
    scribed in	RFC6296.  The kernel module ipfw_nptv6 should be loaded	or
    kernel should has options IPFIREWALL_NPTV6	to be able use NPTv6 transla-
    tor.


            +-----------+                              +---------+
            |           |192.168.1.1       192.168.1.2 |         |192.168.2.1     +-----+
Internet----| LTE-Stick |------------------------------| FreeBSD |----------------| LAN |
            |           |        /64 IPv6 Prefix       |         |fd00::/8        +-----+
            +-----------+                              +---------+


Ob das IPv6-to-IPv6 NETWORK PREFIX TRANSLATION wie erwartet funktioniert muß getestet werden.

Meine Werkzeuge