16+ ports fix

Features you'd like to see in the upcoming version of EVE-NG

Moderator: mike

Post Reply
eddie4
Posts: 5
Joined: Tue Jun 08, 2021 8:15 am

16+ ports fix

Post by eddie4 » Thu Jun 10, 2021 12:22 pm

Hi,

This is not so much a feature request as an fix I have implemented in the code that we are running.

from line 2860

Code: Select all

					case 'vmxvfp':
						$bridgeid = 0;
						$this -> flags_eth .= ' -device i82801b11-bridge,id=dmi-pci-bridge ';
						for ($i = 0; $i < $this -> ethernet; $i++) {
							if (isset($old_ethernets[$i])) {
								// Previous interface found, copy from old one
								$this -> ethernets[$i] = $old_ethernets[$i];
							} else {
								if ($i == 0) {
									$n = 'em0 / fxp0';			// Interface name
								} else if ($i == 1) {
									$n = 'em1 / int';		// Interface name
								} else {
                                    $n = 'em'.$i.' / ge-0/0/'.($i - 2);
								}
								try {
									$this -> ethernets[$i] = new Interfc(Array('name' => $n, 'type' => 'ethernet'), $i);
								} catch (Exception $e) {
									error_log(date('M d H:i:s ').'ERROR: '.$GLOBALS['messages'][40020]);
									error_log(date('M d H:i:s ').(string) $e);
									return 40020;
								}
							}
							if ($i % 10 == 0) {
								$bridgeid++;
								$addr = 1;
								$this -> flags_eth .= ' -device pci-bridge,id=bridge-'.$bridgeid.',chassis_nr='.$bridgeid.',bus=dmi-pci-bridge ';
								} else {
										$addr++;
										}
							// Setting CMD flags (virtual device and map to TAP device)
							$this -> flags_eth .= ' -device %NICDRIVER%,netdev=net'.$i.',bus=bridge-'.$bridgeid.',addr=0x'.$addr.'.0,mac=50:'.sprintf('%02x', $this -> tenant).':'.sprintf('%02x', $this -> id / 512).':'.sprintf('%02x', $this -> id % 512).':00:'.sprintf('%02x', $i);
							$this -> flags_eth .= ' -netdev tap,id=net'.$i.',ifname=vunl'.$this -> tenant.'_'.$this -> id.'_'.$i.',script=no';
						}
						break;
Now this code only fixes the qemu part of the problem and not any juniper router limitation. It also is a bit of a dirty fix as implemented. But it works and if implemented a bit nicer in code would allow eve-ng to spin up hosts with a lot more network interfaces. We are running this with up to 54 ports (havent solved the juniper limitation tho) see viewtopic.php?f=3&t=18770 if any progress has been made.

Post Reply