網路設置與優化 - 以CentOS7為例
CentOS修改IP地址 以下為範例,請修改為適當之設置
vim /etc/sysconfig/network-scripts/ifcfg-*
ONBOOT=yes
BOOTPROTO=static
IPADDR=192.168.1.10
PREFIX=24
GATEWAY=192.168.1.1
vi /etc/resolv.conf 加入DNS設置
nameserver 1.1.1.1
firewall 需關閉 (關閉指令 )
systemctl stop firewalld
systemctl disable firewalld
修改SELinux設定值 /etc/sysconfig/selinux
SELINUX=disabled
sestatus→查看SELinux的當前模式
需重開機設定使能生效
更改主機名稱
編輯 /etc/sysconfig/network
HOSTNAME={{參照主機設定相對應之主機名稱}}
設定地區時區
Set TimeZone
cp /usr/share/zoneinfo/Asia/Taipei /etc/localtime ? y
CentOS 優化程序 & 工具Tools
yum -y install epel-release
yum -y update
yum install -y net-tools
yum -y install mtr
yum -y install wget
yum -y install vim
yum -y install htop
yum -y install iftop
yum -y install ntpdate
systemctl stop postfix
systemctl disable postfix
2.3 NTP 時間同步
ntpdate time.stdtime.gov.tw
vim /etc/crontab
*/1 * * * * root /usr/sbin/ntpdate time.apple.com