1. modify the host name vietcsysconfignetworkNETWORKING = yesHOSTNAME = NEWHOSTNAME to modify this & amp; 20540; as the host name, for example, NEWPC2: modify hostsvietchosts0000001localhost
1. modify the host name
Vi/etc/sysconfig/network
NETWORKING = yes
HOSTNAME = NEWHOSTNAME # modify this value as the host name, for example, NEWPC
2. modify hosts
Vi/etc/hosts
127.0.0.1localhost.localdomain localhost
# This row is strongly recommended to be retained
192.168.0.1rhel.lpwr.net rhel
# Three fields are required: IP, FQDN, and HOSTNAME.
3. modify the ip address
First, check the IP address of the NIC of the current machine.
1) display the currently started network interface commands:
# Ifconfig
2) view all current network interface commands:
# Ifconfig-
3) view the specified network interface command:
# Ifconfig eth0
IP address modification in LINUX is divided into two situations,
A) modify the IP address during debugging. the IP address only takes effect currently and is restored to the original IP address after restart.
# Ifconfig eth0 192.168.63.27 netmask route 255.255.0 route add defaultgw 192.168.63.1 up
B) permanently effective (that is, it can also take effect after restart)
Method 1: configure the Nic configuration file
Modify/etc/sysconfig/network-scripts/ifcfg-eth0
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)
Method 2:
Save ifconfig eth0 192.168.63.27 netmask 255.255.255.0 route adddefault gw 192.168.63.1 to the/etc/init. d/rc. local file.
4. modify the Gateway
Vim/etc/sysconfig/network
Add a Gateway
GATEWAY = 192.168.1.1
5. modify DNS
Vi/etc/resolv. conf # specifies the DNS server of the current host. up to three
Searchlpwr.net # set the default search domain for the current host
Nameserver192.168.0.100 # specify the preferred DNS server
Nameserver172.16.254.2
6. after the restart, the network will take effect.
/Etc/init. d/network restart
Service network restart