Koozali.org: home of the SME Server

Obsolete Releases => SME Server 9.x => Topic started by: tomi on October 08, 2016, 04:27:48 PM

Title: (solved) Dummy NIC - permanent activation/deactivation on SME v9.1
Post by: tomi on October 08, 2016, 04:27:48 PM
Motto:                                                     

      "Each expert has a horizon of knowledge:
       when it narrows enough, he will proclaim 
      'this is my point of view!'"               

Hello everybody,


I have a remote (vps) server that has 3 NICs but can only use one of them.
I am not able to remove or disable any of these boards before installing the operating system's.

I installed SME9.1 and everything works perfectly. SME automatically detects all 3 NICs (obviously, 2nd and 3rd lack of connectivity).

I need to 'hide' from SME the NICs without connectivity in order to be able to use a a Dummy NIC for the internal interface.

I tried removing them within Centos but after reconfiguration SME  automatically reactivates them. 


Eternal gratitude for help!    :)


the solution:

Here is an approach that might be worth a NFR for it touches 1 line in e-smith-base...

Use at your own risk!

edit /usr/share/perl5/vendor_perl/esmith/console/configure.pm

find the line: if (scalar @adapters == 1)

and change it to:

if (scalar @adapters == 1 || $db->get_value('ForceDummyNic') eq 'enabled')

Now you can toggle the yes/no listing of the Dummy NIC by setting the db key:

config set ForceDummyNic enabled and config delete ForceDummyNic

After setting the db key, you can run console and the dummy NIC will be listed and available to pick as the internal (LAN) adapter only.

HTH
Title: Re: help, urgent, how to 'hide' the 2-th network card on SME Server 9.1 installation
Post by: Stefano on October 08, 2016, 05:35:08 PM
did you try to setup SME using the working NIC as WAN one and one of the other for LAN side?
Title: Re: help, urgent, how to 'hide' the 2-th network card on SME Server 9.1 installation
Post by: tomi on October 08, 2016, 05:42:14 PM
ciao!

yes, I have done so. I want to use dummy interface for LAN side.
Title: Re: help, urgent, how to 'hide' the 2-th network card on SME Server 9.1 installation
Post by: Stefano on October 08, 2016, 06:03:29 PM
I guess it didn't work :-)

what did you try to disable onboard NICs and what kind of tool do you have to interact with your VPS?

Title: Re: help, urgent, how to 'hide' the 2-th network card on SME Server 9.1 installation
Post by: Stefano on October 08, 2016, 06:08:34 PM
just make this test..

at the end of setup, before rebooting, use Alt+F2 (IIRC..) to get a shell
take a look into /etc/udev/rules.d/ (into your virtual hd) if is there a 70-persistent-net.rules file

if so, try to edit it commenting out the rules that are related to the 2 inactive NICs

NOTE: not tested..
Title: Re: help, urgent, how to 'hide' the 2-th network card on SME Server 9.1 installation
Post by: tomi on October 08, 2016, 06:18:46 PM
grazie! provo stasera... ti tengo aggiornato.

Title: Re: help, urgent, how to 'hide' the 2-th network card on SME Server 9.1 installation
Post by: Stefano on October 08, 2016, 06:18:58 PM
tested right now in a VM here.. during setup you can switch to a shell with ALT+F2, cd to /mnt/sysimage/etc/udev/rules.d and edit the file..
unfortunately it doesn't work, meaning that during first setup you still see the real NICs..

you'd try to setup a VM with a single NIC, setup as you prefer (using the same parameters you'd use on the real VPS), then create a backup via the console and finally import that backup during first setup..

just an idea
Title: Re: help, urgent, how to 'hide' the 2-th network card on SME Server 9.1 installation
Post by: Stefano on October 08, 2016, 06:20:04 PM
grazie! provo stasera... ti tengo aggiornato.



ciao, sorry but english only here.. if you prefer italian language, come to the right forum, thank you
Title: Re: help, urgent, how to 'hide' the 2-th network card on SME Server 9.1 installation
Post by: tomi on October 08, 2016, 06:31:24 PM
Sorry! use my interlocutor's native language was a form of courtesy
Title: Re: help, urgent, how to 'hide' the 2-th network card on SME Server 9.1 installation
Post by: guest22 on October 10, 2016, 07:49:10 AM
Here is an approach that might be worth a NFR for it touches 1 line in e-smith-base...

Use at your own risk!

edit /usr/share/perl5/vendor_perl/esmith/console/configure.pm

find the line: if (scalar @adapters == 1)

and change it to:

if (scalar @adapters == 1 || $db->get_value('ForceDummyNic') eq 'enabled')

Now you can toggle the yes/no listing of the Dummy NIC by setting the db key:

config set ForceDummyNic enabled and config delete ForceDummyNic

