Comments (14)
My apologies for the liberty to tune into this discussion. We are also interested in the use case of using two network interfaces and using two independent sets of resources for WAN/LAN segregation purposes. The IP instance should be segregated as well for many reasons but one of them to prevent the 2nd interface from working if the first one runs out of net packets. So I think the use case @marianoizzi is describing is not that uncommon, many designs will now feature two segregated Ethernets serving different purposes.
from netxduo.
@marianoizzi Our NetXDuo supports using one IP and one DHCP Client on multiple interfaces, you can refer to the sample and user guide as below to support multiple interfaces in your scenario.
sample code: https://github.com/azure-rtos/netxduo/blob/master/samples/demo_netxduo_multihome_dhcp_client.c
user guide: https://docs.microsoft.com/en-us/azure/rtos/netx-duo/netx-duo-dhcp-client/chapter1#dhcp-client-multiple-interface-support
from netxduo.
Agreed @bo-ms, but in the above link example both interfaces and DHCP clients are handled by the same IP instance.
In my situation I have two IP instances (one for each interface), to keep them isolated allowing different protocols/services on each interface:
status = nx_ip_create(&ip_0,"NetX IP Instance 0",
IP_ADDRESS(0, 0, 0, 0),
IP_ADDRESS(0, 0, 0, 0),
&pool_0,
nx_stm32_eth_driver,
ip_stack_0,
IP_STACK_SIZE,
TX_PRIO_NETX);
...
status = nx_ip_create(&ip_1,"NetX IP Instance 1",
IP_ADDRESS(0, 0, 0, 0),
IP_ADDRESS(0, 0, 0, 0),
&pool_1,
nx_ksz8851_eth_driver,
ip_stack_1,
IP_STACK_SIZE,
TX_PRIO_NETX);
...
status = nx_dhcp_create(&dhcp_client_0, &ip_0, "DHCP 0");
...
status = nx_dhcp_create(&dhcp_client_1, &ip_1, "DHCP 1");
...
Any suggestion?
from netxduo.
@marianoizzi cloud you do following changes in nxd_dhcp_client.c and try again?
- Insert the code dhcp_ptr -> nx_dhcp_socket.nx_udp_socket_reserved_ptr = (VOID*)dhcp_ptr; at line381, such as:
/* Set the UDP socket receive callback function. */
status = nx_udp_socket_receive_notify(&(dhcp_ptr -> nx_dhcp_socket), _nx_dhcp_udp_receive_notify);
/* Check status. */
if (status != NX_SUCCESS)
{
#ifndef NX_DHCP_CLIENT_USER_CREATE_PACKET_POOL
/* Delete the packet pool. */
nx_packet_pool_delete(dhcp_ptr -> nx_dhcp_packet_pool_ptr);
#endif
/* Delete the UDP socket. */
nx_udp_socket_delete(&(dhcp_ptr -> nx_dhcp_socket));
}
dhcp_ptr -> nx_dhcp_socket.nx_udp_socket_reserved_ptr = (VOID*)dhcp_ptr;
- Change _nx_dhcp_udp_receive_notify() as below:
VOID _nx_dhcp_udp_receive_notify(NX_UDP_SOCKET *socket_ptr)
{
NX_DHCP *dhcp_ptr;
dhcp_ptr = (NX_DHCP *)(socket_ptr -> nx_udp_socket_reserved_ptr);
/* Set the data received event flag. */
tx_event_flags_set(&(dhcp_ptr -> nx_dhcp_events), NX_DHCP_CLIENT_RECEIVE_EVENT, TX_OR);
}
from netxduo.
Thanks @bo-ms, just tested it and works as expected.
You may close the issue.
from netxduo.
Thanks @marianoizzi, Given multiple IP instances and DHCP instances need more resources, could you provide more details about your scenario? which resource do you want to isolate? then we can check if it is necessary to have multiple instances. Thanks.
from netxduo.
Hi @bo-ms, the product is in an early development stage, the customer hasn't given much details yet; but I know in advance that one ethernet port will connect the device to their respective clients private networks and to an MQTT broker or BACnet server. The other port will be a management/service one, and will connect to my customer's cloud or head office server; reporting the system status (MQTT?), and providing an administration shell (SSH?).
Bests.
from netxduo.
@marianoizzi, thanks for sharing the information, you do need to use two ethernet interfaces in your scenario, but I am still not sure which resource must be isolated with multiple IP and DHCP instances, do you think it is ok to isolated the resource on applications layer with one IP instance? Of course, if you have to use multiple IP instances, you can do the changes I suggested above, and please share the reason to me, we would like to learn it and improve our source code. Thanks.
from netxduo.
Perhaps the words "resource" and "isolation" were not the best to describe my thoughts @bo-ms; also, I understand that the multihome API provides tools to handle many configurations with one IP instance.
The scenarios I think that can't be solved with just one instance are:
- Different networks, fixed IPs, with servers listening on the same port on both interfaces. For example two web servers listening on port 80, one on each interface.
- Different networks, with DHCP clients on both of them.
I hope this clarifies your doubts. Thanks.
from netxduo.
Perhaps the words "resource" and "isolation" were not the best to describe my thoughts @bo-ms; also, I understand that the multihome API provides tools to handle many configurations with one IP instance.
The scenarios I think that can't be solved with just one instance are:
- Different networks, fixed IPs, with servers listening on the same port on both interfaces. For example two web servers listening on port 80, one on each interface.
- Different networks, with DHCP clients on both of them.
I hope this clarifies your doubts. Thanks.
@marianoizzi Thanks for further clarification. In fact, one server is able to listen on both interfaces, and one DHCP client also supports on multiple interfaces with one IP, it is not necessary to have two web servers and dhcp clients. I do not fully understand the use case just yet.
from netxduo.
There are use cases where server A offers services which should only be reachable on IP address A via Ethernet interface A and likewise with server B. So if server B must not be accessible from Ethernet interface A it would need to be on a different IP stack or am I mistaken?
from netxduo.
My apologies for the liberty to tune into this discussion. We are also interested in the use case of using two network interfaces and using two independent sets of resources for WAN/LAN segregation purposes. The IP instance should be segregated as well for many reasons but one of them to prevent the 2nd interface from working if the first one runs out of net packets. So I think the use case @marianoizzi is describing is not that uncommon, many designs will now feature two segregated Ethernets serving different purposes.
Hi @hwmaier, thanks for sharing your scenario, I agreed with you, there are many designs that need two segregated ethernets. NetXDuo supports multi-homed operation (multiple interfaces) and it's also possible, but not as recommended to create multiple NetX Duo multiple IP instances. In addon protocols, some addon protocols are able to support multiple interfaces with one IP and one addon instance, such as: DHCP, some protocols are able to support multiple IP instances. Before improving the addons for adapting different scenarios (multiple interfaces or multiple IP instances), it would be great for us to know the REAL USE CASE for production, learn about what each interface looks like, and what addons protocols are used on Azure RTOS device, thanks.
from netxduo.
@bo-ms, I am happy to share more but not necessarily in this public forum as this involves internal product development details. Is there any other way to provide/discuss this via private messaging?
from netxduo.
Thanks @hwmaier, Azure RTOS support email address: [email protected]
from netxduo.
Related Issues (20)
- TLS crypto method "NX_CRYPTO_NONE" issue
- Tcp socket receive problem for large messages HOT 4
- DNS cleint at non-blocking mode
- Missing include guards
- Wrong type across netxduo and threadx
- crypto hardware acceleration support HOT 15
- Inconsistent types across files
- NX_BSD_TIMEOUT_PROCESS_IN_TIMER
- CoAP addon HOT 1
- ULONG64 definition failing for rx architecture
- PPP LCP Negotiation stops at state 4.
- BSD addon fails to compile HOT 3
- BSD socket create failed!
- Deployment in Device Update for IoT Hub is Failed with NETX DUO 6.4.1 HOT 3
- Improper handled of out of order packets in case Application connection restarts in multiple loop HOT 3
- http(s) client: how to download a big file chunk by chunk ? HOT 1
- DHCPv6 Server instance sends IPv6 response packets on incorrect index when DHCPv6 Client and DHCPv6 Server are brought up simultaneously
- Module (DHCPv6 Client) is getting a new IPv6 address each time we disconnect and reconnect from the Home Wi-Fi
- Can NETX DHCPv6 support simultaneous DHCPv6 Client & DHCPv6 Server on two interfaces?
- NetX BSD fails when select() is passed a timeout
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from netxduo.