In order to have the system configure our NIC at boot, the first step is to get an IP address and subnet mask. In our case, we are going to put this second NIC into a different IP range than the original NIC. Our first NIC is in the 192.168.1.x network, so we will put the new NIC into the 192.168.2.x network. Both of these networks have a subnet mask of 255.255.255.0. Note: Always make sure the assigned IP is not already taken up by another machine; to do so, use ping from a machine already configured in that network.
Next we add a line to the /etc/hosts file for our new card:
192.168.2.100 host2.mydomain.com host2
Now, we create a file in /etc that is named hostname. For example, our first NIC’s file is /etc/hostname.hme0. Our new device, hme1, will need the file /etc/hostname.hme1. In this file, we will put the name associated with the IP (as found in the /etc/hosts file). It should be the first name in the /etc/hosts file. In our scenario, /etc/hostname.hme1 should contain:
Then we edit the /etc/netmasks file for our new network:
Reboot the system, and your network card has been configured for the new network with the proper subnet mask. You can check it by running an ifconfig -a again:
lo0: flags=1000849 mtu 8232 index 1 inet 127.0.0.1 netmask ff000000 hme0: flags=1000843 mtu 1500 index 2 inet 192.168.1.100 netmask ffffff00 broadcast 192.168.1.255 ether hme1: flags=1000843 mtu 1500 index 3 inet 192.168.2.100 netmask ffffff00 broadcast 192.168.2.255 ether