After setting the db key, you can run console and the dummy NIC will be listed and available to pick as the internal (LAN) adapter only.

HTH
Title: Re: help, urgent, how to 'hide' the 2-th network card on SME Server 9.1 installation
Post by: Daniel B. on October 10, 2016, 08:39:30 AM
I don't understand. Why would you want to use a dummy NIC if you have a real one ? Just choose one of the unused NIC, without pluging anything on it, and you'll have the same effect
Title: Re: help, urgent, how to 'hide' the 2-th network card on SME Server 9.1 installation
Post by: tomi on October 10, 2016, 11:50:44 AM
I don't understand. Why would you want to use a dummy NIC if you have a real one ? Just choose one of the unused NIC, without pluging anything on it, and you'll have the same effect

one reason, and not the last, is that I like to know how I can combine various procedures in a more complex algorithm, even if the purpose of that algorithm may seem stupid or useless. Maybe in another situation, skills thus acquired may be used in a less stupid way.

However, in this case do not claim that this is the primary reason.
Title: Re: how to 'hide' the 2th network card on SME v9.1 installation
Post by: Daniel B. on October 10, 2016, 11:53:06 AM
Sorry, but I couldn't understand what you mean here. Can you detail the reason not to use one of the real NIC, even if unplugged, as this would have the same effect than using the dummy NIC (support for the dummy NIC was added only for those case where you have a single NIC, and you can't run in server only mode because this single NIC is the public one)
Title: Re: how to 'hide' the 2th network card on SME v9.1 installation
Post by: Stefano on October 10, 2016, 12:15:12 PM
I agree with Dani
IOW, explain your problemi/aim, not your solution, thank you
Title: Re: help, urgent, how to 'hide' the 2-th network card on SME Server 9.1 installation
Post by: tomi on October 10, 2016, 12:37:15 PM
@RequestedDeletion

...
Use at your own risk!

edit /usr/share/perl5/vendor_perl/esmith/console/configure.pm
...

already tried modifying (and)this script (in another way), so far without the desired result.

Now I will follow your instructions ...

Thank you very much for your help and willingness.

Title: Re: how to 'hide' the 2th network card on SME v9.1 installation
Post by: tomi on October 10, 2016, 02:49:23 PM
@Daniel B.

... Can you detail the reason not to use one of the real NIC, even if unplugged, as this would have the same effect than using the dummy NIC ...

the reason is the free will  :-|

... (support for the dummy NIC was added only for those case where you have a single NIC, and you can't run in server only mode because this single NIC is the public one)

 :-? 

* from https://bugs.contribs.org/show_bug.cgi?id=7200
Quote
RequestedDeletion 2013-01-07 06:07:01 CET

These patches will add the ability to run SME Server in servergateway mode with only 1 hardware ethernet adapter. It is based on RH/Centos dummy adapter.

(... Of course, I saw your patch also  :-) )

N.B.   I use SME in server&gateway mode
Title: Re: how to 'hide' the 2th network card on SME v9.1 installation
Post by: Stefano on October 10, 2016, 03:06:42 PM
well.. what about explaining us all the plot? it seems you're telling us only a part of the picture ;-)

if you feel more confortable in italian (even if your english is fine), you can find me on the other forum or "offline" (see below my "avatar")

thank you
Title: Re: how to 'hide' the 2th network card on SME v9.1 installation
Post by: Daniel B. on October 10, 2016, 04:12:39 PM
the reason is the free will  :-|

I'm just trying to understand the use case (maybe it's something useful enough to be added to the base). And as you consider this as urgent, I don't think it's just the free will. Anyway. If the 2 NIC you don't want to use are using a different driver than the one you want to use (you should be able to identify this in the NIC selection screen of the console, or using lscpi -vv), then you should be able to blacklist this single module (in /etc/modprobe.d/), and on next boot your system will see a single NIC, so will present the dummy NIC option
Title: Re: how to 'hide' the 2th network card on SME v9.1 installation
Post by: guest22 on October 10, 2016, 04:17:40 PM
Here's an example for a use case:


Server (server & gateway) has 2 NIC's. 1 NIC is going to be used as WAN adapter and the other NIC for other purposes such as extra connection to the server (Rsync, monitoring, backup etc etc). The dummy should be used as the LAN adapter.
Title: Re: how to 'hide' the 2th network card on SME v9.1 installation
Post by: Daniel B. on October 10, 2016, 04:19:37 PM
Server (server & gateway) has 2 NIC's. 1 NIC is going to be used as WAN adapter and the other NIC for other purposes such as extra connection to the server (Rsync, monitoring, backup etc etc). The dummy should be used as the LAN adapter.
I don't see this as a valid use case. Why wouldn't the "other purpose" (backup, monitoring etc...) wouldn't use the LAN NIC, as in such a situations, obviously, nothing else would be using this link.
Title: Re: how to 'hide' the 2th network card on SME v9.1 installation
Post by: guest22 on October 10, 2016, 04:22:14 PM
I don't see this as a valid use case. Why wouldn't the "other purpose" (backup, monitoring etc...) wouldn't use the LAN NIC, as in such a situations, obviously, nothing else would be using this link.


