I have an MT300N-V2 FW 2.261 and when enabling bridge mode via the switch the DHCPv6 remains active and the GLI continues to advertise itself as an IPv6 DNS server and an IPv6 router.
Because in bridge mode the WAN port is bridged to the LAN port, these advertisements leak back out of the WAN port and cause huge problems if the device is connected to an Active Directory network because these advertisements cause any Windows DHCP servers to shut down because the GLI is detected as a ‘Rogue DHCP server’. This causes all the clients on the network to be unable to renew their IP leases and they all slowly lose their internet connections. This is very bad!
I modified the script /usr/bin/switch_mode and inserted the lines:
In router mode:
uci set dhcp.lan.ra=‘server’
uci set dhcp.lan.dhcpv6=‘server’
In bridge mode:
uci set dhcp.lan.ra=
uci set dhcp.lan.dhcpv6=
This causes the correct disable/enable of DHCPv6 mode when changing from router to bridge mode and back. Given more time, I would work out how to save the original state of these options in router mode and set them back to the original values when moving back from bridge to router mode but I haven’t had time to do this yet.
I have also seen on reboot that the DHCP on the GLI comes back up again. I think that this is because on boot, the GLI runs the switch_mode script before the IP is assigned to the WAN and causes the following test to be false: #check if we can get IP from WAN port
if udhcpc -i $eth_wan -T5 -t3 -n -q -f; then
This causes DHCP to be re-enabled on the interface and causes the same problems described above.
Please can you look in to see if you can recreate this problem?
I have made a modified switch_mode script attached to this post which fixes several unwanted behaviours in the old script. I have only tested this with the Mango MT300N-V2, although it should work with other routers running 2.261
Old script used to enable DHCPv6 and IPV6 routing in bridge more, New script correctly disables/enables DHCPv6 and IPv6 routing when moving between bridge/router mode
Old script tried to get a DHCP lease in bridge mode from the WAN port eth0.2 which succeeded on first switch to bridge mode but failed on reboot because after reboot the port is now bridged on br-lan. New script checks eth0.2 on first switch and then br-lan on reboots.
When old script failed to obtain a DHCP lease as above, it would set a static IP and also switch back on the DHCP server. New script does not turn on DHCP on failure to obtain a lease and remains disabled.
On a cold power-on, the old script used to run about 15 seconds before the lan ports were up, this resulted in the DHCP lease-test always failing and the unit always setting a static IP. New script tests to see if the ports are up before doing the DHCP test.
New script also posts messages to syslog under SWITCH_MODE: to inform about mode changes / DHCP leases etc.
Upload this to /usr/bin/switch_mode
install an SSH client if you don’t already have one
put the GL in router mode and connect to the GL’s Wi-Fi (so that your computer gets a 192.168.8.x ip address)
open an ssh connection to 192.168.8.1 and log in with the username root and your GL password
type the commands in the quotes, don’t type the quotes:
‘mv /usr/bin/switch_mode /usr/bin/switch_mode.orig’ Enter
‘vi /usr/bin/switch_mode’ Enter
Shift-i to put vi in insert mode
Paste the contents of the new switch_mode file into vi
ESC to exit insert mode
‘:wq’ and press Enter
‘chmod 775 /usr/bin/switch_mode’ Enter
‘exit’ Enter
You should have uploaded the new file and your router and bridge mode should now work ok.
Looks like the link has been removed from this post so I am re-attaching the updated script.
I had to upload it as a zip as the forum won’t allow .txt uploads
Oli. switch_mode.zip (1.3 KB)