CentOS to modify the network to modify a few files
1,/etc/sysconfig/network CentOS set host name and network configuration
For example:
Networking=yes
Hostname=oel6-69.localdomain
2,/etc/sysconfig/network-scripts/ifcfg-eth0 for the specific network card settings
For example:
Device= "Eth0"
bootproto= "Static"
ipaddr=192.168.9.69
netmask=255.255.255.0
Hwaddr= "08:00:27:43:d4:a8"
Nm_controlled= "Yes"
onboot= "Yes"
gateway=192.168.9.88
3,/etc/resolv.conf set DNS
Like NameServer XXX.
4,/etc/hosts set the specified domain name resolution address
Then restart Service Network restart
However, the command does not work when the restart service is in effect, and some environment variables need to be configured at this time
Su enters root and runs vi/etc/profile to add the following statement at the end of the file: Export path= $PATH:/sbin
#针对root用户, append the/sbin directory after the path variable, set the variable to global save and exit.
Modify/home/user/.bash_profile, add/sbin:/usr/sbin:/usr/local/sbin:/usr/kerberos/sbin after path this is for account development, such as Oracle, etc.
After the change is complete, execute the command:. . bash_profile, if you do not have Execute permissions chmod 5755 user files, then execute
Note: If it is SuSE, the static IP need to set the gateway,/etc/sysconfig/network/routes add default 192.168.XXX. Xxx
With some query commands
1, query network card IP, mask and other information
Ifconfig-a
2. Query Gateway
IP route Show or Netstat-rn
3, query DNS
Cat/etc/resolv.cong