Dynamic address configuration in the Ethernet network of a distributed system
2026-04-06 09:41:09··#1
Introduction Ethernet, with its simplicity, flexibility, maturity, and stability, has become the preferred communication method for many distributed systems. In the Ethernet structures used within these systems, the rational utilization and configuration of address information (including MAC addresses and IP addresses) is crucial for improving system availability and flexibility. In the OSI seven-layer network protocol reference model, Layer 2 is the data link layer. MAC addresses reside at this layer and are written into the hardware by network equipment manufacturers during production. MAC addresses typically use 6 bytes (48 bits). The first 24 bits are the manufacturer's address obtained from the IEEE, and the last 24 bits are allocated by the manufacturer. This allocation ensures that any network device with a 48-bit MAC address has a unique identifier. In TCP/IP networks, each host has a unique address. The IP protocol requires that each host must be assigned a unique address (32 bits for IPv4, 128 bits for IPv6) each time a connection is established with a TCP/IP network. This address assigned to each host is called an IP address. It is divided into public IP addresses on the Internet and internal IP addresses on local area networks. The internal structure of a distributed system is completely transparent to the user, and it generally adopts an embedded structure. Address information in an embedded structure is typically stored in a read-only memory (ROM), which is automatically loaded when the system starts. This address configuration mode is relatively universal and suitable for general distributed systems; however, for some complex distributed systems, this mode may bring some problems, such as increased production costs, longer production cycles, complex debugging processes, low work efficiency, and low address resource utilization. This paper, based on a practical project, proposes a dynamic configuration method for MAC and IP addresses in the Ethernet network within a distributed system, fundamentally solving the problems caused by traditional configuration methods. The dynamic configuration method for MAC and IP addresses is described below. 1 Project Background The National Digital Switching System Engineering Technology Research Center (NDSC) undertook the research and development of a high-performance IPv6 core router under the National 863 Program. This core router adopts a distributed system structure, consisting of line cards, forwarding, switching, and main control modules. The line cards, forwarding, and switching modules are collectively referred to as single-board modules. These single-board modules utilize the Ethernet port units of their embedded processor boards to connect to the main control module via Ethernet. Each processor board uses the VxWorks embedded real-time operating system, capable of independently handling real-time tasks for each board module. The main control module uses the Linux operating system, featuring a user-friendly interface and communicating with each board module via Ethernet, as shown in Figure 1. Since each board module in the distributed system needs to communicate with the main control module via internal Ethernet, corresponding MAC and IP addresses must be assigned to the network port units of the embedded processor boards on each board module. This address information is generally stored in ROM and automatically read during system startup. It's important to note that the MAC and IP address configuration discussed below differs from traditional address allocation. Traditional IP address allocation refers to assigning a public IP address to a computer connected to the internet (which could be a computer in a local area network connected to the internet via a server) through the DHCP (Dynamic Host Configuration Protocol) protocol, enabling it to uniquely identify itself on the internet. In the distributed system architecture discussed here, the internal Ethernet and external network are isolated, and it is not necessary to assign public IP addresses from the internet to the network port units of the embedded processor boards on each board module. Each network port unit only needs to uniquely identify itself within the local area network (LAN), corresponding to only one LAN IP address; while the MAC address is unique for each network device. The configuration method discussed below refers to how to configure the LAN's internal IP address and MAC address to each network port unit. 2. Traditional Static Configuration Method According to the project's design requirements, several MAC addresses must first be applied for, and some LAN internal IP addresses must be selected (since it is an internal Ethernet network, isolated from the outside world, the IP addresses can be arbitrarily selected). Then, this MAC address and IP address information is stored in ROM, which is manufactured by the manufacturer. After the ROMs are manufactured, they are soldered onto each embedded processor board for debugging. This method has the following disadvantages: ① According to the definition of MAC address and IP address, the MAC address and IP address of each Ethernet port unit on the processor board are different. The same address information cannot be stored in different ROMs, so the information in each ROM is different, and it can only be made individually, not in batch production. This increases costs and the production cycle is long. ② Because the MAC addresses and IP addresses of the network port units of each embedded processor board are different, each embedded processor board must be treated differently during debugging. Therefore, different configuration information must be set according to different addresses, making the debugging process complex and inefficient. ③ In practical applications, backup devices are essential to prevent equipment damage; therefore, the number of embedded processor boards produced must exceed the actual need. Since the number of network port units on each processor board must match the number of processor boards, the number of MAC addresses required must also match the number of processor boards produced, exceeding the number needed for normal operation. If the working processor boards all function normally, there is no need to use backup processor boards, and the MAC address resources allocated to the backup processor boards will not be used. When a working processor board malfunctions and a backup board is needed, the MAC addresses of the faulty processor board also cannot be used. Therefore, the excess number of MAC addresses will inevitably be wasted. To address these issues, a dynamic configuration method was adopted for the network port address information of the embedded processor boards in the distributed system of the core router project. 3. Dynamic Configuration Method Flash memory's erasability and non-volatility are widely used in modern embedded systems. Since ROM content is pre-written and cannot be changed, complex embedded systems generally utilize Flash's erasability for system configuration. Due to the complexity of single-board modules, the configuration information of the embedded processor board needs to be adjusted to ensure its normal operation. Therefore, the role of Flash can be fully utilized, effectively combining its configuration with ROM. In a distributed router, the following dynamic configuration method for MAC and IP addresses is adopted: ① Request MAC addresses according to the required amount for normal operation (compared to static configuration, there are no spare MAC addresses), thus ensuring efficient resource utilization. ② Set the order in which the embedded processor board and embedded system access MAC and IP address information. The system reads ROM information upon startup. When it reads network port address information, it switches to accessing the relevant address in Flash. If the relevant information exists, it is read; if the relevant information is not in Flash, the address information is read from ROM, as shown in Figure 2. ③ Select one MAC address from the requested MAC address and simultaneously select a local area network IP address. The hardware information and the order of MAC and IP addresses accessed by the embedded system are uniformly programmed and solidified into each ROM, and these ROMs are mass-produced. This effectively reduces costs and shortens the production cycle. ④ These ROMs are soldered onto each embedded processor board, and the relevant MAC and IP address information in the Flash memory of the processor board is set to 0. The processor board then reads the address information from the ROM for configuration. Because the MAC and IP address information is the same in each ROM, the debugging process is identical for each processor board. This consistent process is simple and easy to implement. ⑤ After the processor board is debugged, the obtained MAC addresses are assigned to the network ports of different processor boards in each single-board module; at the same time, some local area network IP addresses are selected to ensure they are unique within the Ethernet network. Then, the allocated MAC and IP addresses and other hardware information can be written to the Flash memory of each working processor board using debugging tools (Minicom under Linux, remote terminal under Windows). Through the above allocation method, all working processor boards use the addresses in their Flash memory as unique MAC and IP addresses. When the embedded system starts up, it reads the address information assigned to each board. Next, comprehensive debugging of the processor board and each single-board module can be performed. ⑥ When a problem occurs with the working processor board and a backup processor board needs to be used, the MAC address and IP address in the Flash memory of the problematic processor board can be reassigned to the backup processor board. This effectively utilizes the allocated MAC address resources. Through the above dynamic configuration method of MAC and IP addresses, various problems existing in the static configuration method can be effectively overcome. Compared with the static configuration method, the dynamic configuration method combines the flexible application of Flash and ROM, and has the following advantages: ① It can mass-produce ROMs with consistent content, reducing system costs and shortening the production cycle. ② The debugging steps for each processor board are consistent and simple to implement. ③ The allocated MAC addresses are effectively utilized, saving address resources. Conclusion The fundamental difference between dynamic and static configuration of MAC and IP addresses in a distributed system lies in the flexible application of Flash. With the increasing prevalence and complexity of distributed systems, the low production cost, short production cycle, and high address resource utilization offered by dynamic configuration methods, along with the QHartus II and SOPC Builder development tools provided by Altera, enable rapid system integration design and system simulation after interface function design is completed. Ultimately, the entire system design can be implemented on Altera's Cyclone series chips. Reprogramming the Nios processor allows for convenient addition of system functionality and processing efficiency without altering the system hardware framework, greatly facilitating system upgrades and redevelopment.