服务器重装centOS设定静态ip

电信机房5台托管服务器被攻击,为安全起见,老板令我需要重装系统。可采用光盘刻录或u盘安装方法(过程从略)。

1. 重装系统

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
reboot(crtl+allt+delete) 
->
F2(system manage)
->
F11(BIOS Menu)
->
BIOS Boot Setting
->
Boot Sequence
->
# 光盘或U盘
COD(DVD or U Driver)
->
OK
->
Install from video / U Driver
->
No Test
->
Basic
->
Fresh
->
Use All
->
Basic Server
->
reboot

2. 设置固定IP上网

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#### 内网或外网ip
IPADDR=192.168.1.201

#### 2.1 网关配置
cp /etc/sysconfig/network /etc/sysconfig/network.bak
echo "
NETWORKING=yes
NETWORKING_IPV6=yes
GATEWAY=192.168.1.1
" >> /etc/sysconfig/network

#### 2.2 网卡配置
cp /etc/sysconfig/network-scripts/ifcfg-em1 /etc/sysconfig/network-scripts/ifcfg-em1.bak
sed -i 's/BOOTPROTO=dhcp/BOOTPROTO=none/' /etc/sysconfig/network-scripts/ifcfg-em1
sed -i 's/ONBOOT=no/ONBOOT=yes/' /etc/sysconfig/network-scripts/ifcfg-em1

echo "
BROADCAST=192.168.1.255
IPADDR=$IPADDR
NETWORK=192.168.1.0
" >>/etc/sysconfig/network-scripts/ifcfg-em1

#### 2.3 DNS解析
echo "nameserver 202.103.24.68" >/etc/resolv.conf

#### 2.4 测试
chkconfig | grep network
service network restart
ping www.baidu.com

3. 参考

http://blog.51yip.com/linux/1120.html
https://github.com/iofdata/DM/issues/8

Comments