IP setting and configuration method of Linux CentOS system

Time:2021-11-30

Today, a centos-4.7 is installed on the VMware server (the free RedHat is a clone version of little red riding hood, which corresponds to the version of little red riding hood). The IP is not set during installation. Generally, the IP address of the network card of Linux CentOS is stored in a file. This configuration file is under / etc / sysconfig / network scripts,

The names are ifcfg-eth0 and ifcfg-eth1… If you have a network card, there is only one file ifcfg-eth0. If you have two or more network cards, there will be files such as ifcfg-eth1 and ifcfg-eth2.

File structure:

Device = eth0 / / indicates the device name

Onboot = yes / / start the application

Bootproto = static / / startup type (default DHCP)

IPADDR = 192.168.0.77 / / IP address

Netmask = 255.255.255.0 / / subnet mask

Gateway = 192.168.0.1 / / gateway

Steps:

1. VI / etc / sysconfig / network scripts / ifcfg-teh0 (can also be set through the management tool setup or netconfig command)

2. Restart network serviceservice network restart

To connect to the host: you also need to configure the XP host and set the host only mode on VMware. In XP, modify the IP address of VMnet1 to 192.168.0.1 and the IP address of Linux CentOS to 192.168.0.77

Shared Internet access settings: in XP, modify the network attribute of the first virtual network card to shared Internet (attribute – > Advanced – > check “allow other network users to connect through the Internet connection of this computer”), VMnet1 will be automatically changed to 192.168.0.1, and Linux CentOS can access the Internet