PDA

View Full Version : Command Line Network Configuration 11SP3`



StevenR77
25-Mar-2015, 21:17
I need to script the network configuration for an SLES11 SP3 VM build.

The only issue I am having is I am able to edit the /etc/resolv.conf and have the proper search Domain parameters added but in Yast I know they are not reflected. I found the yast edit dns nameserver options for the command line but I have not been able to discover something that would work for adding or updating the domain search option(s).

Thank you for your assistance in this matter and make it a great day.

Steven A. Robertson

ab
25-Mar-2015, 22:24
How about setting the NETCONFIG_DNS_STATIC_SERVERS value in the
/etc/sysconfig/network/config file as a space-delimited list of values.


--
Good luck.

If you find this post helpful and are logged into the web interface,
show your appreciation and click on the star below...

StevenR77
25-Mar-2015, 22:38
How about setting the NETCONFIG_DNS_STATIC_SERVERS value in the
/etc/sysconfig/network/config file as a space-delimited list of values.


--
Good luck.

If you find this post helpful and are logged into the web interface,
show your appreciation and click on the star below...


That works perfectly! Thank you. I can use grep to get the line number for the edit in the file and then update it accordingly.

Thank you once again.

mikewillis
25-Mar-2015, 22:57
That works perfectly! Thank you. I can use grep to get the line number for the edit in the file and then update it accordingly.


Why use grep to get the line number before editing the file?



mike@minimac:/tmp> cp /etc/sysconfig/network/config .
mike@minimac:/tmp> grep ^NETCONFIG_DNS_STATIC_SERVERS config
NETCONFIG_DNS_STATIC_SERVERS=""
mike@minimac:/tmp> sed -i 's/^\(NETCONFIG_DNS_STATIC_SERVERS="\).*/\1123.123.123.123 456.456.456.456"/' config
mike@minimac:/tmp> grep ^NETCONFIG_DNS_STATIC_SERVERS config
NETCONFIG_DNS_STATIC_SERVERS="123.123.123.123 456.456.456.456"
mike@minimac:/tmp>

MoserHans
02-Apr-2015, 11:05
That works perfectly! Thank you. I can use grep to get the line number for the edit in the file and then update it accordingly.

I recommend to have a look at ansible (http://docs.ansible.com/).