Different network...
Title: Re: how to 'hide' the 2th network card on SME v9.1 installation
Post by: tomi on October 11, 2016, 08:13:15 AM
... If the 2 NIC you don't want to use are using a different driver than the one you want to use (you should be able to identify this in the NIC selection screen of the console, or using lscpi -vv), then you should be able to blacklist this single module (in /etc/modprobe.d/) ...

Thanks, unfortunately, not the case.
However, I imagine that any had ever installed nvidia graphics driver on a CentOS system has learned the trick
Title: Re: how to 'hide' the 2th network card on SME v9.1 installation
Post by: Daniel B. on October 11, 2016, 08:53:04 AM
Or maybe adding something like

Code: [Select]
alias eth1 off
alias eth2 off

In /etc/modprobe.d/disable_nic.conf. To be tested
Title: Re: how to 'hide' the 2th network card on SME v9.1 installation
Post by: Stefano on October 11, 2016, 10:25:35 AM
Thanks, unfortunately, not the case.
However, I imagine that any had ever installed nvidia graphics driver on a CentOS system has learned the trick

nope, no Centos desktop here (I use/install other linux flavour..)
and no need for nvidia and/or graphics stuff on any server ;-)
Title: Re: how to 'hide' the 2th network card on SME v9.1 installation
Post by: tomi on October 11, 2016, 10:07:55 PM
@ Stefano

caro Stefano, you missed a good time to be silent ...  :-(

I suggest you ask here on the forum if there is any connection between SME and RHEL/CentOS!
You might be surprised at the response you'll get.


Title: Re: how to 'hide' the 2th network card on SME v9.1 installation
Post by: Daniel B. on October 11, 2016, 10:14:29 PM
caro Stefano, you missed a good time to be silent ...  :-(

I suggest you ask here on the forum if there is any connection between SME and RHEL/CentOS!
You might be surprised at the response you'll get.

Please stay polite. Stefano knows probably better than you that SME is based on CentOS
Title: Re: how to 'hide' the 2th network card on SME v9.1 installation
Post by: Stefano on October 11, 2016, 10:21:47 PM
@ Stefano

caro Stefano, you missed a good time to be silent ...  :-(

I suggest you ask here on the forum if there is any connection between SME and RHEL/CentOS!
You might be surprised at the response you'll get.

Title: Re: how to 'hide' the 2th network card on SME v9.1 installation
Post by: tomi on October 12, 2016, 04:56:53 PM
only polite:

I must first apologize because I could not respond immediately to some posts; unlike others, I do not have time to stay hooked on forums trying to hunt uninformed potential customers; my new clients come exclusively from recommendations of current or former clients.

Personally, I value and respect the generous effort of SME server project developers.
I understand very well the nature of work in the development of sotware package by a team that is based on volunteering; some come with competence in programming, others with willingness to related services such as accounting, cleaning, forums, translations etc ...

As a rule, I am rely on software documentation, when it exists.

About forums, I think (stress, personal opinion) that contain relatively little information directly usable and relatively much noise from dilettantes who have too much free time.

This discussion thread (with one notable exception) reconfirms my opinion.

The exception is the intervention of RequestedDeletion (who authored the Dummy NIC in SME server) with an
extremely elegant solution as update to another solution which he indicated to me via email after my help request by email too.



@Daniel B.

polite in the highest degree:

your statement ...

... Stefano knows probably better than you that SME is based on CentOS

... was made being as well informed as when you said ...

... (support for the dummy NIC was added only for those case where you have a single NIC, and you can't run in server only mode because this single NIC is the public one)

... or maybe  ...

I don't see this as a valid use case. Why wouldn't the "other purpose" (backup, monitoring etc...) wouldn't use the LAN NIC, as in such a situations, obviously, nothing else would be using this link.

... ?

Title: Re: how to 'hide' the 2th network card on SME v9.1 installation
Post by: Daniel B. on October 12, 2016, 05:06:17 PM
... was made being as well informed

Indeed, I'm well informed. Thanks for noticing
Title: Re: how to 'hide' the 2th network card on SME v9.1 installation
Post by: tomi on October 12, 2016, 06:27:10 PM
Indeed, I'm well informed. Thanks for noticing

type "def:irony" on Google for help
tapez "def:irony" sur Google pour l'aide
Title: Re: (solved) Dummy NIC - permanent activation/deactivation on SME v9.1
Post by: guest22 on October 12, 2016, 07:15:22 PM
Xavier, it is time for you to leave. As you are well aware off, your attitude is not appreciated here.