安装好 Linux 系统后,通常要做一些基本设置,比如网络,防火墙等。
1. 修改 ip 地址, 执行如下命令:
- vi /etc/sysconfig/network-scripts/ifcfg-eth0
- DEVICE=eth0
- TYPE=Ethernet
- ONBOOT=yes #开机使用
- BOOTPROTO=static #ip地址设置为静态
- IPADDR=192.168.92.82 #Linux服务器ip地址
- GATEWAY=192.168.92.1 #网关地址
- NETMASK=255.255.255.0 #子网掩码
- DNS=192.168.92.1 #DNS服务器地址
保存 vi 修改小技巧:
重启网络服务
- shift + Duoble Z click == wq!
- service network restart
2. 修改主机名为 mini1
- vi /etc/sysconfig/network
- NETWORKING=yes
- HOSTNAME=mini1
需要重启机器。
3. 修改 ip 地址和主机名的映射关系
vi /etc/hosts
- 127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
- ::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
- 192.168.92.81 mini
4. 关闭 iptables 并设置其开机启动 / 不启动
- service iptables stop
- chkconfig iptables on
- chkconfig iptables off
来源: http://www.jianshu.com/p/b908458e8e62