命令代码行

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
30
31
32
//编辑网卡文件  
vi etc / sysconfig / network - scripts / ifcfg -ens33
//添加或更改以下内容:

IPADDR =192.168.222.137#本机 IP 地址
NETMASK =255.255.255.0#子网掩码
GATEWAY =192.168.222.2#默认网关
BOOTPROTO = static //设置IP为静态IP

//启用网络服务
sistenctl start network

//查看 IP
ifonfig

//临时关闭防火墙、 SELinux
iptables -f #临时关闭防火墙
setenforce o #临时关闭SELinux

//安装DHCP
yum -y install dhcp
mount /dev/src/mnt
cd /etc/yum.repos.d
mv Centos-Base.repo Centos-Base-repo.bak

//修改配置文件
locate dhcpd.conf (没有则用yum安装 yum -y install mlocate)

vi /etc/dhcp/dhcpd/conf
cp /usr/share/doc/dhcp*/dhcp.conf.example /etc/dhcp/dhcpd.conf

systemctl dhcpd