Re: Re: Re: snmptrap v3 how to specify source IP

Anders Wallin <[email protected]>
Newsgroups gmane.network.net-snmp.user
Message-ID <CAF2baFevpx2_=RCN2iwLCPuK9HATm5rJR4jMnSC1DUhwen9FMA@mail.gmail.com>
Hi,

that was one of the cases that failed for me.
You can try to have  'clientaddr 10.2.24.121" $HOME/.snmp/snmp.conf
and run
"snmptrap -v3 -u usertest -l authPriv -a SHA -A usertest  -x AES -X
usertest  10.2.24.18 84100 …… "
(w/o -s 10.2.24.121)

I hope to get some time to dig into the issue later this week....

Regards
Anders Wallin


On Sat, May 25, 2019 at 5:13 AM ww <[email protected]> wrote:

> Hi,Anders
>
> I am Chinese,and the website was blocked by the government.
> You know the "996.icu"......
> When I login the website,it will prompt that:
> The sourceforge.net website is temporarily in static offline mode.
>
> Only a very limited set of project pages are available until the main
> website returns to service.
> May I ask a question?
> My eth0 ip 10.2.24.81, eth1 ip 10.2.24.121 .
> My commond is "snmptrap -v3 -u usertest -l authPriv -a SHA -A usertest  -x
> AES -X usertest  -s 10.2.24.121  10.2.24.18 84100 …… ".
> Why is  the IP received by the client is 10.2.24.81?
>
>
> At 2019-05-24 19:44:52, "Anders Wallin" <[email protected]> wrote:
>
> Hi,
>
> I found two issues using latest git repo master branch;
> IPv4, using "clientaddr srcip" in snmp.conf and "snmptrap" to a local ip -
> OK
> IPv4, using "clientaddr srcip" in snmp.conf and "snmptrap" to a remote ip
> - OK
> IPv4, using "snmptrap -s srcip" to a local ip - OK
> IPv4, using "snmptrap -s srcip" to a remote ip - FAILS
>
> IPv6, using "clientaddr srcip" in snmp.conf and "snmptrap" to a local ip -
> OK
> IPv6, using "clientaddr srcip" in snmp.conf and "snmptrap" to a remote ip
> - OK
> IPv6, using "snmptrap -s srcip" to a local ip - OK
> IPv6, using "snmptrap -s srcip" to a remote ip - FAILS
>
> IPv4, using "clientaddr srcip" and "trapsess ..." in snmpd.conf to a local
> ip - OK
> IPv4, using "clientaddr srcip" and "trapsess ..." in snmpd.conf to a
> remote ip - OK
> IPv4, using "trapsess -s srcip ..." to a local ip - OK
> IPv4, using "trapsess -s srcip" to a remote ip - OK
>
> IPv6, using "clientaddr srcip" and "trapsess ..." in snmpd.conf to a local
> ip - OK
> IPv6, using "clientaddr srcip" and "trapsess ..." in snmpd.conf to a
> remote ip - OK
> IPv6, using "trapsess -s srcip ..." to a local ip - OK
> IPv6, using "trapsess -s srcip" to a remote ip - OK
>
> NOTE: clientaddrs sucks if you want to use IPv4 AND IPv6 since it can only
> have one value, either an IPv4 or an IPv6 value
>
> "ww"; can you file a bug on this problem?
> https://sourceforge.net/p/net-snmp/bugs/
>
> I will try to fix it, but it will be next week.
>
> Regards
> Anders
>
> On Fri, May 24, 2019 at 5:23 AM ww <[email protected]> wrote:
>
>> Hi.
>> Thanks for your reply. I try to use "-s" and "--clientaddr" but it dose
>> not work.
>> My version is net-snmp-5.8.
>> My commond is "snmptrap -v3 -u usertest -l authPriv -a SHA -A usertest
>> -x AES -X usertest  -s 10.2.24.121  10.2.24.18 84100 …… ".
>> May I ask you how the snmptrap chooses the network interface by it self?
>> Is it polling all the enable ports?
>>
>> Regards
>>
>> At 2019-05-23 15:54:28, "Klemen Sladic" <[email protected]> wrote:
>>
>> Hi.
>>
>> Any traffic originating from snmpd will have src IP of outgoing network
>> interface.
>> From my experience "clientaddr" helps for replies generated by snmpd. For
>> example,
>> if you have multiple interfaces and "clientaddr" is set, any snmpd
>> response, like response to
>> snmpget, snmpwalk etc. will have desired src IP.
>>
>> But this won't work for packets initiated by snmpd, like traps.
>> What I did, was changing the route src settings.
>> For example, if you have eth0 in 192.168.0.0/24 and eth1 in
>> 192.168.1.0/24 and you want any traffic to
>> have source of 192.168.0.0/24, then change eth1 subnet route like:
>>
>> ip route change 192.168.1.0/24 dev eth1 src 192.168.0.1
>>
>> if 192.168.0.1 is eth0 IP.
>>
>> Of course this may have other side effects on routing in your system.
>>
>> RegK
>>
>> On Thu, May 23, 2019 at 6:30 PM Anders Wallin <[email protected]> wrote:
>>
>>> You can use "clientaddr" in snmp.conf or snmpd.conf,
>>> https://linux.die.net/man/5/snmp.conf
>>>
>>> In 5.8 you also have the possibility to use "-s" with trapsess, but I
>>> did not found any documentation on it.
>>> but check the test
>>> code, testing/fulltests/default/T184trapsesssource_simple
>>>
>>> Regards
>>> Anders Wallin
>>>
>>>
>>> On Wed, May 22, 2019 at 5:21 PM ww <[email protected]> wrote:
>>>
>>>> Hello, Thank you for reading my email. Can I specify the source IP
>>>> when send a V2/V3 trap like V1?
>>>>
>>>>
>>>>
>>>>
>>>> _______________________________________________
>>>> Net-snmp-users mailing list
>>>> [email protected]
>>>> Please see the following page to unsubscribe or change other options:
>>>> https://lists.sourceforge.net/lists/listinfo/net-snmp-users
>>>>
>>> _______________________________________________
>>> Net-snmp-users mailing list
>>> [email protected]
>>> Please see the following page to unsubscribe or change other options:
>>> https://lists.sourceforge.net/lists/listinfo/net-snmp-users
>>>
>>
>>
>>
>>
>
>
>
>

_______________________________________________
Net-snmp-users mailing list
[email protected]
Please see the following page to unsubscribe or change other options:
https://lists.sourceforge.net/lists/listinfo/net-snmp-users
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.