實驗對象:一臺路由器、一臺交換機、兩臺PC機
實驗環境:eNSP
實驗原理: interface eth-trunk 1.10
dot1q termination vid 10(該接口屬於vlan10)
ip add 192.168.10.1 24
arp broadcast enable(開啓arp廣播)css
注意:在生產環境中,要先查看版本,保存信息,而後根據當前環境肯定是否須要升級系統,這是個好習慣linux
R1服務器
The device is running! <Huawei>system-view Enter system view, return user view with Ctrl+Z. [Huawei]sysname R1 [R1]un in en Info: Information center is disabled. [R1]int Eth-Trunk 1 [R1-Eth-Trunk1]trunkport g 0/0/1 to 0/0/2 [R1-Eth-Trunk1]q [R1]int Eth-Trunk 1.10 [R1-Eth-Trunk1.10]dot1q termination vid 10 [R1-Eth-Trunk1.10]ip add 192.168.10.1 24 [R1-Eth-Trunk1.10]un sh Info: Interface Eth-Trunk1.10 is not shutdown. [R1-Eth-Trunk1.10]arp broadcast enable [R1-Eth-Trunk1.10]un sh Info: Interface Eth-Trunk1.10 is not shutdown. [R1-Eth-Trunk1.10]q [R1]int Eth-Trunk 1.20 [R1-Eth-Trunk1.20]dot1q termination vid 20 [R1-Eth-Trunk1.20]ip add 192.168.20.1 24 [R1-Eth-Trunk1.20]a b e [R1-Eth-Trunk1.20]un sh Info: Interface Eth-Trunk1.20 is not shutdown. [R1-Eth-Trunk1.20]q [R1]
LSW3網絡
The device is running! <Huawei>system-view Enter system view, return user view with Ctrl+Z. [Huawei]sysname SW1 [SW1]un in en Info: Information center is disabled. [SW1]int e 0/0/2 [SW1-Ethernet0/0/2]q [SW1]vlan bat 10 20 Info: This operation may take a few seconds. Please wait for a moment...done. [SW1]int e 0/0/2 [SW1-Ethernet0/0/2]p l a [SW1-Ethernet0/0/2]p d v 20 [SW1-Ethernet0/0/2]un sh Info: Interface Ethernet0/0/2 is not shutdown. [SW1-Ethernet0/0/2]int e 0/0/3 [SW1-Ethernet0/0/3]p l a [SW1-Ethernet0/0/3]p d v 10 [SW1-Ethernet0/0/3]un sh Info: Interface Ethernet0/0/3 is not shutdown. [SW1-Ethernet0/0/3]q [SW1]int Eth-Trunk 1 [SW1-Eth-Trunk1]trunkport g 0/0/1 to 0/0/2 Info: This operation may take a few seconds. Please wait for a moment...done. [SW1-Eth-Trunk1]p l t [SW1-Eth-Trunk1]p t a v a [SW1-Eth-Trunk1]un sh Info: Interface Eth-Trunk1 is not shutdown. [SW1-Eth-Trunk1]
PC配置
ide
須要的環境安裝在以前的博客說起,須要瞭解的能夠去看
實驗對象:兩臺路由器,一臺交換機,五臺PC機
實驗環境:eNSP
實驗原理:華爲設備的DHCP基本原理
第一步:客戶端經過廣播發送DHCP Discover 報文尋服務器端
第二步:服務器端經過單播發送DHCP Offer 報文向客戶端提供IP地址等網絡信息
第三步:客戶端經過廣播DHCP Request 報文告知服務器端本地選擇使用哪一個IP地址
第四步:服務器經過DHCP Ack報文告知客戶端IP地址是合法可用的
其中是兩個廣播,兩個單播,與linux的dhcp原理不一樣
實驗拓撲:
LSW1this
The device is running! <Huawei> <Huawei>sys <Huawei>system-view Enter system view, return user view with Ctrl+Z. [Huawei]sysn [Huawei]sysname SW1 [SW1]int e 0/0/1 [SW1-Ethernet0/0/1]p l a [SW1-Ethernet0/0/1]p d v 10 Error: The VLAN does not exist. [SW1-Ethernet0/0/1]q [SW1]vlan bat 10 20 Info: This operation may take a few seconds. Please wait for a moment...done. [SW1]int e0/0/1 [SW1-Ethernet0/0/1]p d v 10 [SW1-Ethernet0/0/1]un sh Info: Interface Ethernet0/0/1 is not shutdown. [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]un sh Info: Interface Ethernet0/0/2 is not shutdown. [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]un sh Info: Interface Ethernet0/0/3 is not shutdown. [SW1-Ethernet0/0/3]int e0/0/4 [SW1-Ethernet0/0/4]p l a [SW1-Ethernet0/0/4]p d v 20 [SW1-Ethernet0/0/4]un sh Info: Interface Ethernet0/0/4 is not shutdown. [SW1-Ethernet0/0/4]un sh Info: Interface Ethernet0/0/4 is not shutdown. [SW1-Ethernet0/0/4]int e0/0/1 [SW1-Ethernet0/0/1] p l t Error: Please renew the default configurations. [SW1-Ethernet0/0/1]dis this # interface Ethernet0/0/1 port link-type access port default vlan 10 # return [SW1-Ethernet0/0/1]int g0/0/1 [SW1-GigabitEthernet0/0/1]p l t [SW1-GigabitEthernet0/0/1]port t a v a [SW1-GigabitEthernet0/0/1]un sh Info: Interface GigabitEthernet0/0/1 is not shutdown.
R1 ————使用子接口模式配置dhcp3d
The device is running! <Huawei>sys <Huawei>system-view Enter system view, return user view with Ctrl+Z. [Huawei]sys [Huawei]sysname R1 [R1]dhcp enable Info: The operation may take a few seconds. Please wait for a moment.done. [R1]vlan bat 10 20 Info: This operation may take a few seconds. Please wait for a moment...done. [R1] [R1]int g0/0/1.10 [R1-GigabitEthernet0/0/1.10] [R1-GigabitEthernet0/0/1.10]dot1q termination vid 10 [R1-GigabitEthernet0/0/1.10]ip address 192.168.10.1 24 [R1-GigabitEthernet0/0/1.10] Dec 10 2019 17:09:57-08:00 R1 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP on the interface GigabitEthernet0/0/1.10 has entered the UP state. [R1-GigabitEthernet0/0/1.10]display this # interface GigabitEthernet0/0/1.10 dot1q termination vid 10 ip address 192.168.10.1 255.255.255.0 # return [R1-GigabitEthernet0/0/1.10]a b e [R1-GigabitEthernet0/0/1.10]dis this # interface GigabitEthernet0/0/1.10 dot1q termination vid 10 ip address 192.168.10.1 255.255.255.0 arp broadcast enable # return [R1-GigabitEthernet0/0/1.10] [R1-GigabitEthernet0/0/1.10]un sh Info: Interface GigabitEthernet0/0/1.10 is not shutdown. [R1-GigabitEthernet0/0/1.10]int g0/0/1.20 [R1-GigabitEthernet0/0/1.20]dot1q te vid 20 [R1-GigabitEthernet0/0/1.20]ip address 192.168.20.1 24 [R1-GigabitEthernet0/0/1.20] Dec 10 2019 17:11:21-08:00 R1 %%01IFNET/4/LINK_STATE(l)[1]:The line protocol IP on the interface GigabitEthernet0/0/1.20 has entered the UP state. [R1-GigabitEthernet0/0/1.20]a b e [R1-GigabitEthernet0/0/1.20]un sh Info: Interface GigabitEthernet0/0/1.20 is not shutdown. [R1-GigabitEthernet0/0/1.20]q [R1]int g0/0/1.10 [R1-GigabitEthernet0/0/1.10]dhcp select interface [R1-GigabitEthernet0/0/1.10]dhcp server dns-list 2.2.2.2 8.8.8.8 [R1-GigabitEthernet0/0/1.10]q [R1]int g0/0/1.20 [R1-GigabitEthernet0/0/1.20]dhcp select interface [R1-GigabitEthernet0/0/1.20]dhcp server dns-list 2.2.2.2 8.8.8.8 [R1-GigabitEthernet0/0/1.20]q [R1]int g0/0/3 [R1-GigabitEthernet0/0/3]ip add 12.0.0.1 24 Dec 10 2019 17:14:41-08:00 R1 %%01IFNET/4/LINK_STATE(l)[2]:The line protocol IP on the interface GigabitEthernet0/0/3 has entered the UP state. [R1-GigabitEthernet0/0/3]un sh Info: Interface GigabitEthernet0/0/3 is not shutdown. [R1-GigabitEthernet0/0/3]q [R1]ip route-static 0.0.0.0 0.0.0.0 12.0.0.2
R2 ————全局配置模式配置pool dhcp地址池code
The device is running! <Huawei>sys <Huawei>system-view Enter system view, return user view with Ctrl+Z. [Huawei]sys [Huawei]sysname R2 [R2]int g 0/0/3 [R2-GigabitEthernet0/0/3]ip add 12.0.0.2 24 [R2-GigabitEthernet0/0/3] Dec 10 2019 17:18:53-08:00 R2 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP on the interface GigabitEthernet0/0/3 has entered the UP state. [R2-GigabitEthernet0/0/3]un sh Info: Interface GigabitEthernet0/0/3 is not shutdown. [R2-GigabitEthernet0/0/3]int g 0/0/0 [R2-GigabitEthernet0/0/0]ip add 15.0.0.1 24 [R2-GigabitEthernet0/0/0]un sh Info: Interface GigabitEthernet0/0/0 is not shutdown. [R2]ip pool 15 Info:It's successful to create an IP address pool. [R2-ip-pool-15]network 15.0.0.0 mask 24 [R2-ip-pool-15]gateway-list 15.0.0.1 [R2-ip-pool-15]dns-list 8.8.8.8 2.2.2.2 [R2-ip-pool-15]q [R2]int e0/0/0 [R2-Ethernet0/0/0]dis this # interface Ethernet0/0/0 # return [R2-Ethernet0/0/0]int g 0/0/0 [R2-GigabitEthernet0/0/0]dis this # interface GigabitEthernet0/0/0 ip address 15.0.0.1 255.255.255.0 # return [R2-GigabitEthernet0/0/0]undo ip address 15.0.0.1 255.255.255.0 dis this # interface GigabitEthernet0/0/0 # return [R2-GigabitEthernet0/0/0]int e0/0/0 [R2-Ethernet0/0/0]ip add 15.0.0.1 24 Dec 10 2019 17:25:03-08:00 R2 %%01IFNET/4/LINK_STATE(l)[1]:The line protocol IP on the interface Ethernet0/0/0 has entered the UP state. [R2-Ethernet0/0/0]un sh Info: Interface Ethernet0/0/0 is not shutdown. [R2-Ethernet0/0/0]dhcp select global Error: Please enable DHCP in the global view first. [R2-Ethernet0/0/0]q Info: The operation may take a few seconds. Please wait for a moment.done. [R2]dhcp enable [R2]int e0/0/0 [R2-Ethernet0/0/0]dhcp select global [R2-Ethernet0/0/0]q [R2]ip route-static 192.168.0.0 16 12.0.0.1
在PC機中獲取ip地址
orm
PC之間互ping
server