When I first came into contact with Linux, I first needed to access the Internet. Configuring IP addresses is the first course to learn how to use Linux.
1. Set IP addresses
View your IP Nic
Ifconfig-
Find the network card you want to use
Vi/etc/sysconfig/network-scripts/ifcfg-eth0
Www.2cto.com
# Intelconfiguration82801ba/BAM/CA/CAMEthernetController
DEVICE = eth0 (NIC interface name)
BOOTPROTO = static (value: static/none/DHCP)
# BROADCAST = 192.168.120.255
HWADDR = 00: A2: A5: F5: 80: 55
IPADDR = 192.168.120.54 (IP address)
NETMASK = 255.255.255.0 (subnet mask)
# NETWORK = 192.168.120.0
ONBOOT = yes (whether it takes effect automatically yes/no)
2. Set the gateway address
Vi/etc/sysconfig/network
NETWORKING = yes
HOSTNAME = localhost. localdomain
GATEWAY = 192.168.120.1 (GATEWAY)
3. Set the DNS address
Vi/etc/resolv. conf
Nameserver 192.168.20.36 (primary DNS)
Nameserver 202.102.24.35 (secondary DNS)
Searchlocaldomain
4. The settings are complete.
/Etc/init. d/network restart
In addition, Linux can configure one network card with two ip addresses or multiple network cards under one IP address.