After the linux system is installed, configure the nic ip address in command mode. The configuration file is usually etcsysconfignetwork-scriptsifcfg-interface-name1 configuration nic ip address vietcsysconfignetwork-scriptsifcfg-eth0 second Nic:
After the linux system is installed, configure the nic ip address in command mode. The configuration file is usually/etc/sysconfig/network-scripts/ifcfg-interface-name
1. configure the nic ip address
Vi/etc/sysconfig/network-scripts/ifcfg-eth0 # Second Nic: vi/etc/sysconfig/network-scripts/ifcfg-eth1
DEVICE = eth0 # physical DEVICE name
IPADDR = 192.168.1.10 # IP address
NETMASK = 255.255.255.0 # mask value
NETWORK = 192.168.1.0 # NETWORK address (optional)
BROADCAST = 192.168.1.255 # BROADCAST address (optional)
GATEWAY = 192.168.1.1 # GATEWAY address
ONBOOT = yes # [yes | no] (whether to activate the device during boot)
USERCTL = no # [yes | no] (whether non-root users can control the device)
BOOTPROTO = static # [none | static | bootp | dhcp] (no protocol used during boot | static allocation | BOOTP protocol | DHCP protocol)
2. configure the Nic DNS
The configuration file is under/etc/resolv. conf.
Vi/etc/resolv. conf
Nameserver 202.109.14.5 # Primary DNS
Nameserver 219.141.136.10 # Secondary DNS
Search localdomain
Therefore, after the network configuration is complete, you must restart the network service: service network restart or/etc/init. d/network restart.
3. bind two IP addresses to a single NIC
Linux network device configuration files are stored in/etc/sysconfig/network-scripts, for the first network device Ethernet, the configuration file name is generally ifcfg-eth0. To bind one more IP address to the first network device, create a file named ifcfg-eth0: 0 in the/etc/sysconfig/network-scripts directory, as shown in the following example:
DEVICE = "eth0: 0"
IPADDR = "211.100.10.119"
NETMASK = "255.255.255.0"
ONBOOT = "yes"
DEVICE indicates the DEVICE name, IPADDR indicates the IP address of the DEVICE, NETMASK indicates the subnet mask, and ONBOOT indicates automatic start at system startup.
If you need to bind another IP address, you only need to add one of the file name and the eth0 in the DEVICE in the file. LINUX supports up to 255 IP aliases.