Ifconfig eth0 192.168.1.102 netmask 255.255.255.0//Add IP Address
Route add default GW 192.168.1.1//Add Gateway
Start in effect:
Vim/etc/sysconfig/network-scripts/ifcfg-eth0//(Some versions may not have vim this editor such as CentOS, you may replace with VI)
IPADDR=192.168.1.102//Add IP Address
netmask=255.255.255.0//Mask
gateway=192.168.1.1//Add Gateway
The final results are as follows:
Device=eth0
Bootproto=static
ipaddr=192.168.1.102
netmask=255.255.255.0
geteway=192.1 68.1.1
Onboot=yes
Type=ethernet
Note: Bootproto only can use the IP information set in static (static) mode
Modify DNS
Vim/etc/resolv.conf
Can be effective immediately after modification
Form
Join Nameserver= ***.***.***.***
Up to three, as a candidate after the previous failure
Modify Host Name
Immediate effect:
Hostname FC2
Start in effect:
Vim/etc/sysconfig/network
The form is as follows:
Networking=yes
hostname=rh-linux.fc.org
##########################################################
First, understand the traditional network configuration commands:
1. Configure and view network interface conditions using the Ifconfig command
Example 1: Configure eth0 IP and activate the device at the same time:
Ifconfig eth0 192.168.4.1 netmask 255.255.255.0 up
Example 2: Configure IP for the eth0 alias device eth0:1 and add routes
Ifconfig eth0:1 192.168.4.2
Route add–host 192.168.4.2 Dev eth0:1
Example 3: Activating (disabling) a device
Ifconfig eth0:1 up (down)
Example 4: View all (specified) network interface configurations
Ifconfig (eth0)
—————————