Add Ip Adress automaticly

TUN_SD

Cadet
Joined
Jan 26, 2022
Messages
4
Hello,

I made myself a small server that has 2 network cards. The extra card is mounted at boot time with a PostInit kldload/mnt/NAS/Documents/Documents/if_re.ko.

The problem is that no IP address is assigned. I have to enter this manually so far.
Is there a way to enter the IP also with a script? Or another option?

Thanks for your tips
 

jgreco

Resident Grinch
Joined
May 29, 2011
Messages
18,680
Because you're forcing the NAS to do something it wouldn't normally do, you're probably best off scripting it. Just change the call to kldload to a call to a script, put the kld command and whatever IP configuration you need in there, and be done with it.
 

TUN_SD

Cadet
Joined
Jan 26, 2022
Messages
4
Because you're forcing the NAS to do something it wouldn't normally do, you're probably best off scripting it. Just change the call to kldload to a call to a script, put the kld command and whatever IP configuration you need in there, and be done with it.
Ok, thanks for the tip.
Is there a tutorial for this somewhere? Scripts are not really my thing.

Many Thanks in advance
 

jgreco

Resident Grinch
Joined
May 29, 2011
Messages
18,680
Scripts are just the things you could type at the CLI to accomplish a sequence of steps.

So if you can accomplish your task by typing "acommand", "morefoo", and "blahlast", like

freenas# acommand
freenas# morefoo
freenas# blahlast

Then your script just needs to look like

#! /bin/sh -

acommand
morefoo
blahlast

And you need to "chmod 755 yourscript" to make it executable. This is not in any way specific to FreeNAS/TrueNAS; it is generic UNIX scripting. The script then works similarly to a binary executable would. Hundreds (probably thousands) of resources are available on the 'net, I eyeballed a bit and found this one here


which is not an endorsement, just a "that looks promising" from someone with decades of scripting experience.
 

TUN_SD

Cadet
Joined
Jan 26, 2022
Messages
4
Thanks for the info.
I am unfortunately not so knowledgeable in scripting or programming.
Would be great if someone could give me a basic module that I can adapt to my needs. (IP address, NIC card)

thanks in advance
 

TUN_SD

Cadet
Joined
Jan 26, 2022
Messages
4
Unfortunately, I'm not getting anywhere here. I have zero experience with scripts and would be really happy if someone could help me with the above topic.
 
Top