- Fri 4th Feb 2022, 14:28
#6450
I'm using my Huawei B628-245 on the Three network. My MTU needs to be set at 1440 but there is no option to change the Mobile Internet Connection MTU on my router? *Bleep*!!!
(To find out your ideal MTU setting, refer to this this post.)
After some searching on the internet I discovered that there is a way to find out the current MTU Setting the modem is using. Just copy and paste the following code into our web browsers developer console (Refer to step 3 of this post) while logged in to the device:
Unfortunately there is no way of changing the modems MTU setting through the routers GUI or your web browsers developer console. However, we can change the routers default MTU using node.js and Huawei Router API. Just follow the steps below:
Note 1: Dropping my MTU down to 1440 has solved the occasional page loading problems I have been experiencing while testing out my installation.
NOTE 2: The MTU setting was added to the Three UK software version, I wonder whether this is something that they were expecting to cause problems?
(To find out your ideal MTU setting, refer to this this post.)
After some searching on the internet I discovered that there is a way to find out the current MTU Setting the modem is using. Just copy and paste the following code into our web browsers developer console (Refer to step 3 of this post) while logged in to the device:
Code: Select all
This will return a JSON object which has various parameters for the modem including the MTU as shown below:getAjaxData('api/dialup/connection',
function ( ret ) {
console.log(JSON.stringify(ret))
})
Code: Select all
As you can see from my result above, the default MTU value is set at 1500 on my device. {"type":"response",
"response":{
"RoamAutoConnectEnable":"0",
"MaxIdelTime":"0",
"ConnectMode":"0",
"MTU":"1500",
"auto_dial_switch":"1",
"pdp_always_on":"0"
}
}
Unfortunately there is no way of changing the modems MTU setting through the routers GUI or your web browsers developer console. However, we can change the routers default MTU using node.js and Huawei Router API. Just follow the steps below:
- Install node.js from here.
- Go to this page and click on the green "Code" button and click on "Download Zip".
- Locate the ZIP file and Unzip the file.
- Using terminal/command line, navigate to the Huawei_router_api_master folder that you just unzipped.
- Run this command:
Code: Select all
npm install
- Now run the following command:
Code: Select all
npm run build:node
- Using a text editor such as Notepad++, create a file in the Huawei_router_api_master folde called index.js and paste the following code inside it:
Code: Select all(Replace
const router = require('./dist/index.cjs.js') router.config.setUrl('http://YOUR ROUTER IP'); // replace with your IP router.config.setUsername('admin'); router.config.setPassword('YOUR WEB PASSWORD'); // replace with your web password var mtu = process.argv.slice(2)[0] console.log(mtu) if (!mtu) mtu = 1500 async function checkConnection() { // Check if we are logged into the router already const loggedIn = await router.admin.isLoggedIn(); if (!loggedIn) { // If we aren't, login await router.admin.login(); } const stats = await router.dialup.getConnection(); console.log('Current settings') console.log(stats); return stats } async function setOptions(options) { // Check if we are logged into the router already const loggedIn = await router.admin.isLoggedIn(); if (!loggedIn) { // If we aren't, login await router.admin.login(); } var APIoptions = { roamAutoConnectEnable: Number(options.RoamAutoConnectEnable), maxIdleTime: Number(options.MaxIdelTime), connectMode: Number(options.ConnectMode), mtu: Number(options.MTU), autoDialSwitch: Number(options.auto_dial_switch), pdpAlwaysOn: Number(options.pdp_always_on) } //console.log(APIoptions) const stats = await router.dialup.setConnection(APIoptions); console.log(stats); } main() async function main() { var config = await checkConnection(); config.MTU = mtu await setOptions(config) await checkConnection(); }
YOUR ROUTER IP
with the IP address of your router andYOUR WEB PASSWORD
with your web GUI password.) - Finally run the script you created in step 7 to set the MTU with the following terminal command:
Code: Select all(Replace 1500 with whatever MTU setting you want - Values below 1400 and above 1500 will throw an error.)
node index.js 1500
The script will report the settings twice, once before setting the value and again once the MTU setting has been set so that you confirm it has worked. - Restart the router for the setting to take effect.
Note 1: Dropping my MTU down to 1440 has solved the occasional page loading problems I have been experiencing while testing out my installation.
NOTE 2: The MTU setting was added to the Three UK software version, I wonder whether this is something that they were expecting to cause problems?
WelshPaul, @UKVoIPForums liked this
How did this post make you feel?