First, set the static IP
1. Modify the NIC configuration edit: Vi/etc/sysconfig/network-scripts/ifcfg-eth0
Device=eth0 #描述网卡对应的设备别名, for example, in Ifcfg-eth0 file it is eth0
Bootproto=static #设置网卡获得ip地址的方式, the possible options are static,dhcp or BOOTP, corresponding to statically specified IP addresses, IP addresses obtained through the DHCP protocol, IP addresses obtained through the BOOTP protocol
broadcast=192.168.0.255 #对应的子网广播地址
HWADDR=00:07:E9:05:E8:B4 #对应的网卡物理地址
ipaddr=12.168.0.33 #如果设置网卡获得 IP address is statically specified, this field specifies the IP address of the NIC
netmask=255.255.255.0 #网卡对应的网络掩码
network=192.168.0.0 #网卡对应的网络地址
2. Modify the Gateway Configuration
EDIT: Vi/etc/sysconfig/network modified as follows:
gateway=192.168.0.1
Networking=yes (Indicates whether the system uses a network and is generally set to Yes.) If set to no, the network cannot be used, and many system services programs will not start.
Hostname=centos (Set the hostname of this machine, the host name set here should correspond to the hostname set in/etc/hosts)
gateway=192.168.0.1 (Sets the IP address of the gateway for the native connection. )
I'm editing this here. The first three items are already default, so only the gateway is added.
3. Modify the DNS configuration
EDIT: vi/etc/resolv.conf modified as follows:
NameServer 8.8.8.8
NameServer is the DNS server IP address, the first is the preferred one, the second is the standby.
4. Restart the Network Service
Execute command:
Service network restart or/etc/init.d/network restart
Second, close the firewall
Use/sbin/iptables-f be careful, you'll be disconnected from the server immediately.
Here are the instructions from Http://wiki.ubuntu.org.cn/IptablesHowTo
You can temporarily stop the firewall by/SBIN/IPTABLES-F clearing all rules: (Warning: This is only appropriate in environments where the firewall is not configured, and if the default rule is deny, this step will break all network access for the system)
If you want to empty it, do it first.
/sbin/iptables-p INPUT ACCEPT
And then execute
/sbin/iptables-f
See the following information through Iptables-l
Chain INPUT (Policy drop 0 packets, 0 bytes) (Note is drop)
Execution/sbin/iptables-f must immediately disconnect
When executed the
/sbin/iptables-p INPUT ACCEPT
Once again through the iptables-l to see the message is
Chain FORWARD (Policy ACCEPT 0 packets, 0 bytes)
So now it's safe to use.
/sbin/iptables-f.
Third, view hardware information
One: View CPU
More/proc/cpuinfo | grep "model name"
grep "model name"/proc/cpuinfo
If you feel the need to see more comfortable
grep "model Name"/proc/cpuinfo | Cut-f2-d:
How about Linux commands that are so familiar.
Two: View memory
grep memtotal/proc/meminfo
grep Memtotal/proc/meminfo | Cut-f2-d:
Free-m |grep "Mem" | awk ' {print $} '
Three: Check whether the CPU is 32-bit or 64-bit
View the number of CPU bits (+ or 64)
#getconf Long_bit
#echo $HOSTTYPE
#uname-A
Four: View the current version of Linux
#more/etc/redhat-release
#cat/etc/redhat-release
V: View kernel version
#uname-R
#uname-A
Basic configuration and viewing of the CentOS server