实验要求:
使用192.168.0.0 24合理规划ip地址
使用DHCP配置pc的ip地址
使用ospf动态路由协议
实现全网可达
实验图中有4台pc,2个二层交换机和两个三层交换机
vlan划分后图中共有五个广播域,192.168.0.0 24借三位可以划分8个子网,使用五个
分别为
192.168.0.0 27
192.168.0.32 27
192.168.0.64 27
192.168.0.96 27
192.168.0.128 27
配置二层交换机LSW3和LSW4
LSW3配置如下
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sys sw3
[sw3]vlan batch 2 3
[sw3]int GigabitEthernet 0/0/2
[sw3-GigabitEthernet0/0/2]port link-type access
[sw3-GigabitEthernet0/0/2]port default vlan 2
[sw3-GigabitEthernet0/0/2]q
[sw3]int g0/0/3
[sw3-GigabitEthernet0/0/3]port link-type access
[sw3-GigabitEthernet0/0/3]port default vlan 2
[sw3-GigabitEthernet0/0/3]q
[sw3]int g0/0/1
[sw3-GigabitEthernet0/0/1]port link-type trunk
[sw3-GigabitEthernet0/0/1]port trunk allow-pass vlan 2 3
<sw3>save
The current configuration will be written to the device.
Are you sure to continue?[Y/N]y
Info: Please input the file name ( *.cfg, *.zip ) [vrpcfg.zip]:
Now saving the current configuration to the slot 0.
Save the configuration successfully.
LSW4配置如下
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sys sw4
[sw4]un in en
Info: Information center is disabled.[sw4]vlan batch 200 300
Info: This operation may take a few seconds. Please wait for a moment...done.
[sw4]int g0/0/2
[sw4-GigabitEthernet0/0/2]port link-type access
[sw4-GigabitEthernet0/0/2]port default vlan 200
[sw4-GigabitEthernet0/0/2]q
[sw4]int g0/0/3
[sw4-GigabitEthernet0/0/3]port link-type access
[sw4-GigabitEthernet0/0/3]port default vlan 300
[sw4-GigabitEthernet0/0/3]q
[sw4]int g0/0/1
[sw4-GigabitEthernet0/0/1]port link-type trunk
[sw4-GigabitEthernet0/0/1]port trunk allow-pass vlan 200 300
[sw4-GigabitEthernet0/0/1]q
<sw4>save
The current configuration will be written to the device.
Are you sure to continue?[Y/N]y
Info: Please input the file name ( *.cfg, *.zip ) [vrpcfg.zip]:
Now saving the current configuration to the slot 0.
Save the configuration successfully.
LSW1配置如下
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sys sw1
[sw1]un in en
Info: Information center is disabled.
[sw1]vlan batch 2 3 100
Info: This operation may take a few seconds. Please wait for a moment...done.[sw1]int Vlanif 2
[sw1-Vlanif2]ip address 192.168.0.33 27
[sw1-Vlanif2]q
[sw1]int Vlanif 3
[sw1-Vlanif3]ip address 192.168.0.65 27
[sw1-Vlanif3]q
[sw1]int Vlanif 100
[sw1-Vlanif100]ip address 192.168.0.1 27
[sw1-Vlanif100]q
[sw1]int g0/0/2
[sw1-GigabitEthernet0/0/2]port link-type trunk
[sw1-GigabitEthernet0/0/2]port trunk allow-pass vlan 2 3
[sw1-GigabitEthernet0/0/2]q
[sw1]int g0/0/1
[sw1-GigabitEthernet0/0/1]port link-type access
[sw1-GigabitEthernet0/0/1]port default vlan 100
[sw1-GigabitEthernet0/0/1]q
[sw1]ospf 1 router-id 1.1.1.1
[sw1-ospf-1]a
[sw1-ospf-1]area 0.0.0.0
[sw1-ospf-1-area-0.0.0.0]network 192.168.0.0 0.0.0.255
[sw1-ospf-1-area-0.0.0.0]q
[sw1-ospf-1]q
[sw1]dhcp enable
Info: The operation may take a few seconds. Please wait for a moment.done.
[sw1]ip pool bf1
Info:It's successful to create an IP address pool.
[sw1-ip-pool-bf1]ne
[sw1-ip-pool-bf1]network 192.168.0.32 mask 255.255.255.224
[sw1-ip-pool-bf1]gateway-list 192.168.0.33
[sw1-ip-pool-bf1]q
[sw1]int v2
[sw1-Vlanif2]dhcp select global
[sw1-Vlanif2]q
<sw1>save
The current configuration will be written to the device.
Are you sure to continue?[Y/N]y
Info: Please input the file name ( *.cfg, *.zip ) [vrpcfg.zip]:
Now saving the current configuration to the slot 0.
Save the configuration successfully.
LSW2配置如下
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sys sw2
[sw2]un in en
Info: Information center is disabled.
[sw2]vlan batch 100 200 300
Info: This operation may take a few seconds. Please wait for a moment...done.
[sw2]int Vlanif 100
[sw2-Vlanif100]ip address 192.168.0.2 27
[sw2-Vlanif100]q
[sw2]int Vlanif 200
[sw2-Vlanif200]ip address 192.168.0.97 27
[sw2-Vlanif200]q
[sw2]int Vlanif 300
[sw2-Vlanif300]ip address 192.168.0.129 27
[sw2-Vlanif300]q
[sw2]int g0/0/1
[sw2-GigabitEthernet0/0/1]port link-type access
[sw2-GigabitEthernet0/0/1]port default vlan 100
[sw2-GigabitEthernet0/0/1]q
[sw2]int g0/0/2
[sw2-GigabitEthernet0/0/2]port link-type trunk
[sw2-GigabitEthernet0/0/2]port trunk allow-pass vlan 200 300
[sw2-GigabitEthernet0/0/2]q
[sw2]ping 192.168.0.1
PING 192.168.0.1: 56 data bytes, press CTRL_C to break
Reply from 192.168.0.1: bytes=56 Sequence=1 ttl=255 time=60 ms
Reply from 192.168.0.1: bytes=56 Sequence=2 ttl=255 time=40 ms
Reply from 192.168.0.1: bytes=56 Sequence=3 ttl=255 time=30 ms
Reply from 192.168.0.1: bytes=56 Sequence=4 ttl=255 time=30 ms
Reply from 192.168.0.1: bytes=56 Sequence=5 ttl=255 time=30 ms--- 192.168.0.1 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 30/38/60 ms
[sw2]ospf 1 router-id 2.2.2.2
[sw2-ospf-1]area 0
[sw2-ospf-1-area-0.0.0.0]network 192.168.0.0 0.0.0.255
[sw2-ospf-1-area-0.0.0.0]q
[sw2-ospf-1]q
[sw2]dhcp enable
Info: The operation may take a few seconds. Please wait for a moment.done.
[sw2]ip pool bf2
Info:It's successful to create an IP address pool.
[sw2-ip-pool-bf2]network 192.168.0.96 mask 255.255.255.224
[sw2-ip-pool-bf2]gateway-list 192.168.0.97
[sw2-ip-pool-bf2]q
[sw2]interface v200
[sw2-Vlanif200]dhcp select global
[sw2-Vlanif200]q
[sw2]q
<sw2>save
The current configuration will be written to the device.
Are you sure to continue?[Y/N]y
Info: Please input the file name ( *.cfg, *.zip ) [vrpcfg.zip]:
Now saving the current configuration to the slot 0.
Save the configuration successfully.