Configuring NIC in Linux
Configuring NIC in Linux
In this situation there is no IP address on the ensp0 network gateway, since the
VirtualBox is its only NIC by way of a wireless access card wlan0. Adapter wlan0 has
a 172.16.2.200 IP address and a 255.255.255.0 subnet mask you will notice that this
control provides the best interrupt data or the PCI bus ID that is used by the device.
You that notice your NIC card is not operating on a very rare occasion because it has
an interrupt and a connection to a storage with a network. To get a database of all
interrupt IRQs the system uses, you can access the /proc/interrupts directory
contents. The following example demonstrates that no problems arise with each IRQ
from 0 to 15 with only one application. ensp0 and ensp1 interface cards, respectively,
are used for interrupts of 10 and 5.:
If there are problems, the Linux documentation for the offending machine may be
needed to try and find ways to use a different interrupt or memory I / O position.
1.3 Modifying IP Addresses in Linux
The ifconfig statement above showed us that ensp0 interface has no IP address and
we can manually assign this ensp0 interface an IP address using the ifconfig
command as shown in the statement below.
At the end of the instruction, the "up" switches on the network interface You will
have to apply this instruction to the /etc/rc.local text file that is running at the start
of every restart to make it permanent every time you boot up.
In the /etc/sysconfig/network-scripts tab, Centos Linux often makes life easier with
interface configuration setup files Configuration network interface ensp0 has an
ifcfg-ensp0 file and ifcfg-eth1 is used by eth1, and so on. You could paste your IP
address in these files and which are then used to setup your NICs automatically when
the Linux boots. Regarding two Linux network interface instances, see Figure 3-1.
Firstly, the initial network interface has a set Internet address and secondly, an IP
address assignment utilizing DHCP is available.
#
# File: ifcfg-ensp0
#
DEVICE=ensp0
IPADDR=172.16.2.200
NETMASK=255.255.255.0
BOOTPROTO=static
ONBOOT=yes
#
# The following settings are optional
#
BROADCAST=172.16.2.255
NETWORK=172.16.2.0
[ppeters@rad-srv network-scripts]#
Getting the IP Address Using DHCP
#
# File: ifcfg-ensp0
#
DEVICE=ensp0
BOOTPROTO=dhcp
ONBOOT=yes
[root@bigboy network-scripts]#
As you can see ensp0 will be activated on booting, because the parameter ONBOOT
has the value yes and not no. You can read more about netmasks and DHCP in
Chapter 2, "Introduction to Networking", that acts as an introduction to networking.
The default RedHat/Fedora installation will include the broadcast and network
options in the network-scripts file. These are optional.
After you change the values in the configuration files for the NIC you have to
deactivate and activate it for the modifications to take effect. The ifdown and ifup
commands can be used to do this:
Your server will have to have a default gateway for it to be able to communicate with
the Internet. This will be covered later in the chapter.
2 How DHCP Affects the DNS Server You Use
Your DHCP server not only supplies the IP address your Linux box should use, but
also the desired DNS servers. When using DHCP for an interface, make sure your
/etc/resolv.conf file has the servers configuration lines commented out to prevent
any conflicts.
3 Multiple IP Addresses on a Single NIC
In the previous section "Determining Your IP Address" you may have noticed that
there were two wireless interfaces: wlan0 and wlan0:0. Interface wlan0:0 is actually
a child interface wlan0, a virtual subinterface also known as an IP alias. IP aliasing is
one of the most common ways of creating multiple IP addresses associated with a
single NIC. Aliases have the name format parent-interface-name:X, where X is the
sub-interface number of your choice.
The process for creating an IP alias is very similar to the steps outlined for the real
interface in the previous section, "Changing Your IP Address":
DEVICE=wlan0:0
ONBOOT=yes
BOOTPROTO=static
IPADDR=192.168.1.99
NETMASK=255.255.255.0
The commands to activate and deactivate the alias interface would therefore be:
Note: Shutting down the main interface also shuts down all its aliases too. Aliases
can be shutdown independently of other interfaces.
After completing these four simple steps you should be able to ping the new IP alias
from other servers on your network.