Hey there community,
as I mentioned in two earlier postings (Recommendation for WWAN-Module and Reconfigure Interface without "Setup"), I got my hands on a “Fibocom L830-EB”-WWAN-module (which is actually the one in the biggest LTE-FritzBox “6890 LTE”) from an old laptop and I wanted to “pimp” my IPFire Mini Appliance to become a LTE-modem.
Now, after buying some stuff, compiling my own IPFire and writing a script for the connection-process, everything works really great and I wanted to share my experiences with you!
Some preliminary remarks:
-
This is going to be a long posting. Some of it would be better off in the wiki but I have no rights to write there (yet). Anyone is invited to put appropriate sections of this posting somewhere there.
-
This is not a “call for help”, just sharing my experience. Obviously, any advices or suggestions are welcome, but if you just “want to help” someone, there is no need to go on reading my tedious words.
-
I am no programmer / developer, I am just a meticulous guy who wants to know how something is supposed to work. So please, no shooting if I may have “violated” some “developer laws”.
-
I write my experiences as a result of a lot of trial & error and testing, so please don’t think that I figured out everything right on the spot.
Ok, lets start!
A. The situation and the hardware
As mentioned, I have a “Fibocom L830-EB”-WWAN-module, which is a M.2-module. The APU4D4-board does not have a M.2-slot, only two Mini-PCIe slots. So first of all, I bought a Mini-PCIe-to-M.2-adapter. I picked one from Delock (Delock Produkte 63384 Delock Konverter Mini PCIe > M.2 Key B Slot + Micro SIM Slot), not because they’re the best but because up until now I was always satisfied with their stuff.
The adapter has a built-in Micro-Sim-Card-slot which came in REALLY handy by surprise in the end. The APU4D4-board already has two Sim-Card-slots connected to the Mini-PCIe-slots, but you need a classic Mini-Sim for those. It will not work with these “Mini-Micro-Nano-Sim”-adapters because the contacts in the APU4D4-Sim-Card-slots are “spread wider” and the chip on a modern Sim-Card is just to small. Anyway, the Sim-Card-slot on the Delock adapter is a usual Micro-Sim-slot so it works with the modern triple-Sim-Cards in those punch-out-plastic thingys.
After I installed the module and the Sim-Card in the adapter and the adapter in the Mini Appliance, I realized that the library for communicating with WWAN-modules in IPFire is only for ones who talk “qmi” but not “mbim” (explanation see below).
Because the Fibocom-module only speaks “mbim”, it was time to build my own IPFire.
B.1 The implementation of “libmbim” - preparation
First, I downloaded the IPFire-sourcecode from github (for detailed information about building IPFire, see the wiki)
(I prefer to use the latest “core…” instead of “master”, so that relatively soon I can make an inplace-update via the official channel, which deletes the “Development Build”-line from the installation. )
I unpacked the zip-file, switched to the respective folder and downloaded the source codes for all the optional packages
sudo ./make.sh downloadsrc
Sometimes the download stops/fails, but executing the command again will quickly recognize all the files already downloaded and continue with the first one it did not download yet.
After everything was downloaded I needed to implement the new addon “libmbim”.
(I based the whole implementation process on “libqmi”, which already is part of IPFire, has almost the same configuration-, compiling- and installation-commands and serves exactly the same purpose as “libmbim”. The only difference is that “libqmi” is for WWAN modems who speak the Qualcomm MSM Interface (QMI) protocol and “libmbim” is for WWAN modems who speak Mobile Interface Broadband Model (MBIM) protocol. I tried to “customize” IPFire as little as possible.)
B.2 The implementation of “libmbim” - implementation
First I downloaded the source code of “libmbim”
https://www.freedesktop.org/wiki/Software/libmbim
(this should be the official source, where you can also get “libqmi”, which matches the checksum in IPFire, so everyting should be save, as far as I am concerned.)
For the “config-file” of libmbim I uncommented the same/similar lines like in the config-file of libqmi.
usr/bin/mbimcli
usr/bin/mbim-network
#usr/include/libmbim-glib
#usr/include/libmbim-glib/libmbim-glib.h
#usr/include/libmbim-glib/mbim-atds.h
#usr/include/libmbim-glib/mbim-auth.h
#usr/include/libmbim-glib/mbim-basic-connect.h
#usr/include/libmbim-glib/mbim-cid.h
#usr/include/libmbim-glib/mbim-compat.h
#usr/include/libmbim-glib/mbim-device.h
#usr/include/libmbim-glib/mbim-dss.h
#usr/include/libmbim-glib/mbim-enums.h
#usr/include/libmbim-glib/mbim-enum-types.h
#usr/include/libmbim-glib/mbim-errors.h
#usr/include/libmbim-glib/mbim-error-types.h
#usr/include/libmbim-glib/mbim-intel-firmware-update.h
#usr/include/libmbim-glib/mbim-message.h
#usr/include/libmbim-glib/mbim-ms-basic-connect-extensions.h
#usr/include/libmbim-glib/mbim-ms-firmware-id.h
#usr/include/libmbim-glib/mbim-ms-host-shutdown.h
#usr/include/libmbim-glib/mbim-ms-sar.h
#usr/include/libmbim-glib/mbim-ms-uicc-low-level-access.h
#usr/include/libmbim-glib/mbim-phonebook.h
#usr/include/libmbim-glib/mbim-proxy-control.h
#usr/include/libmbim-glib/mbim-proxy.h
#usr/include/libmbim-glib/mbim-qdu.h
#usr/include/libmbim-glib/mbim-qmi.h
#usr/include/libmbim-glib/mbim-quectel.h
#usr/include/libmbim-glib/mbim-sms.h
#usr/include/libmbim-glib/mbim-stk.h
#usr/include/libmbim-glib/mbim-ussd.h
#usr/include/libmbim-glib/mbim-utils.h
#usr/include/libmbim-glib/mbim-uuid.h
#usr/include/libmbim-glib/mbim-version.h
#usr/lib/libmbim-glib.la
#usr/lib/libmbim-glib.so
usr/lib/libmbim-glib.so.4
usr/lib/libmbim-glib.so.4.6.0
#usr/lib/pkgconfig/mbim-glib.pc
usr/libexec/mbim-proxy
#usr/share/bash-completion/completions/mbimcli
#usr/share/gtk-doc
#usr/share/gtk-doc/html
#usr/share/gtk-doc/html/libmbim-glib
#usr/share/gtk-doc/html/libmbim-glib/annotation-glossary.html
#usr/share/gtk-doc/html/libmbim-glib/api-index-1-0.html
#usr/share/gtk-doc/html/libmbim-glib/api-index-1-10.html
#usr/share/gtk-doc/html/libmbim-glib/api-index-1-12.html
#usr/share/gtk-doc/html/libmbim-glib/api-index-1-14.html
#usr/share/gtk-doc/html/libmbim-glib/api-index-1-16.html
#usr/share/gtk-doc/html/libmbim-glib/api-index-1-18.html
#usr/share/gtk-doc/html/libmbim-glib/api-index-1-24-4.html
#usr/share/gtk-doc/html/libmbim-glib/api-index-1-24.html
#usr/share/gtk-doc/html/libmbim-glib/api-index-1-26-2.html
#usr/share/gtk-doc/html/libmbim-glib/api-index-1-26.html
#usr/share/gtk-doc/html/libmbim-glib/api-index-1-2.html
#usr/share/gtk-doc/html/libmbim-glib/api-index-1-4.html
#usr/share/gtk-doc/html/libmbim-glib/api-index-1-8.html
#usr/share/gtk-doc/html/libmbim-glib/api-index-deprecated.html
#usr/share/gtk-doc/html/libmbim-glib/api-index-full.html
#usr/share/gtk-doc/html/libmbim-glib/ch01.html
#usr/share/gtk-doc/html/libmbim-glib/ch02.html
#usr/share/gtk-doc/html/libmbim-glib/ch03.html
#usr/share/gtk-doc/html/libmbim-glib/ch04.html
#usr/share/gtk-doc/html/libmbim-glib/ch05.html
#usr/share/gtk-doc/html/libmbim-glib/ch06.html
#usr/share/gtk-doc/html/libmbim-glib/ch07.html
#usr/share/gtk-doc/html/libmbim-glib/ch08.html
#usr/share/gtk-doc/html/libmbim-glib/ch09.html
#usr/share/gtk-doc/html/libmbim-glib/home.png
#usr/share/gtk-doc/html/libmbim-glib/index.html
#usr/share/gtk-doc/html/libmbim-glib/left-insensitive.png
#usr/share/gtk-doc/html/libmbim-glib/left.png
#usr/share/gtk-doc/html/libmbim-glib/libmbim-glib-ATDS.html
#usr/share/gtk-doc/html/libmbim-glib/libmbim-glib-Auth.html
#usr/share/gtk-doc/html/libmbim-glib/libmbim-glib-Basic-Connect.html
#usr/share/gtk-doc/html/libmbim-glib/libmbim-glib-Command-IDs.html
#usr/share/gtk-doc/html/libmbim-glib/libmbim-glib-Common-utilities.html
#usr/share/gtk-doc/html/libmbim-glib/libmbim-glib-Deprecated-API.html
#usr/share/gtk-doc/html/libmbim-glib/libmbim-glib.devhelp2
#usr/share/gtk-doc/html/libmbim-glib/libmbim-glib-DSS.html
#usr/share/gtk-doc/html/libmbim-glib/libmbim-glib-Enumerations-and-Flags.html
#usr/share/gtk-doc/html/libmbim-glib/libmbim-glib-Errors.html
#usr/share/gtk-doc/html/libmbim-glib/libmbim-glib-Intel-Firmware-Update.html
#usr/share/gtk-doc/html/libmbim-glib/libmbim-glib-Ms-Basic-Connect-Extensions.html
#usr/share/gtk-doc/html/libmbim-glib/libmbim-glib-MS-Firmware-ID.html
#usr/share/gtk-doc/html/libmbim-glib/libmbim-glib-MS-Host-Shutdown.html
#usr/share/gtk-doc/html/libmbim-glib/libmbim-glib-MS-SAR.html
#usr/share/gtk-doc/html/libmbim-glib/libmbim-glib-MS-UICC-Low-Level-Access.html
#usr/share/gtk-doc/html/libmbim-glib/libmbim-glib-Phonebook.html
#usr/share/gtk-doc/html/libmbim-glib/libmbim-glib-Proxy-Control.html
#usr/share/gtk-doc/html/libmbim-glib/libmbim-glib-QDU.html
#usr/share/gtk-doc/html/libmbim-glib/libmbim-glib-QMI.html
#usr/share/gtk-doc/html/libmbim-glib/libmbim-glib-Quectel.html
#usr/share/gtk-doc/html/libmbim-glib/libmbim-glib-SMS.html
#usr/share/gtk-doc/html/libmbim-glib/libmbim-glib-STK.html
#usr/share/gtk-doc/html/libmbim-glib/libmbim-glib-USSD.html
#usr/share/gtk-doc/html/libmbim-glib/libmbim-glib-UUIDs.html
#usr/share/gtk-doc/html/libmbim-glib/libmbim-glib-Version-checks.html
#usr/share/gtk-doc/html/libmbim-glib/MbimDevice.html
#usr/share/gtk-doc/html/libmbim-glib/MbimMessage.html
#usr/share/gtk-doc/html/libmbim-glib/MbimProxy.html
#usr/share/gtk-doc/html/libmbim-glib/object-tree.html
#usr/share/gtk-doc/html/libmbim-glib/right-insensitive.png
#usr/share/gtk-doc/html/libmbim-glib/right.png
#usr/share/gtk-doc/html/libmbim-glib/style.css
#usr/share/gtk-doc/html/libmbim-glib/up-insensitive.png
#usr/share/gtk-doc/html/libmbim-glib/up.png
#usr/share/man/man1/mbimcli.1
#usr/share/man/man1/mbim-network.1
For the “template-file” of libmbim, I copied the one from libqmi and just changed “VER”, “THISAPP” and the BLAKE2-checksum.
###############################################################################
# #
# IPFire.org - A linux based firewall #
# Copyright (C) 2007-2019 IPFire Team <info@ipfire.org> #
# #
# This program is free software: you can redistribute it and/or modify #
# it under the terms of the GNU General Public License as published by #
# the Free Software Foundation, either version 3 of the License, or #
# (at your option) any later version. #
# #
# This program is distributed in the hope that it will be useful, #
# but WITHOUT ANY WARRANTY; without even the implied warranty of #
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
# GNU General Public License for more details. #
# #
# You should have received a copy of the GNU General Public License #
# along with this program. If not, see <http://www.gnu.org/licenses/>. #
# #
###############################################################################
###############################################################################
# Definitions
###############################################################################
include Config
VER = 1.26.4
THISAPP = libmbim-$(VER)
DL_FILE = $(THISAPP).tar.xz
DL_FROM = $(URL_IPFIRE)
DIR_APP = $(DIR_SRC)/$(THISAPP)
TARGET = $(DIR_INFO)/$(THISAPP)
###############################################################################
# Top-level Rules
###############################################################################
objects = $(DL_FILE)
$(DL_FILE) = $(DL_FROM)/$(DL_FILE)
$(DL_FILE)_BLAKE2 = 96fb932e89455364eec39d879256eb10efd4fafc18c0dc69619b3a73cea1e62e3ea50b828c2785082e6422c39d8775c9bc1c084db3aaafdf054b1e7aa7d6929f
install : $(TARGET)
check : $(patsubst %,$(DIR_CHK)/%,$(objects))
download :$(patsubst %,$(DIR_DL)/%,$(objects))
b2 : $(subst %,%_BLAKE2,$(objects))
dist:
@$(PAK)
###############################################################################
# Downloading, checking, b2sum
###############################################################################
$(patsubst %,$(DIR_CHK)/%,$(objects)) :
@$(CHECK)
$(patsubst %,$(DIR_DL)/%,$(objects)) :
@$(LOAD)
$(subst %,%_BLAKE2,$(objects)) :
@$(B2SUM)
###############################################################################
# Installation Details
###############################################################################
$(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects))
@$(PREBUILD)
@rm -rf $(DIR_APP) && cd $(DIR_SRC) && tar axf $(DIR_DL)/$(DL_FILE)
cd $(DIR_APP) && ./configure --prefix=/usr --disable-static
cd $(DIR_APP) && make $(MAKETUNING)
cd $(DIR_APP) && make install
@rm -rf $(DIR_APP)
@$(POSTBUILD)
I then put the “config-file” in the “config\rootfiles\common”-subfolder of the IPFire-source-code and renamed it to “libmbim”. I chose this folder over the one suggested in the wiki, because libqmi is also located there.
Then I put the “template-file” in the “lfs”-subfolder and renamed it to “libmbim” as well.
Then I made sure that the files have the same “rights” and same owner as the other ones in the folders.
I finally edited the “make.sh”-file and added the line “lfsmake2 libmbim” as the last entry under the “buildipfire()”-part.
(right before the “buildinstaller()”-part, obviously before the last “}” of the “buildipfire()”-part. For details, please see the IPFire-wiki.)
Then I got to the main-folder again and started the compiling
sudo ./make.sh gettoolchain
sudo ./make.sh build
(the “gettoolchain” works with the edited “make.sh” because libmbim is already correctly implemented into the folder-structure and configuration.)
After almost exactly 4 hours I got my ready-to-install iso-file in the main folder of the source-code.
B.3 The implementation of “libmbim” - some explanations
On the IPFire-wiki-page, there is suggested another way of building addons, which includes at least 2, based on the way you follow it even 3 compilation-runs. In my humble opinion, this is not necessary (at least not for the implementation of “libmbim”).
The “second” compilation-run seems only be needed to determine the “config-file” of the desired addon.
This can be figured out much faster, although with a bit more manual work. In the case of “libmbim” I just downloaded the sourcecode, configured the installation to a custom-folder (I chose “/Test/usr” because the “/usr”-part matches the structure in IPFire), compiled the application and installed it.
After that, I read out the folder structure and wrote it to a text-file named “config-file”. To accomplish this, I switched to the “/Test”-folder (in which the “/usr”-folder lies) and executed
find | sort > config-file
Then I commented every line with
sed -i 's/\.\//#/' config-file
and uncommented only the necessary ones (for this purpose I compared my “config-file” to the libqmi-config-file, which again, already is part of the IPFire-source-code).
This is way faster (takes a couple of seconds) than compiling the whole IPFire for a second time only to get the “config-file”. Of course you need to exactly know what you are doing and what files / dependencies are needed. With “libmbim” it’s really easy because everything you need already is part of IPFire and even the configuration parameters (“./configure --prefix=/usr --disable-static”) are the same as in “libqmi”.
The “third” compilation run seems to be only for the cleaning process. Again, I am no software developer but because of the few changes I made within the process for “libmbim”, I figured I would not need this step. To be sure, I did a comparison and the size of the iso files (one as a result of the first compiling, another one after cleaning and another round of compiling) is identical.
Of course, it may be different with more complex addons!
Anyway, now I have my customized ISO, which is a perfect original IPFire-image, with just one additional module implemented.
C. The script
Because “libmbim” does not have a DHCP-function, I needed to assign the addresses to the interface and create new routes kind of manually. Therefor I wrote a little script, to get some kind of “automization”.
Ideally there would be a button on the WUI of IPFire, where you can bind a script or a command to, so that there would be no need to login to the console every time you need to run the script. But this is dreams of the future.
(Depending on your configuration, you obviously need to customize the script. My “standard”-config is, that I have a static IP-address on the eth0-interface (my RED0), which is connected to a FritzBox.
My mobile-provider is vodafone; depending on the provider, the needed credentials obviously differ. Please check MBIMCLI man page and MBIM-NETWORK man page (which are the binaries to “libmbim”) for details)
The following script now switches from my standard “eth0-as-red0”-config to the “wwan0-as-red0”-config.
# shutdown & rename interfaces, then bring them up again
ifconfig red0 down
ifconfig wwan0 down
ifconfig red0 name eth0
ifconfig wwan0 name red0
ifconfig eth0 up
ifconfig red0 up
# activate the wwan-module (software-based) and connect to provider. "sleep" is necessary to give some time to establish the connection, otherwise no IP will be acquired and the rest of the script will fail
mbimcli -d /dev/cdc-wdm0 -p --set-radio-state on
sleep 1
mbimcli -d /dev/cdc-wdm0 -p --connect apn=web.vodafone.de
sleep 3
# get the new parameters for red0
RED_DRIVER=cdc_mbim
RED_MACADDR=$(ifconfig red0 | grep -o -P "(?<=ether )[^ ]*")
RED_ADDRESS=$(mbimcli -d /dev/cdc-wdm0 -p --query-ip-configuration | grep -m 1 -o -P "(?<=').*(?=/)")
SUFFIX=$(mbimcli -d /dev/cdc-wdm0 -p --query-ip-configuration | grep -m 2 -o -P "(?<=/).*(?=')" | tail -n 1)
if [ $SUFFIX = 0 ]; then RED_NETMASK="0.0.0.0";
elif [ $SUFFIX = 1 ]; then RED_NETMASK="128.0.0.0";
elif [ $SUFFIX = 2 ]; then RED_NETMASK="192.0.0.0";
elif [ $SUFFIX = 3 ]; then RED_NETMASK="224.0.0.0";
elif [ $SUFFIX = 4 ]; then RED_NETMASK="240.0.0.0";
elif [ $SUFFIX = 5 ]; then RED_NETMASK="248.0.0.0";
elif [ $SUFFIX = 6 ]; then RED_NETMASK="252.0.0.0";
elif [ $SUFFIX = 7 ]; then RED_NETMASK="254.0.0.0";
elif [ $SUFFIX = 8 ]; then RED_NETMASK="255.0.0.0";
elif [ $SUFFIX = 9 ]; then RED_NETMASK="255.128.0.0";
elif [ $SUFFIX = 10 ]; then RED_NETMASK="255.192.0.0";
elif [ $SUFFIX = 11 ]; then RED_NETMASK="255.224.0.0";
elif [ $SUFFIX = 12 ]; then RED_NETMASK="255.240.0.0";
elif [ $SUFFIX = 13 ]; then RED_NETMASK="255.248.0.0";
elif [ $SUFFIX = 14 ]; then RED_NETMASK="255.252.0.0";
elif [ $SUFFIX = 15 ]; then RED_NETMASK="255.254.0.0";
elif [ $SUFFIX = 16 ]; then RED_NETMASK="255.255.0.0";
elif [ $SUFFIX = 17 ]; then RED_NETMASK="255.255.128.0";
elif [ $SUFFIX = 18 ]; then RED_NETMASK="255.255.192.0";
elif [ $SUFFIX = 19 ]; then RED_NETMASK="255.255.224.0";
elif [ $SUFFIX = 20 ]; then RED_NETMASK="255.255.240.0";
elif [ $SUFFIX = 21 ]; then RED_NETMASK="255.255.248.0";
elif [ $SUFFIX = 22 ]; then RED_NETMASK="255.255.252.0";
elif [ $SUFFIX = 23 ]; then RED_NETMASK="255.255.254.0";
elif [ $SUFFIX = 24 ]; then RED_NETMASK="255.255.255.0";
elif [ $SUFFIX = 25 ]; then RED_NETMASK="255.255.255.128";
elif [ $SUFFIX = 26 ]; then RED_NETMASK="255.255.255.192";
elif [ $SUFFIX = 27 ]; then RED_NETMASK="255.255.255.224";
elif [ $SUFFIX = 28 ]; then RED_NETMASK="255.255.255.240";
elif [ $SUFFIX = 29 ]; then RED_NETMASK="255.255.255.248";
elif [ $SUFFIX = 30 ]; then RED_NETMASK="255.255.255.252";
elif [ $SUFFIX = 31 ]; then RED_NETMASK="255.255.255.254";
elif [ $SUFFIX = 32 ]; then RED_NETMASK="255.255.255.255";
fi
RED_NETADDRESS=$(echo $RED_ADDRESS | sed 's/[^.]*/0/3g')
RED_DESCRIPTION="'\"usb: Fibocom L830-EB-00 LTE WWAN Modem\"'"
DEFAULT_GATEWAY=$(mbimcli -d /dev/cdc-wdm0 -p --query-ip-configuration | grep -m 3 -o -P "(?<=').*(?=')" | tail -n 1)
# write new red0-paramaters to settings-file
sed -i "/^RED_DRIVER=/ s/=.*/=$RED_DRIVER/" /var/ipfire/ethernet/settings
sed -i "/^RED_MACADDR=/ s/=.*/=$RED_MACADDR/" /var/ipfire/ethernet/settings
sed -i "/^RED_ADDRESS=/ s/=.*/=$RED_ADDRESS/" /var/ipfire/ethernet/settings
sed -i "/^RED_NETMASK=/ s/=.*/=$RED_NETMASK/" /var/ipfire/ethernet/settings
sed -i "/^RED_NETADDRESS=/ s/=.*/=$RED_NETADDRESS/" /var/ipfire/ethernet/settings
sed -i "/^RED_DESCRIPTION=/ s/=.*/=$RED_DESCRIPTION/" /var/ipfire/ethernet/settings
sed -i "/^DEFAULT_GATEWAY=/ s/=.*/=$DEFAULT_GATEWAY/" /var/ipfire/ethernet/settings
# delete old routes
ip addr flush red0
# restart network, whereby new routes will be created automatically
/etc/init.d/network restart
That’s it! After about 10 to 20 seconds, every interface is up and running again. The whole IPFire-configuration is exactly the same with all firewall-rules still activated, just red0 is now not assigned to eth0 but to wwan0 and therefor using mobile connection.
I bought the 6-antenna-housing from nrg-systems to make it look nice (LTE-connectors are now at the back and WiFi on the side) and I bought an LTE-antenna and did some days of testing. As download-speed I always got the bandwith that is listed on the vodafone page, sometimes even 40% more, the upload-speed and latency was even better than with my cable-connection.
To change back to “eth0-configuration with static IP-address”, I wrote another script
# disconnect from provider and disable the wwan-module (software-based)
mbimcli -d /dev/cdc-wdm0 -p --disconnect
sleep 3
mbimcli -d /dev/cdc-wdm0 -p --set-radio-state off
sleep 1
# shutdown & rename interfaces, then bring them up again
ifconfig red0 down
ifconfig eth0 down
ifconfig red0 name wwan0
ifconfig eth0 name red0
ifconfig wwan0 up
ifconfig red0 up
# set the new parameters for red0
RED_DRIVER=igb
RED_MACADDR= MAC ADDRESS OF YOUR eth0
RED_ADDRESS= DESIRED IP ADDRESS OF YOUR eth0
RED_NETMASK= DESIRED NETMASK OF YOUR eth0
RED_NETADDRESS= DESIRED NETADDRESS OF YOUR eth0
RED_DESCRIPTION="'\"pci: Intel Corporation I211 Gigabit Network Connection (rev 03)\"'"
DEFAULT_GATEWAY= DESIRED GATEWAY FOR YOUR eth0
# write new red0-parameters to settings-file
sed -i "/^RED_DRIVER=/ s/=.*/=$RED_DRIVER/" /var/ipfire/ethernet/settings
sed -i "/^RED_MACADDR=/ s/=.*/=$RED_MACADDR/" /var/ipfire/ethernet/settings
sed -i "/^RED_ADDRESS=/ s/=.*/=$RED_ADDRESS/" /var/ipfire/ethernet/settings
sed -i "/^RED_NETMASK=/ s/=.*/=$RED_NETMASK/" /var/ipfire/ethernet/settings
sed -i "/^RED_NETADDRESS=/ s/=.*/=$RED_NETADDRESS/" /var/ipfire/ethernet/settings
sed -i "/^RED_DESCRIPTION=/ s/=.*/=$RED_DESCRIPTION/" /var/ipfire/ethernet/settings
sed -i "/^DEFAULT_GATEWAY=/ s/=.*/=$DEFAULT_GATEWAY/" /var/ipfire/ethernet/settings
# delete old routes
ip addr flush red0
# restart network, whereby new routes will be created automatically
/etc/init.d/network restart
And again, that’s it!
Please keep in mind: WWAN-modules get a new MAC-Address every time you restart a device (at least, that’s what I read). So if you restart your IPFire while you use “LTE-mode”, red0 will then be bound to a interface that does not exist anymore (because of the obsolete mac-address). You will then have a new “wwan0” with a different mac-adress.
In this case, you need to either preserve the MAC-address of your WWAN-module, so that it survives a restart (write the MAC to a file before reboot and write it back after reboot) or you need to copy and modify the first script and use it again after the reboot. if so, you need to change the names of the interfaces (either use “ifconfig red0 name dummy” instead of “ifconfig red0 name eth0” because eth0 would already be there or red0 is not there at all and then just skip this line).
Anyway, that’s all from me! Hope it will help some people, if not, I don’t care, the effort was fun enough.
Have a nice weekend you guys!
Greetings
Alex