Last active
August 23, 2018 01:36
-
-
Save yangfch3/02e950597f46c273fb810a9158a56095 to your computer and use it in GitHub Desktop.
CentOS 配置静态 IP
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
封装环境:nginx + node.js + mysql + redis + memcached + php + php-fpm | |
配置文件路径: | |
/etc/ssh/sshd_config | |
/etc/nginx/ | |
/etc/my.cnf (/etc/mysql/my.cnf /usr/local/mysql/my.cnf ~/.my.cnf) | |
/etc/redis/ | |
/etc/php.ini > /usr/local/etc/php5214.ini | |
/etc/php-fpm.conf | |
远程 | |
port: 43999 | |
公钥存放位置:~/.ssh/authorized_keys | |
开机自运行命令条目 | |
/etc/rc.d/rc.local | |
虚拟机移动导致 eth(x) 无法被绑定 | |
1. rm -rf /etc/udev/rules.d/70-persistent-net.rules | |
2. reboot | |
> 1 和 2 是为了让移动虚拟机后混乱的网卡重新初始化 | |
3. vim /etc/udev/rules.d/70-persistent-net.rules 将网卡 eth(x) 的 x 修改为与 ifconfig -a 输出的 eth(x)一致 | |
4. (创建或)修改 /etc/sysconfig/network-scripts/ifcfg-eth(x) 中的网卡信息与 70-persistent-net.rules 对应,Device 字段 eth 序号为 x | |
虚拟机网络配置: | |
1. vim /etc/sysconfig/network-scripts/ifcfg-eth(x) 固定 IP 地址,并修改 MAC 地址与 ifconfig -a 输出的一致 | |
2. vim /etc/resolv.conf 修改 DNS | |
> nameserver 223.5.5.5 | |
> nameserver 8.8.8.8 | |
3. vim /etc/sysconfig/network 修改网关 | |
4. /etc/init.d/network restart 或 service network restart 重启网络服务 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment