DHCP中继配置
Posted tanxiaojuncom
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了DHCP中继配置相关的知识,希望对你有一定的参考价值。
中继
1、[root@localhost ~]# mkdir /media/cdrom //新建目录
2、[root@localhost ~]# mount /dev/cdrom /media/cdrom //挂载镜像
3、[root@localhost ~]# rpm -ivh /media/cdrom/Packages/dhcp-4.2.5-36.el7.centos.x86_64.rpm //rpm安装dhcp
4、[root@localhost ~]# vim /etc/sysconfig/network-scripts/ifcfg-eno16777736 //编辑第一个网卡的配置文件
BOOTPROTO="static" //手动更改模式
DEFROUTE="yes"
PEERDNS="yes"
PEERROUTES="yes"
IPV4_FAILURE_FATAL="no"
IPV6INIT="yes"
IPV6_AUTOCONF="yes"
IPV6_DEFROUTE="yes"
IPV6_PEERDNS="yes"
IPV6_PEERROUTES="yes"
IPV6_FAILURE_FATAL="no"
NAME="eno16777736"
ONBOOT="yes"
IPADDR=192.168.153.128 //配置当前网卡所匹配的ip
NETMASK=255.255.255.0 //配置子网掩码
~
5、[root@localhost ~]# cp /etc/sysconfig/network-scripts/ifcfg-eno16777736 /etc/sysconfig/network-scripts/ifcfg-eno33554984
6、[root@localhost ~]# vim /etc/sysconfig/network-scripts/ifcfg-eno33554984 //修改第二个网卡的配置文件
TYPE="Ethernet"
BOOTPROTO="static"
DEFROUTE="yes"
PEERDNS="yes"
PEERROUTES="yes"
IPV4_FAILURE_FATAL="no"
IPV6INIT="yes"
IPV6_AUTOCONF="yes"
IPV6_DEFROUTE="yes"
IPV6_PEERDNS="yes"
IPV6_PEERROUTES="yes"
IPV6_FAILURE_FATAL="no"
NAME="eno33554984"
DEVICE="eno33554984"
ONBOOT="yes"
IPADDR=192.168.203.12
NETMASK=255.255.255.0
~
~
7、[root@localhost ~]# systemctl restart network //重启网络
8、[root@localhost ~]# rpm -ql dhcp //查看关于dhcp的指定软件包
9、[root@localhost ~]# vim /etc/sysctl.conf //编辑虚拟机的交换功能
10、[root@localhost ~]# sysctl -p //开启交换功能
net.ipv4.ip_forward = 1
11、[root@localhost ~]# systemctl restart network //重启网络服务
服务器
1、[root@localhost ~]# mkdir /media/cdrom
2、[root@localhost ~]# mount /dev/cdrom /media/cdrom
3、[root@localhost ~]# rpm -ivh /media/cdrom/Packages/dhcp-4.2.5-36.el7.centos.x86_64.rpm
4、[root@localhost ~]# vim /etc/dhcp/dhcpd.conf //编辑安装dhcp
option domain-name-servers 202.106.0.20,8.8.8.8 ; //DNS服务器
max-lease-time 720000; //最长租约
subnet 192.168.153.0 netmask 255.255.255.0 //定义分配IP地址网段子网掩码
range 192.168.153.10 192.168.153.110; //该网段的IP地址池范围
option routers 192.168.153.1; //路由网关
subnet 192.168.203.0 netmask 255.255.255.0
range 192.168.203.10 192.168.203.110;
option routers 192.168.203.1;
HWADDR=00:0C:29:5B:BC:69
TYPE=Ethernet
UUID=b83f3f70-f409-4ae4-b176-9b3636b89664
ONBOOT=yes
NM_CONTROLLED=yes
BOOTPROTO=dhcp
IPADDR=192.168.153.131
NETMASK=255.255.255.0
GATEWAY=192.168.153.128 //与服务器同一网段的ip地址作为网关
以上是关于DHCP中继配置的主要内容,如果未能解决你的问题,请参考以下文章