Convention: The first network card for the external network, the second network card for the intranet (no external network of the machine to be configured on the second network card)
Description: CentOS 6.5 is installed by default and does not automatically open the network connection!
1. Network card IP and other configuration files
Vim/etc/sysconfig/network-scripts/ifcfg-eth0 #编辑配置文件, add modify the following content
-------------------------------------------------------------------
Device=eth1 #网卡名称
Hwaddr=6c:92:bf:07:99:f9 #mac地址
Type=ethernet #网卡类型
uuid=234fd48d-7932-4d7c-b678-af8507e5b642
Onboot=yes #开启自动启用网络连接
Nm_controlled=yes #设备是否被NetworkManager管理
Bootproto=static #启用静态IP地址
Ipv6init=no #禁止IPV6
Userctl=no #是否非root用户控制eth0
ipaddr=192.168.86.3 #设置IP地址
netmask=255.255.255.0 #设置子网掩码
gateway=192.168.21.2 #设置网关
-------------------------------------------------------------------
2. Set up DNS
------------------------------------------------------------------
1)
Vim/etc/resolv.conf
NameServer 8.8.8.8
NameServer 8.8.4.4
2)
Vim/etc/sysconfig/network-scripts/ifcfg-eth0
dns1=8.8.8.8
dns2=8.8.4.4
------------------------------------------------------------------
Two methods of restarting the NIC
-----------------------------------------------------------------
/etc/init.d/network restart
Service Network restart
-----------------------------------------------------------------
Other
-----------------------------------------------------------------
Service Ip6tables Stop #停止IPV6服务
Chkconfig ip6tables off #禁止IPV6开机启动
Service YUM-UPDATESD Stop #关闭系统自动更新
Chkconfig yum-updatesd off #禁止开机启动
Service Network Restart #重启网络连接
-------------------------------------------------------------------
3. Resetting the host name
Conventions:
Hostname naming specification: Business-Computer room-Master Preparation-domain name
The host name is set here: bbs.hz.m.osyunwei.com
------------------------------------------------------------------
View Host Name
Hostname-i
1) hostname "bbs.shenxn.com"
#设置主机名为bbs. Shenxn.com this is just a temporary, reboot will revert to the original name.
2) vi/etc/sysconfig/network #编辑配置文件 Modify host Name
Hostname=bbs.shenxn.com
#修改localhost. Localdomain to Bbs.shenxn.com
Shutdown-r now #重启系统
3) vi/etc/hosts #编辑配置文件
127.0.0.1 bbs.shenxn.com
#修改localhost. Localdomain for bbs.shenxn.com In fact, the hostname in this file is provided for DNS resolution only. If you don't use DNS, you only need to modify the host name
---------------------------------------------------------------
4. Increase the Swap partition
--------------------------------------------------------------------
You need to add 1024M of swap space after determining the memory that the server needs to use
Specific operation:
1, DD If=/dev/zero of=/tmp/swap bs=1m count=1024m #创建1024M的文件块
2, Mkswap/tmp/swap #创建swap文件
3, Swapon/tmp/swap #激活swap文件
4, Swapon-s #查看swap
5, modify the/etc/fstab file, boot automatically start
Vi/etc/fstab #在最后添加下面代码
/tmp/swap Swap swap default 0 0
---------------------------------------------------------------------
5. Introduction of network Files
---------------------------------------------------------------------
/etc/sysconfig/network-scripts/ifcfg-eth0 NIC Configuration
/etc/resolv.conf DNS Configuration
/etc/hosts Host Name
/etc/sysconfig/network machine name nic Boot
/etc/fstab boot to monut system files
/etc/inittab init-initiated system level
/ETC/INIT.D Startup scripts
/etc/exports NFS
/etc/xinit.d
/etc/profile Global Variables
------------------------------------------------------------------
Network card settings (set IP address, gateway, DNS)