seud0nym / tch-gui-unhide

Modify Telstra-branded Technicolor devices to access hidden features
GNU General Public License v3.0
127 stars 15 forks source link

Changes in lan settings overwrites vlan configuration #160

Closed Krazy998 closed 1 year ago

Krazy998 commented 1 year ago

Hello!

Firstly thank you for all the efforts in making this possible. One issue I have found is that when I make a change to the Guest lan in the GUI (Local Network card) (such as change the primary DNS server) this will overwrite the ifname which i use to set the tagged vlan.

Is it possible to stop it overwriting custom configuration?

config interface 'Guest' option proto 'static' option ifname 'eth0.200' option ip6assign '64' option ip6hint '1' option netmask '255.255.255.0' option macaddr 'A0:B5:3C:35:C0:7B' option force_link '1' option rpfilter '1' option ipv6 '1' option ipaddr '192.168.200.1' option auto '1'

Product Name: Technicolor CobraXh Firmware: 20.4.0319-MR0-RA

seud0nym commented 1 year ago

Congratulations for getting VLANs working on the Gen 3! I couldn't work out how to do it, because the config for the Gen 2 and earlier didn't work for me.

The problem is that the GUI processing for VLANs on the Gen 2 and earlier is quite complicated, and the code is shared by all generations.

Can you attach your entire /etc/config/network, please? Make sure you remove any passwords or other personal/identifying info. That way I can make the GUI work for your specific configuration, and hopefully extend the full GUI VLAN capability to the Gen 3 as well.

Krazy998 commented 1 year ago

Firstly thank you for the quick response! I used this on the Gen2 to make it work as well. Maybe there is opportunity to simplify?

Here you go!

config interface 'loopback' option ifname 'lo' option proto 'static' option ipaddr '127.0.0.1' option netmask '255.0.0.0'

config globals 'globals' option default_ps '0'

config interface 'lan' option type 'bridge' option ifname 'eth0 eth1 eth2 eth3' option proto 'static' option netmask '255.255.255.0' option ip6hint '0' option force_link '1' option rpfilter '1' option tch_ip6assign '64' option ipv6 '0' option ipaddr '172.18.100.1'

config interface 'wan6' option proto 'dhcpv6' option ifname '@wan' option defaultreqopts '0' option reqopts '23 17' option reqaddress 'try' option noslaaconly '1' option iface_464xlat '0' option forceprefix '1' option soltimeout '240' list dns '2606:4700:4700::1111' list dns '2606:4700:4700::1001' option peerdns '0'

config switch option name 'switch0' option reset '1' option enable_vlan '1'

config switch_vlan option device 'switch0' option vlan '1' option ports '0 1 2 3 5t'

config switch_vlan option device 'switch0' option vlan '2' option ports '4 5t'

config interface 'Guest' option proto 'static' option ifname 'eth0.200' option ip6assign '64' option ip6hint '1' option netmask '255.255.255.0' option macaddr 'A0:B5:3C:35:C0:7B' option force_link '1' option rpfilter '1' option ipv6 '1' option ipaddr '192.168.200.1' option auto '1'

config interface 'ppp' option proto 'pppoe' option metric '10' option username '' option password '' option keepalive '4,20' option iface6rd '0' option graceful_restart '1' option auto '0' option ifname 'atm_8_35'

config interface 'ipoe' option proto 'dhcp' option metric '1' option reqopts '1 3 6 43 51 58 59' option release '1' option iface6rd '0' option vendorid 'technicolor' option auto '0'

config interface 'wwan' option proto 'mobiled' option session_id '0' option profile '1' option iface_464xlat '1' option enabled '0' option peerdns '1'

config device 'eth4' option name 'eth4' option mtu '1500' option mtu6 '1500' option neighreachabletime '1200000' option neighgcstaletime '2400'

config device 'atm_8_35' option name 'atm_8_35' option neighreachabletime '1200000' option neighgcstaletime '2400'

config device 'ptm0' option name 'ptm0' option neighreachabletime '1200000' option neighgcstaletime '2400'

config ppp_placeholder option uciname 'pppoe-wan'

config config 'config'

config interface 'wan' option reqopts '1 3 6 43 51 58 59' option iface6rd '0' option vendorid 'technicolor' option metric '1' option release '1' option proto 'dhcp' option ifname 'eth4' option peerdns '0'

seud0nym commented 1 year ago

Hmm. Are you sure that works? There is no switch_vlan config for VLAN ID 200, which is what is used (AFAIK) to tell the switch whether the port is tagged or untagged.

Krazy998 commented 1 year ago

Yes it works. Devices (I have ubiquiti access points). I have vlan 200 tagged in the switch and access points for guest. They get guest ip range and other devices on other lan SSID get an ip in 172.18.100.x

Krazy998 commented 1 year ago

This is poorly documented here. But basically as I understand it. If you create a interface name with eth0.200 it wil create a vlan 200 on the fly.

https://oldwiki.archive.openwrt.org/doc/uci/network

