Using 2 NICs for different networks is a complicated case where you need to specify the local networks and the subnet masks at first. Then you will have to assign an IP address to the local networks and leave the default gateway entries blank.
If each network interface is not properly configured to take into account the entire network topology, the existence of many Network Interface Cards (NICs) may result in connectivity issues. This article will tell you all about how to avoid that while doing the task at hand properly.
Table of Contents
- How Do Use 2 Network Interfaces (NICs) for Different Networks
- What Rules to Follow for Configuring Multi-NIC Systems
- Can We Have Multiple NICs?
How Do Use 2 Network Interfaces (NICs) for Different Networks
Connecting two Network Interfaces (NICs) to different networks is an advanced scenario. It includes setting up a PC with only one OS operating and two NICs connecting to two local networks. Each network has a gateway that is available for use in relaying packets to different external networks.
To use 2 NICs simultaneously, use a CAT5 cable to connect the first NIC cable and your corporate network. Next, connect the second one to a switch intended for content traffic. Then you have to configure the DHCP server and enable it. Once done, click “Save” and the process will be complete. A detailed description is as follows.
Step 1: Creating the Scenario
Consider two local networks, A and B, that utilize IP addresses of the form 10.0.0.x with a subnet mask of 255.255.255.0 and 10.0.1.x with the same subnet mask. A gateway connects local network A to external network C, which has IP addresses with the format 192.168.0.x and a subnet mask of 255.255.255.0.
A similar gateway utilizes IP addresses of the form 192.168.1.x with a subnet mask of 255.255.255.0. It connects local network B to outside network D.
Step 2: Assigning the IP Address
The objective here is to make the multi-NIC PC such that it should be able to connect to any network. Your NIC is to be connected to local network A, where the IP address will be assigned as 10.0.0.5 with subnet mask 255.255.255.0.
As for the second NIC, it should be connected to local network B. The IP address there will be assigned as 10.0.1.5 with subnet mask 255.255.255.0 as well. It would not be ideal if a default gateway were to be chosen since packets intended for external networks would be transmitted through the inappropriate gateway.
Step 3: Leave the Default Gateway Entries Empty
You can fix the current issue by avoiding the default gateway entries for the two NICs and keeping them empty. you will have to manually configure packet routing in the OS. While every OS is set up differently, the majority allow for the manual installation of routes by the user. Besides, these routes can be set to remain after a system reboot.
You can use the IP address of the gateway between networks A and C. However, you also must add a route with the IP address 192.168.0.x and subnet mask 255.255.255.0. The gateway linking networks B and D requires the same action to be taken with IP address 192.168.1.x and subnet mask 255.255.255.0.
What Rules to Follow for Configuring Multi-NIC Systems
You must pay more attention to networking settings while dealing with a computer that has several network interfaces. You do that to avoid connectivity issues that are challenging to troubleshoot. For your multi-NIC system to run as efficiently as possible, abide by the following rules.
1. Be Wary of Auto IP Assignment
The majority of operating systems are set up by default to automatically get TCP or IP settings from a Dynamic Host Configuration Protocol (DHCP) server. In the absence of a DHCP server, it is customary for OSs to assign an IP address in the 169.254.x.x range, often known as a link-local IP address.
Make sure you are educated about the DHCP servers on your network, including the IP address ranges and subnets they support. Also, check to see whether any of your computer’s adapters use DHCP. A 169.254.x.x address will be used if there is no DHCP server on the network.
2. Avoid Connecting Multiple NICs to the Same Subnet on the Same PC
The use of several NICs on the same subnet is the most evident reason why connectivity issues occur on multi-NIC systems. While certain OSs might be able to handle several NICs on the same network without any issues, others might unintentionally try to send packets out of the incorrect interface.
It often happens that several NICs are assigned to the same subnet when a wired and wireless interface is used to connect to a single network. To avoid conflicts online public servers, it is advisable to choose one of the approved private IP address ranges.
3. Avoid Setting a Default Gateway for Multiple NICs
A default gateway is used to relay messages to the outside network when a destination IP address does not fit within the subnet of any NIC. Packets may be directed to the incorrect outside network if there are several default gateways, rendering them undeliverable.
Generally speaking, you should be able to address all devices connected to a network interface on the same private subnet and omit the default gateway for that interface. Typically, a default gateway address should only be provided for one NIC that serves as a gateway to the internet or a company network.
Although setting a default gateway on a single interface is more effective, networks with numerous gateways may experience less trouble if all default gateway entries are left blank. This tactic, however, will only be effective if network gateways accept proxy ARP.
Can We Have Multiple NICs?
You can certainly include multiple NICs on a VM to multiple subnets. However, make sure those subnets exist in the same virtual network or vNet.
To conclude, it is required to understand certain concepts regarding Ethernet networking before the best practices for setting controllers with multiple NICs are discussed. Besides, numerous Ethernet adapters are becoming prevalent in PCs and embedded controllers. This article should give you a clear idea about it.