« WSL - Workaround pour l'accès réseau WSL via un VPN » et « SNMP - Configure SNMP service for Linux » : différence entre les pages

De PedroWiki
(Différence entre les pages)
Aller à la navigationAller à la recherche
imported>Jules
Page créée avec « = Introduction = WSL2, successeur de WSL1, permet de bénéficier de fonctionnalités avancées, notamment l'utilisation de Docker. Vous pouvez donc être amené à passe... »
 
imported>Jules
 
Ligne 1 : Ligne 1 :
= Introduction =
= Introduction =


WSL2, successeur de WSL1, permet de bénéficier de fonctionnalités avancées, notamment l'utilisation de Docker. Vous pouvez donc être amené à passer de WSL1 à WSL2 pour des besoins spécifiques.
SNMP configuration on Linux may be complex.


WSL2 présente un souci lors de l'établissement d'un tunnel VPN: une fois le tunnel établit, on perd l'accès réseau dans sa distribution WSL.
Many documentation exist on Internet but they describe so many different methods it makes it difficult to identify THE best way to do it.


Quelques références à ce bug:
This article will try to identify a kind of procedure to install and configure the service.


* [https://github.com/microsoft/WSL/issues/5068 WSL2 , problem with network connection when VPN used (PulseSecure)].
= Useful links =
* [https://github.com/microsoft/WSL/issues/1350 DNS server coming from vpn network is not reflected in WSL].
* [https://github.com/microsoft/WSL/issues/4277 wsl 2 ubuntu 18.04 unable to connect to IP resources with Cisco Annyconnect active].


Un workaround efficace est décrit dans [https://www.youtube.com/watch?v=yR2NsssY7z8 la vidéo suivante].
* [https://www.sugarbug.fr/atelier/techniques/monitoring_lan/snmp/ SNMP et la supervision].
* [https://manpages.ubuntu.com/manpages/xenial/man1/snmpusm.1.html snmpusm man page].
* [https://www.digitalocean.com/community/tutorials/how-to-install-and-configure-an-snmp-daemon-and-client-on-ubuntu-18-04 Configure an SNMP daemon and client on Ubuntu 18.04].
* [https://net-snmp.sourceforge.io/docs/README.snmpv3.html net-snmp documentation on SourceForge].
* ...


= Workaround =
= Install and configure the service =


== Déconnecter le VPN ==
== Ubuntu / Debian ==


* Dans votre client VPN (Cisco AnyConnect, FortiClient, client PulseSecure, profil VPN Windows...), déconnectez vous.
Useful packages:
* Fermez le client VPN.
* snmp
* snmpd
* libsnmp-dev


== Désactiver l'interface réseau WSL ==
Dependencies:
* libsnmp-base
* libsnmp35:amd64


Dans une fenêtre PowerShell en administrateur:
Packages installation:


<pre>
apt-get install snmp
netsh interface set interface "vEthernet (WSL)" disable
apt-get install snmpd
</pre>
apt-get install libsnmp-dev


== Connecter le VPN ==
Service stop:


* Lancer votre client VPN (Cisco AnyConnect, FortiClient, client PulseSecure, profil VPN Windows...).
systemctl stop snmpd.service
* Vérifier que vous contactez bien les ressources accessibles uniquement via le VPN.


== Réactiver l'interface réseau WSL ==
Service configuration:


Dans une fenêtre PowerShell en administrateur:
vi /etc/snmp/snmpd.conf
...
sysLocation    <location description>
sysContact    <your sysops contact>
...
agentaddress  127.0.0.1,[::1],<IP of your server>
...
net-snmp-config --create-snmpv3-user


<pre>
netsh interface set interface "vEthernet (WSL)" enable
</pre>


== Tester ==
'''Note regarding the user creation''': not sure this behavior is systematic but you may have to add such a line to ''/etc/snmp/snmpd.conf'' for your user to be properly created at service restart. This line may be deleted from ''/etc/snmp/snmpd.conf'' after service restart.


Depuis votre distribution WSL favorite:
  createUser username (MD5|SHA|SHA-512|SHA-384|SHA-256|SHA-224) authpassphrase [DES|AES] [privpassphrase]


<pre>
Service start:
ping 8.8.8.8
ping www.google.fr
</pre>


Les 2 commandes doivent fonctionner:
systemctl start snmpd.service
* accès réseau.
* résolution DNS.


[[Category:WSL]]
'''Note''': think about allowing flows on the firewall you use on or around the system.
[[Category:Windows]]
 
[[Category:Workaround]]
[[Category:Howto]]
[[Category:SNMP]]
[[Category:Monitoring]]
[[Category:Linux]]
[[Category:A MODIFIER]]

Version du 7 mars 2023 à 15:20

Introduction

SNMP configuration on Linux may be complex.

Many documentation exist on Internet but they describe so many different methods it makes it difficult to identify THE best way to do it.

This article will try to identify a kind of procedure to install and configure the service.

Useful links

Install and configure the service

Ubuntu / Debian

Useful packages:

  • snmp
  • snmpd
  • libsnmp-dev

Dependencies:

  • libsnmp-base
  • libsnmp35:amd64

Packages installation:

apt-get install snmp
apt-get install snmpd
apt-get install libsnmp-dev

Service stop:

systemctl stop snmpd.service

Service configuration:

vi /etc/snmp/snmpd.conf
...
sysLocation    <location description>
sysContact     <your sysops contact>
...
agentaddress  127.0.0.1,[::1],<IP of your server>
...
net-snmp-config --create-snmpv3-user


Note regarding the user creation: not sure this behavior is systematic but you may have to add such a line to /etc/snmp/snmpd.conf for your user to be properly created at service restart. This line may be deleted from /etc/snmp/snmpd.conf after service restart.

 createUser username (MD5|SHA|SHA-512|SHA-384|SHA-256|SHA-224) authpassphrase [DES|AES] [privpassphrase]

Service start:

systemctl start snmpd.service

Note: think about allowing flows on the firewall you use on or around the system.