VLAN Interfaces

VLAN Interfaces may be configured also. If not, they are created on the fly by netifd. Defining VLANs gives more options. The following options are supported:

seud0nym commented 1 year ago

That is the way that tch-gui-unhide creates the VLANs in Gen 2 and earlier (i.e. by using the device config), but I couldn't get it to work on the Gen 3. I was testing with getting a device to connect on the VLAN assigned port and get a DHCP address (I don't have another VLAN configuration) and I couldn't get it to work. The Gen 3 is also missing the mdkshell command that you can use on earlier generations to confirm the VLAN configuration, so it was difficult for me to work out what was happening.

If I give you some configuration to test in your environment, would you be willing to do that? It would mean keeping a copy of your current /etc/config/network to fall back to, and adding/changing some stuff to see if it works. If we can get it to work, I can just re-enable the GUI VLAN configuration in the Gen 3 release, which would be better for everyone. Completely understand if you don't want to risk breaking your environment, though.

Krazy998 commented 1 year ago

yep sure!

seud0nym commented 1 year ago

Thanks. I am trying to get it working as best I can on my test Gen 3, and then I will get you to test it in your environment.

seud0nym commented 1 year ago

Can you please add the following lines to your /etc/config/network:

config switch_vlan
        option device 'switch0'
        option vlan '200'
        option ports '0t 5t'

config device 'vlan_eth0_200'
        option ifname 'eth0'
        option name 'vlan_eth0_200'
        option type '8021q'
        option vid '200'

config device 'vlan_eth1_200'
        option ifname 'eth1'
        option name 'vlan_eth1_200'
        option type '8021q'
        option vid '200'

config device 'vlan_eth2_200'
        option ifname 'eth2'
        option name 'vlan_eth2_200'
        option type '8021q'
        option vid '200'

config device 'vlan_eth3_200'
        option ifname 'eth3'
        option name 'vlan_eth3_200'
        option type '8021q'
        option vid '200'

and change the Guest ifname option from eth0.200 to vlan_eth0_200. e.g.

config interface 'Guest'
        option proto 'static'
        option ifname 'vlan_eth0_200'
        option ip6assign '64'
        option ip6hint '1'
        option netmask '255.255.255.0'
        option macaddr 'A0:B5:3C:35:C0:7B'
        option force_link '1'
        option rpfilter '1'
        option ipv6 '1'
        option ipaddr '192.168.200.1'
        option auto '1'

Restart the network with:

/etc/init.d/network restart

Let me know if your VLAN settings still work as they do now.

Thanks.

Krazy998 commented 1 year ago

No unfortunately it doesnt work (devices on guest wifi - which is on vlan 200 in my case cant get an IP from DHCP from the gen3 router). I cannot see the eth0.200 or a vlan interface being created when shown in ifconfig. If I go back to my config I get a sub-interface being created.

eth0 Link encap:Ethernet HWaddr A0:B5:3C:35:C0:7B
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:95897220 errors:0 dropped:31444 overruns:0 frame:0 TX packets:144137722 errors:0 dropped:34 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:47829582138 (44.5 GiB) TX bytes:149743153634 (139.4 GiB)

eth0.200 Link encap:Ethernet HWaddr A0:B5:3C:35:C0:7B
inet addr:192.168.200.1 Bcast:192.168.200.255 Mask:255.255.255.0

seud0nym commented 1 year ago

I cannot see the eth0.200 or a vlan interface being created when shown in ifconfig.

It should have created an interface called vlan_eth0_200, but it doesn't matter if it didn't work.

I have been working on converting from the device notation to the dotted notation that is working for you. I think I have it all working, except I am having real problems when the device is in bridged mode.

I hope to have a working version of tch-gui-unhide for you to test soon.

Krazy998 commented 1 year ago

No Problem! thank you for putting the time and effort to making this a better product!

If there is anything you need me to test - please let me know. More than happy to

seud0nym commented 1 year ago

I have just committed an experimental version of tch-gui-unhide that should resolve your issue.

You can apply the new version with the following command:

./tch-gui-unhide -u && ./tch-gui-unhide -y

After you have applied the change, you will need to go into the new VLAN Filtering tab in Local Network and add a new VLAN. The VLAN ID must be 200 and set port 1 to Tagged and all others to disabled. (This will add a switch_vlan configuration to your /etc/config/network so that tch-gui-unhide can manage the VLANs through the GUI. It should not change how your VLANs work, because I now have this configuration running on my 2 Gen 3s.) Then go back to the Interfaces tab and select the Guest interface to check that port 1 has VLAN ID 200 ticked. You should now be able to change the DNS servers (as an example) without breaking the configuration.

Krazy998 commented 1 year ago

Works perfectly - actually its amazing!! So easy to define vlans via the GUI!

Also - I tested both ways. Cleared my config and then created new and also left my config and it picked it up as well so its managable from the GUI. Very nice

eth0.300 Link encap:Ethernet