I’ve recently changed my network segment from 192.168.1.x to 192.168.2.x (since this is the Telekom’s default), and so I had to change the NAS network configuration as well (I could have kept it, but dealing with the problems on the router – no way). It quickly showed up that the secondary interface LAN2 hat already set “192.168.2.x” as ip address, which made the web configuration moan about any possible change here. The small LED interface on the box does not care about that, and had let me change that.
Though, I’ve been using the NAS without internet access a long time now, but right on, I wanted to transfer some data within a screen session. And then – oh well, web configuration does not allow you to change the gateway and dns settings (which are still 192.168.1.1) erroring out that there would be “other network device on the same segment”.
Hmmm, strange, eth1 isn’t active. But it wouldn’t be me, if I wouldn’t look for a shell solution anyways. A quick google led me to this thread where others had those problems too.
And voilĂ , some THECUS internals unveiled as well – configuration data is stored in /app/cfg/conf.db as sqlite db with a simple key value schema.
So, let’s see what we’ve got now (make sure that you have ssh and a system user configured). k is the key, v the value, but I’d like to see * anyways sorted by matches on nic1 and nic2.
mirage ~ # sqlite /app/cfg/conf.db "select * from conf where k like 'nic2%'" nic2_enable|1 nic2_ip|192.168.2.254 nic2_netmask|255.255.255.0 nic2_lang|en nic2_jumbo|1500 nic2_dhcp|0 nic2_startip|192.168.2.1 nic2_endip|192.168.2.100 nic2_chip|1 nic2_gateway| mirage ~ # sqlite /app/cfg/conf.db "select * from conf where k like 'nic1%'" nic1_enable|1 nic1_ip|192.168.2.200 nic1_netmask|255.255.255.0 nic1_dhcp|0 nic1_lang_|en nic1_gateway|192.168.1.1 nic1_dns|192.168.1.1 nic1_hostname|mirage nic1_domainname|thecus.com nic1_jumbo|1500 nic1_mode_8023ad|8023ad nic1_ip_sharing|0 nic1_pppoe_usr| nic1_pppoe_pwd|
As you can see, nic1 is statically configured, but still got the wrong dns and gateway set. In order to fix this, and also set nic2 to a different network segment (so that the gui is satisfied as well the next time), I’ll run some update queries directly on the config database.
Basically, all values are manipulated at their demanded key. First the faulty nic2 entries, and then the dns and gateway settings of nic1 (the one used for the primary route).
mirage ~ # sqlite /app/cfg/conf.db "update conf set v='192.168.1.200' where k = 'nic2_ip'" mirage ~ # sqlite /app/cfg/conf.db "update conf set v='192.168.1.10' where k = 'nic2_startip'" mirage ~ # sqlite /app/cfg/conf.db "update conf set v='192.168.1.100' where k = 'nic2_endip'" mirage ~ # sqlite /app/cfg/conf.db "update conf set v='192.168.2.1' where k = 'nic1_gateway'" mirage ~ # sqlite /app/cfg/conf.db "update conf set v='192.168.2.1' where k = 'nic1_dns'"
After changing that, re-run a select and check everything has changed for good.
mirage ~ # sqlite /app/cfg/conf.db "select * from conf where k like 'nic2%'" nic2_enable|1 nic2_ip|192.168.1.200 nic2_netmask|255.255.255.0 nic2_lang|en nic2_jumbo|1500 nic2_dhcp|0 nic2_startip|192.168.1.10 nic2_endip|192.168.1.100 nic2_chip|1 nic2_gateway| mirage ~ # sqlite /app/cfg/conf.db "select * from conf where k like 'nic1%'" nic1_enable|1 nic1_ip|192.168.2.200 nic1_netmask|255.255.255.0 nic1_dhcp|0 nic1_lang_|en nic1_gateway|192.168.2.1 nic1_dns|192.168.2.1 nic1_hostname|mirage nic1_domainname|thecus.com nic1_jumbo|1500 nic1_mode_8023ad|8023ad nic1_ip_sharing|0 nic1_pppoe_usr| nic1_pppoe_pwd|
Then reboot the NAS (I was too lazy to look which command may restart network only).
mirage ~ # reboot
Re-login into the NAS and check internet working.
mirage ~ # ping google.de PING google.de (173.194.35.151): 56 data bytes 84 bytes from 173.194.35.151: icmp_seq=0 ttl=57 time=53.1 ms 84 bytes from 173.194.35.151: icmp_seq=1 ttl=57 time=49.9 ms 84 bytes from 173.194.35.151: icmp_seq=2 ttl=57 time=54.0 ms 84 bytes from 173.194.35.151: icmp_seq=3 ttl=57 time=53.6 ms ^C --- google.de ping statistics --- 4 packets transmitted, 4 packets received, 0% packet loss round-trip min/avg/max = 49.9/52.6/54.0 ms