DHCP工作原理、中继DHCP部署

DHCP的工作原理。

DHCP(Dynamic Host Configuration Protocol,动态主机配置协议)

由Intelent工作任务小组设计开发

专用于为TCP/IP网络中的计算机自动分配TCP/IP参数的协议

使用DHCP的好处。

  1. 减少管理员的工作量
  2. 避免输入错误的可能
  3. 避免IP地址冲突
  4. 当更改IP地址段时,不需要重新配置每个用户的IP地址
  5. 提高了IP地址的利用率
  6. 方便客户端的配置

DHCP使用的协议和端口号。

TCP协议 客户机:67 服务器:68

DHCP在linux下的部署过程。

 1、安装DHCP服务

       rpm –ivh /mnt/Packages/dhcp-4.2.5-58.el7.centos.x86_64.rpm

       3、配置dhcp的配置文件

    

       4、启动DHCP服务

       systemctl start dhcpd

       netstat –anpu | grep dhcpd

       5、客户端设置为dhcp启动

       Vi /etc/sysconfig/network-scripts/ifcfg-ens33

       DEVICE=ens33

       ONBOOT=yes

       BOOTPROTO=dhcp

       6、客户机设置ens33网卡dhcp获取地址

       dhclient –d ens33

       7、服务器查看客户机获取地址的情况

       less /var/lib/dhcpd/dhcpd.leases

       8、客户机设置ens33网卡释放获取到的地址

       dhclient –r ens33

DHCP中继实验拓扑如下,用华为模拟器完成。

<SW1>display current-configuration

#

sysname SW1

#

vlan batch 10 20 100

#

cluster enable

ntdp enable

ndp enable

#

drop illegal-mac alarm

#

diffserv domain default

#

drop-profile default

#

aaa

 authentication-scheme default

 authorization-scheme default

 accounting-scheme default

 domain default

 domain default_admin

 local-user admin password simple admin

 local-user admin service-type http

#

interface Vlanif1

#

interface MEth0/0/1

#

interface Ethernet0/0/1

 port link-type access

 port default vlan 10

#

interface Ethernet0/0/2

 port link-type access

 port default vlan 20

#

interface Ethernet0/0/3

 port link-type access

 port default vlan 100

interface GigabitEthernet0/0/1

 port link-type trunk

 port trunk allow-pass vlan 2 to 4094

#

interface GigabitEthernet0/0/2

#

interface NULL0

#

user-interface con 0

 idle-timeout 0 0

user-interface vty 0 4

#

return

<SW1>

#

sysname SW2

#

vlan batch 10 20 100

#

ntdp enable

ndp enable

#

dhcp enable

#

diffserv domain default

#

drop-profile default

#

aaa

 authentication-scheme default

 authorization-scheme default

 accounting-scheme default

 domain default

 domain default_admin

 local-user admin password simple admin

 local-user admin service-type http

#

interface Vlanif1

#

interface Vlanif10

 ip address 192.168.1.1 255.255.255.0

 dhcp select relay

 dhcp relay server-ip 192.168.100.100

#

interface Vlanif20

 ip address 192.168.2.1 255.255.255.0

 dhcp select relay

 dhcp relay server-ip 192.168.100.100

#

interface Vlanif100

 ip address 192.168.100.1 255.255.255.0

#

interface MEth0/0/1

#

interface GigabitEthernet0/0/1

 port link-type trunk

 port trunk allow-pass vlan 2 to 4094

#

ospf 1

 area 0.0.0.0

  network 192.168.1.0 0.0.0.255

  network 192.168.2.0 0.0.0.255

  network 192.168.100.0 0.0.0.255

#

user-interface con 0

 idle-timeout 0 0

user-interface vty 0 4

#

return

[SW2]

#

sysname R1

#

dhcp enable

#

ip pool dhcp1

 gateway-list 192.168.1.1

 network 192.168.1.0 mask 255.255.255.0

 lease day 7 hour 0 minute 0

 dns-list 2.2.2.2 4.4.4.4

#

ip pool dhcp2

 gateway-list 192.168.2.1

 network 192.168.2.0 mask 255.255.255.0

 lease day 7 hour 0 minute 0

 dns-list 2.2.2.2 4.4.4.4

#

aaa

 authentication-scheme default

 authorization-scheme default

 accounting-scheme default

 domain default

 domain default_admin

 local-user admin password cipher OOCM4m($F4ajUn1vMEIBNUw#

 local-user admin service-type http

#

firewall zone Local

 priority 16

#

interface Ethernet0/0/0

 ip address 192.168.100.100 255.255.255.0

ospf 1 router-id 192.168.100.100

 area 0.0.0.0

  network 192.168.1.0 0.0.0.255

  network 192.168.2.0 0.0.0.255

  network 192.168.100.0 0.0.0.255

#

user-interface con 0

 idle-timeout 0 0

user-interface vty 0 4

user-interface vty 16 20

#

return

[R1] int e0/0/0

[R1-Ethernet0/0/0]dhcp se

[R1-Ethernet0/0/0]dhcp select gl

[R1-Ethernet0/0/0]dhcp select global

[R1-Ethernet0/0/0]qu

[R1]dis

[R1]display cu

[R1]display current-configuration

#

sysname R1

#

dhcp enable

#

ip pool dhcp1

 gateway-list 192.168.1.1

 network 192.168.1.0 mask 255.255.255.0

 lease day 7 hour 0 minute 0

 dns-list 2.2.2.2 4.4.4.4

#

ip pool dhcp2

 gateway-list 192.168.2.1

 network 192.168.2.0 mask 255.255.255.0

 lease day 7 hour 0 minute 0

 dns-list 2.2.2.2 4.4.4.4

#

aaa

 authentication-scheme default

 authorization-scheme default

 accounting-scheme default

 domain default

 domain default_admin

 local-user admin password cipher OOCM4m($F4ajUn1vMEIBNUw#

 local-user admin service-type http

#

firewall zone Local

 priority 16

#

interface Ethernet0/0/0

 ip address 192.168.100.100 255.255.255.0

 dhcp select global

#

interface Ethernet0/0/1

#

interface Serial0/0/0

 link-protocol ppp

#

interface Serial0/0/1

 link-protocol ppp

#

interface Serial0/0/2

 link-protocol ppp

#

interface Serial0/0/3

 link-protocol ppp

#

interface GigabitEthernet0/0/0

#

interface GigabitEthernet0/0/1

#

interface GigabitEthernet0/0/2

#

interface GigabitEthernet0/0/3

#

wlan

#

interface NULL0

#

ospf 1 router-id 192.168.100.100

 area 0.0.0.0

  network 192.168.1.0 0.0.0.255

  network 192.168.2.0 0.0.0.255

  network 192.168.100.0 0.0.0.255

#

user-interface con 0

 idle-timeout 0 0

user-interface vty 0 4

user-interface vty 16 20

#

return

[R1]

PC1DHCP获取

PC2DHCP获取

FTP的使用场合。

用于文件的传输

FTP的作用。

用于文件的上传和下载

FTP使用的协议和端口号。

TCP协议,端口号20,21

FTP的匿名用户和基本用户的部署过程。

匿名用户部署过程:

  1. 部署实验环境

2.配置文件修改

登录成功上传和下载文件测试

本地用户配置

 验证服务是否成功

lisi用户不可登录

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值