Page 2 of 3

Re: Setup hostname so it appears in the router

PostPosted: Thu Dec 10, 2020 1:24 pm
by Jocko
Ok both must to be restored.

The right line is
Code: Select all
         if (mwexec("/sbin/udhcpc -b -i " . escapeshellarg($lanif) . " -s {$g['etc_path']}/api/api_dhcpc.php dhcpdCbScript -x hostname='{$config['system']['hostname']}'") != 0){
I used -x because it claims the option -h is deprecated
Code: Select all
udhcpc: option -h NAME is deprecated, use -x hostname:NAME
and laniffunc_configure_NIC is used only with usb iface

Re: Setup hostname so it appears in the router

PostPosted: Thu Dec 10, 2020 1:31 pm
by mpparsley123
I fixed it (I think):
- connected with a network cable to the same lan
- ssh root@MYNAS.local

I can't ping MYNAS.local
PING MYNAS.local (169.254.30.200): 56 data bytes
Request timeout for icmp_seq 0
Request timeout for icmp_seq 1

But somehow I can ssh into MYNAS.local eventhough it didn't get an IP from the router:
# ifconfig
eth0 Link encap:Ethernet HWaddr *****
inet addr:169.254.30.200 Bcast:169.254.255.255 Mask:255.255.0.0

lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0

How does that work?

Re: Setup hostname so it appears in the router

PostPosted: Thu Dec 10, 2020 1:39 pm
by Jocko
But somehow I can ssh into MYNAS.local eventhough it didn't get an IP from the router:
# ifconfig
eth0 Link encap:Ethernet HWaddr *****
inet addr:169.254.30.200 Bcast:169.254.255.255 Mask:255.255.0.0
So nice ! and because you have a zeroconf process running so your mac discovers it

You should have a samba share fvdw on this address
Code: Select all
\\169.254.30.200\fvdw

then unzip my attached archive here and do these command lines:
Code: Select all
cp -S .org /direct-usb/fvdw/laniffunc_configure_NIC.finc /etc/finc/laniffunc_configure_NIC.finc
cp -S .org /direct-usb/fvdw/laniffunc_configure.finc /etc/finc/laniffunc_configure.finc


Then reboot the nas and all should be restored

Re: Setup hostname so it appears in the router

PostPosted: Thu Dec 10, 2020 1:44 pm
by Jocko
I attached now the zip file...

Re: Setup hostname so it appears in the router

PostPosted: Thu Dec 10, 2020 1:46 pm
by mpparsley123
It's back and the hostname is in my router, awesome - thanks!

I restored the files manually, do I still need to do the cp -S .org commands?

SO glad I samba (4) was setup :D

Close call :p

Re: Setup hostname so it appears in the router

PostPosted: Thu Dec 10, 2020 1:50 pm
by Jocko
mpparsley123 wrote:do I still need to do the cp -S .org commands?
did you use my command line on udhcpc?

Re: Setup hostname so it appears in the router

PostPosted: Thu Dec 10, 2020 1:53 pm
by mpparsley123
I set this line manually in laniffunc_configure.finc

if (mwexec("/sbin/udhcpc -b -i " . escapeshellarg($lanif) . " -s {$g['etc_path']}/api/api_dhcpc.php dhcpdCbScript -x hostname='{$config['system']['hostname']}'") != 0){

Re: Setup hostname so it appears in the router

PostPosted: Thu Dec 10, 2020 1:55 pm
by Jocko
so you should run the cp commandline only for laniffunc_configure_NIC.finc because there is an additionnal line which must be updated (declare $config in global command)

Re: Setup hostname so it appears in the router

PostPosted: Thu Dec 10, 2020 2:04 pm
by mpparsley123
# diff /tmp/laniffunc_configure_NIC.finc /etc/finc/laniffunc_configure_NIC.finc
14,15c14
< global $g,$config;
<
---
> global $g;
20c19
< return OK_E;
---
> return 0;
44c43
< if (mwexec("/sbin/udhcpc -b -i '$lanif' -s {$g['etc_path']}/api/api_dhcpc.php dhcpdCbScript -x hostname='{$config['system']['hostname']}'") != 0){
---
> if (mwexec("/sbin/udhcpc -b -i '$lanif' -s {$g['etc_path']}/api/api_dhcpc.php dhcpdCbScript") != 0){
49c48
< return OK_E;
---
> return 0;
root@MYNAS:/ # cp /tmp/laniffunc_configure_NIC.finc /etc/finc/laniffunc_configure_NIC.finc

root@MYNAS:/ # diff /tmp/laniffunc_configure.finc /etc/finc/laniffunc_configure.finc
no changes here

done, reboot => all ok. Thanks again!

So if I understand correctly, I'm saved because I installed the Avahi daemon, or is there another way to connect to the disk if it doesn't have an ip?

Re: Setup hostname so it appears in the router

PostPosted: Thu Dec 10, 2020 2:15 pm
by Jocko
So all is ok now

We go to keep this change on next version. I just need to check if there is no fatal error with this additional option on router which does not implement this feature