How monitor last octet of 255

I'm working with an ESP_8266 with an IP address like 192.168.1.235. How can I set up my program so it will also monitor the universal "all" IP address 192.168.1.255 at the same time?

.255 is NOT an universal IP address. It is a regular IP address as any other other.
And "all" sounds like "broadcast" (and .255 is not broadcast).

There is just one exemption for an IP address, which is:
"XX.YY.ZZ.1"
This is a gateway address. It forwards the traffic from network XX.YY.ZZ.aa - from any IP address .aa via a gateway to another network.
A gateway address is always ....1 - and it means: if NOT in the same network - send all traffic to this one, so that the gateway can forward to other networks. But it will just happen if IP stack figures out that IP address is not in the same network.

Other than this - there is not an "universal" or an "all" IP address.
If you mean "all" as "broadcast", as "send to all receivers in parallel":
It is a different IP address, a "broadcast IP" address, which differs mainly how the XX value would be.

BTW: when it comes to "monitor" from any IP address as sender:
A "socket" is, for instance: IP Address + Port (e.g. for TCP or UDP traffic).
IP address can be "any" which is "0.0.0.0" (127.0.0.1 is local, a loopback, done inside the host).
So, a socket with 0.0.0.0 and an UDP port 8080 would receive ANY message sent by ANY host, never mind what the senders IP address is.
So, you can receive (monitor) any traffic for any sender (as long as you listen on the "port opened").

All other, to listen to ANY traffic on a network, is called: "promiscuous mode" : it opens the ETH interface for all traffic, not to filter based on MAC address, not based on IP addresses - just forward all what "flies by" at the ETH cable.

I'm nde at this, but I do remember broadcasting. That was helpful. Thank you.

I meant "new", not "nde". Sorry.

The little pencil in the toolbar under your posts is meant for editing such typos (saves you from doing a new post)

First time I hear this.
There is no precondition for an address a.b.c.1 to belong to gateway . Gateway can residue on any correct address.
In our network, for example, gateway has address 6
Moreover, a lot of networks has more than one gateway, how they can be work with only one predefined gateway address? :slight_smile:

Me too… that’s incorrect indeed.

More on Broadcast address - Wikipedia and Default gateway - Wikipedia

1 Like

@J-M-L thanks for the link

According to the info, suggestion below also is not quite correct:

from the Wikipedia

The address range assignable to hosts is from 192.168.4.1 to 192.168.4.254. TCP/IP defines the addresses 192.168.4.0 (network ID address) and 192.168.4.255 (broadcast IP address).

Documentation for Promiscuous Mode to receive all packets on the WiFi network:
https://espressif-docs.readthedocs-hosted.com/projects/esp8266-rtos-sdk/en/release-v3.3/api-reference/wifi/esp_wifi.html#_CPPv430esp_wifi_set_promiscuous_rx_cb21wifi_promiscuous_cb_t

Oh yes, sorry: XX.YY.ZZ.255 is broadcast address (XX.YY.ZZ.0 is network address).
IP addresses

Just to be a bit careful: the ETH HW can use MAC and IP filters. It can be that broadcast reception is not enabled. Just to make sure when nothing received - it might be due to config of the MCU IP stack (broadcast not enabled).

Oh.

Wow! The reponce has been great! Thanks folks.

TJaekel's help got me thinking. I'm going to take a look at broadcasting.

Good thoughts. I discovered broadcasting and it looks promising. I'll pursue it. Thanks.

Debug hints:
Use WireShark:
WireShark - Network Monitor
(for the host PC, Window PC, not for MCU)

Send traffic from host (PC), to address XX.YY.ZZ.255:
if you see with WireShark that those packets are on network - but MCU does not see it, does not receive it - the MCU is not open for broadcast.

Or:
Use a UNICAST address first, e.g. XX.YY.ZZ.10, whereby this XX.YY.ZZ.10 is the MCU IP address of the MCU.
Send now just to a single server (MCU): potentially, it will be received, but changing to XX.YY.ZZ.255 will not receive anything - again: MCU is not open for broadcast.

Just make sure: the host (PC) and MCU are on the "same network": so, they use XX.YY.ZZ.bla as the same network address" configure the host (PC) to send on the same network (e.g. via ETH).
Both have to use XX.YY.ZZ.?? as the same network address, here assuming a 24bit network mask, or as 0xFFFFFF00 for the network mask).

Good luck.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.