DHCP

拓扑图:

交换机SW1配置:

<Huawei>system-view 

更改主机名
[Huawei]sysname sw1

创建VLAN
[sw1]vlan batch 10 20

华为Access配置
[sw1]int e0/0/1
[sw1-Ethernet0/0/1]p l a
[sw1-Ethernet0/0/1]p d v 10

[sw1-Ethernet0/0/1]int e0/0/2
[sw1-Ethernet0/0/2]p l a 
[sw1-Ethernet0/0/2]p d v 20

[sw1-Ethernet0/0/2]int e0/0/3
[sw1-Ethernet0/0/3]p l a 
[sw1-Ethernet0/0/3]p d v 10

[sw1-Ethernet0/0/3]int e0/0/4
[sw1-Ethernet0/0/4]p l a
[sw1-Ethernet0/0/4]p d v 20

华为Trunk配置
[sw1-Ethernet0/0/4]int g0/0/1
[sw1-GigabitEthernet0/0/1]p l t
[sw1-GigabitEthernet0/0/1]p t a v 10 20

路由器R1配置:

全局配置模式开启DHCP功能
[R1]dhcp enable 

单臂路由
[R1]int g0/0/1.10      进入子接口   
[R1-GigabitEthernet0/0/1.10]d t v 10            
[R1-GigabitEthernet0/0/1.10]ip add 192.168.10.1 24
[R1-GigabitEthernet0/0/1.10]a b e


[R1-GigabitEthernet0/0/1.10]dhcp select interface         基于基于接口配置DHCP
[R1-GigabitEthernet0/0/1.10]d s d 2.2.2.2 8.8.8.8         配置DNS
[R1-GigabitEthernet0/0/1.10]q

[R1]int g0/0/1.20
[R1-GigabitEthernet0/0/1.20]d t v 20
[R1-GigabitEthernet0/0/1.20]ip add 192.168.20.1 24
[R1-GigabitEthernet0/0/1.20]a b e
[R1-GigabitEthernet0/0/1.20]dhcp select interface 
[R1-GigabitEthernet0/0/1.20]d s d 2.2.2.2 8.8.8.8
[R1-GigabitEthernet0/0/1.20] q

[R1]ip route-static 0.0.0.0 0.0.0.0 12.0.0.2           配默认路由

路由器R2配置:

<Huawei>system-view 
[Huawei]sysname R2

[R2]dhcp enable           进入全局模式   
[R2]ip pool dhcp15      建立DHCP地址池名为15
[R2-ip-pool-dhcp15]gateway-list 15.0.0.1      指定网关
[R2-ip-pool-dhcp15]network 15.0.0.0 mask 255.255.255.0         网段及子网压掩码
[R2-ip-pool-dhcp15]dns-list 2.2.2.2 8.8.8.8
[R2-ip-pool-dhcp15]q
[R2]int g0/0/0
[R2-GigabitEthernet0/0/0]ip add 12.0.0.2 24
[R2-GigabitEthernet0/0/0]int g0/0/1
[R2-GigabitEthernet0/0/1]ip add 15.0.0.1 24
[R2-GigabitEthernet0/0/1]dhcp select global     请求DHCP服务
[R2-GigabitEthernet0/0/1]q

[R2]ip route-static 0.0.0.0 0.0.0.0 12.0.0.1     配默认路由

在PC1进行测试:(全网互通)

释放IP地址
PC>ipconfig /release
Link local IPv6 address...........: fe80::5689:98ff:fea2:5a58
IPv6 address......................: :: / 128
IPv6 gateway......................: ::
IPv4 address......................: 0.0.0.0
Subnet mask.......................: 0.0.0.0
Gateway...........................: 0.0.0.0
Physical address..................: 54-89-98-A2-5A-58
DNS server........................:

重新获取IP地址

PC>ipconfig /renew

IP Configuration
Link local IPv6 address...........: fe80::5689:98ff:fea2:5a58
IPv6 address......................: :: / 128
IPv6 gateway......................: ::
IPv4 address......................: 192.168.10.253
Subnet mask.......................: 255.255.255.0
Gateway...........................: 192.168.10.1
Physical address..................: 54-89-98-A2-5A-58
DNS server........................: 2.2.2.2
                                    8.8.8.8
PC>ping 12.0.0.1

Ping 12.0.0.1: 32 data bytes, Press Ctrl_C to break
From 12.0.0.1: bytes=32 seq=1 ttl=255 time=47 ms
From 12.0.0.1: bytes=32 seq=2 ttl=255 time=16 ms
From 12.0.0.1: bytes=32 seq=3 ttl=255 time=31 ms
From 12.0.0.1: bytes=32 seq=4 ttl=255 time=16 ms
From 12.0.0.1: bytes=32 seq=5 ttl=255 time=31 ms

--- 12.0.0.1 ping statistics ---
  5 packet(s) transmitted
  5 packet(s) received
  0.00% packet loss
  round-trip min/avg/max = 16/28/47 ms

PC>ping 12.0.0.2

Ping 12.0.0.2: 32 data bytes, Press Ctrl_C to break
From 12.0.0.2: bytes=32 seq=1 ttl=254 time=62 ms
From 12.0.0.2: bytes=32 seq=2 ttl=254 time=63 ms
From 12.0.0.2: bytes=32 seq=3 ttl=254 time=47 ms
From 12.0.0.2: bytes=32 seq=4 ttl=254 time=62 ms
From 12.0.0.2: bytes=32 seq=5 ttl=254 time=31 ms

--- 12.0.0.2 ping statistics ---
  5 packet(s) transmitted
  5 packet(s) received
  0.00% packet loss
  round-trip min/avg/max = 31/53/63 ms

PC>ping 15.0.0.1

Ping 15.0.0.1: 32 data bytes, Press Ctrl_C to break
From 15.0.0.1: bytes=32 seq=1 ttl=254 time=62 ms
From 15.0.0.1: bytes=32 seq=2 ttl=254 time=47 ms
From 15.0.0.1: bytes=32 seq=3 ttl=254 time=63 ms
From 15.0.0.1: bytes=32 seq=4 ttl=254 time=62 ms
From 15.0.0.1: bytes=32 seq=5 ttl=254 time=63 ms

--- 15.0.0.1 ping statistics ---
  5 packet(s) transmitted
  5 packet(s) received
  0.00% packet loss
  round-trip min/avg/max = 47/59/63 ms

 

 

 

 

 

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值