Setup hostname so it appears in the router

Re: Setup hostname so it appears in the router

Postby Jocko » Thu Dec 10, 2020 1:24 pm

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
Jocko
Site Admin - expert
 
Posts: 11367
Joined: Tue Apr 12, 2011 4:48 pm
Location: Orleans, France

Re: Setup hostname so it appears in the router

Postby mpparsley123 » Thu Dec 10, 2020 1:31 pm

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?
mpparsley123
Donator VIP
Donator VIP
 
Posts: 15
Joined: Sat Nov 28, 2020 11:32 am

Re: Setup hostname so it appears in the router

Postby Jocko » Thu Dec 10, 2020 1:39 pm

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
You do not have the required permissions to view the files attached to this post.
Jocko
Site Admin - expert
 
Posts: 11367
Joined: Tue Apr 12, 2011 4:48 pm
Location: Orleans, France

Re: Setup hostname so it appears in the router

Postby Jocko » Thu Dec 10, 2020 1:44 pm

I attached now the zip file...
Jocko
Site Admin - expert
 
Posts: 11367
Joined: Tue Apr 12, 2011 4:48 pm
Location: Orleans, France

Re: Setup hostname so it appears in the router

Postby mpparsley123 » Thu Dec 10, 2020 1:46 pm

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
mpparsley123
Donator VIP
Donator VIP
 
Posts: 15
Joined: Sat Nov 28, 2020 11:32 am

Re: Setup hostname so it appears in the router

Postby Jocko » Thu Dec 10, 2020 1:50 pm

mpparsley123 wrote:do I still need to do the cp -S .org commands?
did you use my command line on udhcpc?
Jocko
Site Admin - expert
 
Posts: 11367
Joined: Tue Apr 12, 2011 4:48 pm
Location: Orleans, France

Re: Setup hostname so it appears in the router

Postby mpparsley123 » Thu Dec 10, 2020 1:53 pm

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){
mpparsley123
Donator VIP
Donator VIP
 
Posts: 15
Joined: Sat Nov 28, 2020 11:32 am

Re: Setup hostname so it appears in the router

Postby Jocko » Thu Dec 10, 2020 1:55 pm

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)
Jocko
Site Admin - expert
 
Posts: 11367
Joined: Tue Apr 12, 2011 4:48 pm
Location: Orleans, France

Re: Setup hostname so it appears in the router

Postby mpparsley123 » Thu Dec 10, 2020 2:04 pm

# 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?
mpparsley123
Donator VIP
Donator VIP
 
Posts: 15
Joined: Sat Nov 28, 2020 11:32 am

Re: Setup hostname so it appears in the router

Postby Jocko » Thu Dec 10, 2020 2:15 pm

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
Jocko
Site Admin - expert
 
Posts: 11367
Joined: Tue Apr 12, 2011 4:48 pm
Location: Orleans, France

PreviousNext

Return to Development

Who is online

Users browsing this forum: No registered users and 1 guest

cron