使用华为交换机打出每台设备的详细配置并完成pdf中内容
时间: 2025-01-27 17:07:09 浏览: 41
为了完成《综合实验.pdf》中的配置任务,以下是针对各设备(包括PC、交换机、路由器)的具体配置命令:
### PC 配置
#### PC1
```shell
ip address 192.168.10.1 255.255.255.0
default gateway 192.168.10.254
```
#### PC2
```shell
ip address 192.168.10.2 255.255.255.0
default gateway 192.168.10.254
```
#### PC3
```shell
ip address 192.168.40.3 255.255.255.0
default gateway 192.168.40.254
```
#### PC4
```shell
ip address 192.168.50.4 255.255.255.0
default gateway 192.168.50.254
```
### 交换机配置
#### SW3
```shell
interface Vlanif10
ip address 192.168.10.3 255.255.255.0
exit
interface Vlanif20
ip address 192.168.20.3 255.255.255.0
exit
vlan batch 10 20
interface GigabitEthernet0/0/1
port link-type trunk
port trunk allow-pass vlan 10 20
exit
interface GigabitEthernet0/0/2
port link-type trunk
port trunk allow-pass vlan 10 20
exit
vrrp vrid 1 virtual-ip 192.168.10.254
vrrp vrid 1 priority 120
vrrp vrid 1 preempt-mode timer delay 20
```
#### SW4
```shell
interface Vlanif10
ip address 192.168.10.4 255.255.255.0
exit
interface Vlanif30
ip address 192.168.30.4 255.255.255.0
exit
vlan batch 10 30
interface GigabitEthernet0/0/1
port link-type trunk
port trunk allow-pass vlan 10 30
exit
interface GigabitEthernet0/0/2
port link-type trunk
port trunk allow-pass vlan 10 30
exit
vrrp vrid 1 virtual-ip 192.168.10.254
vrrp vrid 1 priority 100
vrrp vrid 1 preempt-mode timer delay 20
```
### 路由器配置
#### AR1
```shell
interface GigabitEthernet0/0/0
ip address 192.168.20.1 255.255.255.0
exit
interface GigabitEthernet0/0/1
ip address 10.1.12.1 255.255.255.0
exit
interface GigabitEthernet0/0/2
ip address 192.168.30.1 255.255.255.0
exit
ospf 1 router-id 1.1.1.1
area 0
network 10.1.12.0 0.0.0.255
network 192.168.20.0 0.0.0.255
network 192.168.30.0 0.0.0.255
exit
area 1
network 192.168.10.0 0.0.0.255
exit
```
#### AR2
```shell
interface GigabitEthernet0/0/0
ip address 10.1.12.2 255.255.255.0
exit
interface GigabitEthernet0/0/1.40
encapsulation dot1Q 40
ip address 192.168.40.254 255.255.255.0
exit
interface GigabitEthernet0/0/1.50
encapsulation dot1Q 50
ip address 192.168.50.254 255.255.255.0
exit
ospf 1 router-id 2.2.2.2
area 0
network 10.1.12.0 0.0.0.255
exit
```
### 验证配置
1. **查看 VRRP 组状态**
```shell
display vrrp
```
- 在 SW3 上应显示 `Master` 状态
- 在 SW4 上应显示 `Backup` 状态
2. **查看 AR2 路由表中特定路由 192.168.10.1 的表项**
```shell
display ip routing-table | include 192.168.10.1
```
以上配置确保了总部和分部之间的互联互通,并实现了 VRRP 协议的网关冗余。
阅读全文
相关推荐


















