Set up DHCP relay service, trunk link configuration

Experiment content : GNS3 in analog implementation of DHCP relay service

Experimental environment: server a Linux system as a DHCP server, dhcp package is installed, the card is only the host mode, the binding vmnet1

                   Two win10 client system, the card is only the host mode. Respectively binding vmnet2 and vmnet8

                   GNS3 virtual network software

experiment procedure:

(A), open Linux configuration. In the first vmnet8 nat network mode will DHCPF service is installed on a Linux system, then switch to custom mode bindings vmnet1. Configure a static IP, DHCP server configuration.

1, with the yum package repository to download and install DHCP

[Root @ localhost ~] # yum install dhcp -y install DHCP package

image.png

2, custom mode is switched to the binding vmnet1

image.png

3, configure a static IP, and restart network services

[Root @ localhost ~] # vim / etc / sysconfig / network-scripts / ifcfg-ens33 change the configuration of static IP

image.png

image.png

image.png

4, the dhcp server, the file is empty at this time of DHCP service, you need to copy and use templates to find the DHCP configuration file, and then configure the DHCP service on the configuration is complete.

[Root @ localhost ~] # rpm -qc dhcp dhcp see the main configuration file path

[Root @ localhost ~] # cp /usr/share/doc/dhcp-4.2.5/dhcpd.conf.example /etc/dhcp/dhcpd.conf the dhcp main configuration file templates to cover their own dhcp file directory

[Root @ localhost ~] # vim /etc/dhcp/dhcpd.conf the dhcp service

[root@localhost ~]# systemctl start dhcpd            启动dhcpd服务

image.png



image.png

image.png

image.pngimage.png

image.png

(二)、将win10-1和win10-2切换为自定义并分别绑定vmnet2和vmnet8

1、wein10-1绑定vmnet2

image.png

2、关闭vmnet8的联网功能,及dhcp功能

image.png

3、将win10-2改为自定义模式,绑定vmnet8

image.png

(三)、在GNS3中搭建服务架构,对其中的设备进行配置

1、打开GNS3配置拓扑图,布置两台win10主机,一台dhcp服务器(Linux),一台二层交换机,一台三层交换机

2,将设备相互连接如下:

win1的vmnet2连接到sw2的f1/2

win2的vmnet8连接到sw2的f1/3

dhcp的vmnet1连接到sw2的f1/1

sw2的f1/0连接到sw3的f1/0

设置完成并全部开启,并显示端口号

image.png

3,双击打开sw2对二层交换进行vlan划分

win10-1:vlan10 192.168.10.1/24

win10-2:vlan20 192.168.20.1/24

dhcp:vlan100 192.168.100.1/24

双击打开sw2进行配置vlan

f1/1:vlan100

f1/2:vlan10

f1/3:vlan20

sw2#configure terminal  进入全局模式 

sw2(config)#vlan 10,20,100   创建三个vlan

sw2(config-vlan)#ex  退出vlan 

sw2(config)#do show vlan-switch brief  查看创建的vlan的信息

image.png

sw2(config)#interface f1/1          进入f1/1的接口模式

sw2(config-if)#switch mod access    设置access模式 

sw2(config-if)#switch access vlan 100  将端口分配给vlan100中 

sw2(config-if)#ex sw2(config)#interface f1/2          设置f1/2的接口模式 

sw2(config-if)#switch mod access 

sw2(config-if)#switch access vlan 10 

sw2(config-if)#ex sw2(config)#interface f1/3          设置f1/3的接口模式 

sw2(config-if)#switch mod access 

sw2(config-if)#switch access vlan 20 

sw2(config-if)#ex sw2(config)#do show vlan-sw b   查看vlan的划分信息

image.png

sw2(config)#interface f1/0   进入f1/0接口 

sw2(config-if)#switch mod trunk   设置中继链路模式 

sw2(config-if)#switch trunk encapsulation dot1q   选择封装类型为dot1q 

sw2(config-if)#ex 

sw2(config)#no ip routing   关闭路由功能 

sw2(config)#do show int f1/0 switchport  查看接口f1/0的接口信息

image.png

image.png

4、双击打开sw3三层交换进行配置

创建三个vlan10,20,100

将f1/0接口设置为trunk链路

设置vlan10的网关子网掩码192.168.10.1 255.255.255.0

设置vlan20的网关子网掩码192.168.20.1 255.255.255.0

设置vlan100的网关子网掩码 192.168.100.1 255.255.255.0

sw3#configure terminal  进入全局模式 

sw3(config)#vlan 10,20,100   创建三个vlan

sw3(config-vlan)#ex  退出vlan 

sw3(config)#do show vlan-switch brief  查看创建的vlan的信息

image.png

sw3(config)#interface f1/0   进入f1/0接口 

sw3(config-if)#switch mod trunk   设置中继链路模式 

sw3(config-if)#switch trunk encapsulation dot1q   选择封装类型为dot1q 

sw3(config-if)#ex 

sw3(config)#do show int f1/0 switchport  查看接口f1/0的接口信息

image.png

w3(config)#int vlan 10                进入vlan10 

sw3(config-if)#ip add 192.168.10.1 255.255.255.0  设置vlan10的网关及子网掩码 

sw3(config-if)#no shut   开启vlan10 

sw3(config-if)#ex 

sw3(config)#int vlan 20    设置vlan20  

sw3(config-if)#ip add 192.168.20.1 255.255.255.0 

sw3(config-if)#no shut 

sw3(config-if)#ex 

sw3(config)#int vlan 100   设置vlan100 

sw3(config-if)#ip add 192.168.100.1 255.255.255.0 

sw3(config-if)#no shut

image.png

sw3(config-if)#end     退出全局模式

sw3#show ip interface brief     查看vlan设置情况

image.png

image.png

(四)在网关中配置DHCP中继

w3#conf t  进入全局模式 

sw3(config)#int vlan 10     设置网关中的DHCP中继 

sw3(config-if)#ip helper-address 192.168.100.100 

sw3(config-if)#no shut 

sw3(config-if)#ex 

sw3(config)#int vlan 20 

sw3(config-if)#ip helper-address 192.168.100.100 

sw3(config-if)#no shut 

sw3(config-if)#ex 

sw3(config)#int vlan 100 

sw3(config-if)#ip helper-address 192.168.100.100 

sw3(config-if)#no shut

image.png

(E), open to see if the two hosts can obtain an IP address automatically segment 10/20

1, open win10-1 enter cmd Type ipconfig, see the IP address

image.png

2, open win10-2 enter cmd Type ipconfig, see the IP address

image.png


DHCP relay service set up the experiment.

Guess you like

Origin blog.51cto.com/14475876/2434886