centos ubuntu set a static IP

ubuntu official website: https://help.ubuntu.com/lts/serverguide/network-configuration.html

CentOS:

  NIC information query:

dmesg | grep - in eth 
lspci | grep -i ethernet 
card modules:
lsmod | grep 1000

 

  Profile Path: / etc / sysconfig / network-sripts / ifcfg-eth0

1 the DEVICE = "eth0 "                 card Name 
2 HWADDR = "" the MAC address, only one card can be omitted
 3 NM_CONTROLLED = " NO "            do not suffer other management software
 4 ONBOOT = "YES" to start this interface by default
 5 BOOTPROTO = none made ip manner, arranged to automatically obtain DHCP
 . 6 the IPADDR = 192.168 . 1.100          IP
 . 7 NETMASK = 255.255 . 255.0         subnet mask
 . 8 the nETWORK = 192.168 . 1.0           the first IP subnet change
 . 9 BROADCAST =192.168 . 1.255       broadcast address
 10 the MTU = 1500                      maximum transmission unit 
is provided to automatically obtain an IP keys to just set 1,2,3,4,5

Restart the network interface:

/etc/init.d/network restart

DNS server IP View and definitions

Configuration file: / etc / resolv.conf 
nameserver 202.96 . 199.133 
nameserver 202.106 . 196.115 
check whether the DNS server to resolve: dig www.baidu.com

Modify the host name, and start to look at:

Modify / etc / sysconfig / network and / etc / hosts file
 / etc / sysconfig / Network: 
NETWORKING = yes 
HOSTNAME = WWW.localhost.localcentos

 / etc / hosts:
 192.168 . 1.100 WWW.localhost.localcentos 
original content do not modify

the hostname command to view the host name
using the ping command to see whether the host name communication, and finally restart the server


 

 

Guess you like

Origin www.cnblogs.com/zm1314/p/11822930.html
Recommended