OpenWrt Forum Archive

Topic: command for (re)configuration

The content of this topic has been archived on 20 Apr 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

Hi,

my question: is there a command that enforces a reconfiguration of OpenWrt?

The reason:
to make OpenWrt work with the Huawei E3372h-stick I needed a second-LAN-card initially (I used a USB-LAN-adapter, this worked too). So on booting OpenWrt initally everything is detected and the configuration is written to the files.

Luckily I had the adapter but what can I do when I don't have this?

When I boot OpenWrt initially a CD-Rom is detected (=E3372h). After installing the package usb-modeswitch this stick is switched to modem-mode. But what about the configuration? Is there a way to enforce the process analog to the first boot-process?

Regards
AugustQ

Since you need 'usb-modeswitch' (and probably 'wwan') packages to get your stick working, then maybe you need to build a custom image using the OpenWRT Buildroot that has these packages pre-installed?

You'll still need to configure the settings using whatever LAN interface your router has in order to make the stick connect to your carrier's network, but at least you'll have the software ready, and you don't need to fetch them from the net, which is probably the reason why you needed the second USB-LAN adapter.

Hi Antek,

first of all: I've a working/functional version of OpenWrt with the Huawei-stick. And yes: I needed usb-modeswitch and wwan.

My question was: when installing everything is detected and the config-files are written, but not in the case of the Huawei-stick. So I used a trick: I I installed a second LAN-interface (a USB-LAN-adapter). So in the first boot-process the configuration is detected and all config-files are written..

So I thoug of: can I omit the step with the USB-LAN-adapter?

When I used the Huawei-stick the configuration written does not include eth1, when using the USB-LAN-adapter the configuration contains eth1. Looks like the switching of the stick to eth1 is done too late. And I'm looking for a solution which uses the stick directly and does not need the trick with the LAN-adapter.

So: is there a routine which I can call via the commandline (or a little program that calls such a routine) that checks the configuration and write the config-files accordingly.

This is done at the inital boot of OpenWrt, but I want do start this process manually because I assume that the stick is not detected properly.

You can put configuration files into your custom image.  These will be used as defaults instead of the firstboot autodetections.

AugustQ wrote:

My question was: when installing everything is detected and the config-files are written, but not in the case of the Huawei-stick. So I used a trick: I I installed a second LAN-interface (a USB-LAN-adapter). So in the first boot-process the configuration is detected and all config-files are written..

So I thoug of: can I omit the step with the USB-LAN-adapter?

Sorry. I misunderstood your question, so my answer was bit off-point. Mk24's suggestion should solve your issue.

Hi,

are configuration-files the criteria for first-boot/following boot? Which files are used? /etc/confignetwork, more ......

I looked into the img-file I used and did not find /etc/config/networki.
So with my test-machine here I will give this a try.

renaming the network-file and rebooting does not help: my notebook does not get an IP-address.

So this is not the way to enforce the first boot.

so let me describe the steps I went to make this Huawei-stick working:

first to say: my machine is a Fujitsu S700 (=Futro)

step #1: on the Futro I booted Knoppix via USB-memory-stick, copied the image of OpenWrt to the flash-memory of the Futro. power down.

step #2: removed the USB-memory-stick, added a USB-LAN-adapter

step #3: powered the Futro. it entered in config-mode. on my notebook I could start a browser and via 192.168.1.1 could look at the configuration and made some decisisons. this was written to the Futro.

step #4: powered down the Futro. removed the LAN-Adapter, replaced it by the Huawei-stick, rebooted the machine

step #5: on the Futro I edited the /etc/config/network-file: switched eth0 and eth1. power down

step #6: powedred the Futro, connected it to the internet via eth0 and loaded the packages usb-modeswitch and wwan. after this I edited /etc/config/network and switched eth0 and eth1 again (=back to the original state).

step #7: rebooted the Futro.

As you can see the USB-LAN-adapter is not needed, it's only a placeholder for an ethx-device. In case you do not have one (or any other device like a riser-card and a LAN-adapter) how can you do the configuration?

So my question is: is there a way to go back to step #3?
I would then omit the USB-LAN-adapter, get a cconfiguration only with eth0, connect the Futro to the internet, load my packages and then go back to step#3.

Do you have any idea how to do this?

is this the correct place for my question?

Or does it belong to the developers-section?

With only one Ethernet port, make the router a LAN device.
First connect only to aPC.
Change IP to one that is in your LAN
Set DNS and gateway to your main router's IP
Turn off DHCP server in /etc/config/dhcp
Now connect router and PC to your LAN and log in on new address.
You should now be able to run opkg update, etc.

Or you can install packages without connecting the router to the internet two ways:
Use image builder to make a custom image with packages you need.
Or find and download the .ipk file from the image server packages/ directory.  SCP it to the router's /tmp directory then run
opkg install /tmp/filename.ipk
You may get an error of missing dependencies.  In that case, download transfer and install those packages first.

Installing kmod-usb-hid (and it's dependencies) on a machine like the Futro should let you run a local control shell with a USB keyboard and VGA screen.

(Last edited by mk24 on 1 Aug 2017, 19:17)

Hi mk24,

I think this discussion goes in a wrong direction.

What I have: a working Futro, using the Huawei-stick to connect to the internet. Tested, works.

What I want to do: write a documentation explaining all the steps needed to come to this point.

But as I've already described in my post #8 I went through a detour using a USB-LAN-adapter which I do not need. It's only used for the trick: create eth1 (which later is done by the Huawei-stick).

So if you don't have such an adapter what do you do?

So my question is: when I install the software (eth0 is detected), configure the system, connect to the internet and load the packages needed, insert the Huawei-stick (now eth1 is created). how can I create NOW the new configuration?

Make the machine a device on an existing LAN as I described, so OpenWrt can download from the Internet.

Install drivers necessary for 4G modem.  Plug in the modem. 

Now that you have a physical wan device, go to the wan section of /etc/config/network and add a line: option device eth1.  (In some cases a USB modem will come up as usb0, use that instead) I'm pretty sure that a wan network and firewall zone will be created even on single port machines, but the single port will be connected to the lan and the wan will have no physical connection.

Also reconfigure the lan to again make it a primary router with DHCP server.  Delete the DNS and gateway settings as those will now be picked up by DHCP from the modem and the wireless carrier. Disconnect from the existing LAN you can now use it independently.

(Last edited by mk24 on 2 Aug 2017, 14:52)

I would like to describe the situation from a different angle:

after copying the image-file to the Futro I can mount /dev/sda2 (/dev/sda is the flash-memory of the Futro in Knoppix). So I can see the file /etc/config/network - initially it has a size of approx. 500 bytes.

So leaving Knoppix and booting the Futro with OpenWrt I see that the file /etc/config/network changed: it now has a current timestamp and it also has a size of approx. 2K.

How is this done? Can I start the same process manually?

The reason for this: the Huawei-stick is detected too late so the configuration written does not contain the statements for using this stick.

The discussion might have continued from here.