Basic configuration and view of CentOS server

Source: Internet
Author: User
Tags centos server
1. set static IP1. modify Nic configuration Edit: vi/etc/sysconfig/network-scripts/ifcfg-eth0DEVICE = eth0 # describe the device alias corresponding to the NIC, for example, in the ifcfg-eth0 file, it is eth0BOOTPROTO = static # set the way the Nic gets the IP address, the possible option is static, dhcp or bootp, respectively corresponding to the static specified IP address, 1. set static IP addresses
1. modify Nic configuration Edit: vi/etc/sysconfig/network-scripts/ifcfg-eth0

DEVICE = eth0 # describe the DEVICE alias for the NIC, for example, it is eth0 in the ifcfg-eth0 file
BOOTPROTO = static # set the way for the NIC to obtain the IP address. the possible options are static, dhcp, or bootp, which respectively correspond to the IP address specified by the static state and the IP address obtained through the dhcp protocol, IP addresses obtained through the bootp protocol
BROADCAST = 192.168.0.255 # corresponding subnet BROADCAST address
HWADDR = 00: 07: E9: 05: E8: B4 # physical address of the corresponding Nic

IPADDR = 12.168.0.33 # If you set the method for obtaining the IP address from the network adapter to static, This field specifies the IP address of the network adapter.
NETMASK = 255.255.255.0 # network mask corresponding to the network adapter
NETWORK = 192.168.0.0 # NETWORK address of the NIC

2. modify the gateway configuration

Edit: vi/etc/sysconfig/network:

GATEWAY = 192.168.0.1

NETWORKING = yes (indicates whether the system uses the network, which is generally set to yes. If it is set to no, the network cannot be used, and many system service programs cannot be started)
HOSTNAME = centos (set the host name of the local machine. the host name set here must correspond to the host name set in/etc/hosts)
GATEWAY = 192.168.0.1 (set the IP address of the GATEWAY connected to the local machine .)

The first three items are available by default when I open the editing here, so only GATEWAY is added.

3. modify DNS configuration

Edit: vi/etc/resolv. conf:

Nameserver 8.8.8.8

Nameserver is the IP address of the DNS server. The first is the first choice, and the second is the backup.

4. restart the network service.

Run the following command:

Service network restart or/etc/init. d/network restart

 

2. disable the firewall and use/sbin/iptables-F. If this is not the case, you will be disconnected from the server immediately.

The following is a description from the http://wiki.ubuntu.org.cn/IptablesHowTo

You can clear all rules through/sbin/iptables-F to temporarily stop the firewall: (warning: this is only applicable to environments without a firewall configured, if the environment with the default rule "deny" has been configured, this step will interrupt all network access to the system)

Run

/Sbin/iptables-P INPUT ACCEPT

Then execute

/Sbin/iptables-F

You can see the following information through iptables-L:

Chain INPUT (policy DROP 0 packets, 0 bytes) (Note: DROP)

Execute/sbin/iptables-F to immediately disconnect
 

When

/Sbin/iptables-P INPUT ACCEPT

To view the information through iptables-L again

Chain FORWARD (policy ACCEPT 0 packets, 0 bytes)

So it is safe to use now

/Sbin/iptables-F


III. View Hardware Information 1: View CPU

More/proc/cpuinfo | grep "model name"

Grep "model name"/proc/cpuinfo

If you feel more comfortable to watch

Grep "model name"/proc/cpuinfo | cut-f2-d:

How about linux commands.

II. View Memory

Grep MemTotal/proc/meminfo

Grep MemTotal/proc/meminfo | cut-f2-d:

Free-m | grep "Mem" | awk '{print $2 }'

III. check whether the cpu is 32-bit or 64-bit

View CPU bits (32 or 64)

# Getconf LONG_BIT

# Echo $ HOSTTYPE

# Uname-

IV. view the current linux version

# More/etc/RedHat-release

# Cat/etc/redhat-release

V. view the kernel version

# Uname-r

# Uname-
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.