Huawei
通用命令
display ip interface brief
display current-configuration interface GigabitEthernet x/x/x
# 查看默认路由表
display ip routing-table 0.0.0.0
# 配置路由表
ip route-static <目标IP> <目标子网掩码> <下一跳IP>
交换机
LSW1
# 配置DHCP
system-view
dhcp enable
# 配置VLAN10的DHCP地址池
system-view
ip pool VLAN10
network 192.168.10.0 mask 255.255.255.0
gateway-list 192.168.10.254
dns-list 114.114.114.114 8.8.8.8
# DHCP分配排除地址
excluded-ip-address 192.168.10.1 192.168.10.20
excluded-ip-address 192.168.10.254
quit
# 在 Vlanif10 上启用 DHCP 全局地址池
system-view
interface Vlanif10
dhcp select global
quit
# 查看DHCP配置
display current-configuration interface Vlanif10
display ip pool name VLAN10
# 配置VLAN20的DHCP地址池
ip pool VLAN20
network 192.168.20.0 mask 255.255.255.0
gateway-list 192.168.20.254
dns-list 114.114.114.114 8.8.8.8
excluded-ip-address 192.168.20.1 192.168.20.20
excluded-ip-address 192.168.20.254
quit
# 在 Vlanif20 上启用 DHCP 全局地址池
interface Vlanif20
dhcp select global
quit
# 配置ospf
system-view
ospf 1 router-id 1.1.1.1
area 0.0.0.0
network 10.1.2.0 0.0.0.255
network 192.168.10.0 0.0.0.255
network 192.168.20.0 0.0.0.255
network 192.168.100.0 0.0.0.255
network 192.168.200.0 0.0.0.255
# 把业务 VLAN 设置为静默接口,避免在 PC 网段发送 OSPF 报文
ospf 1
silent-interface Vlanif10
silent-interface Vlanif20
silent-interface Vlanif100
silent-interface Vlanif200
路由器
R1
# 接口配置
system-view
interface GigabitEthernet0/0/3
ip address 10.1.7.1 255.255.255.0
undo shutdown
quit
# 路由表
ip route-static 0.0.0.0 0.0.0.0 10.1.7.2
display ip routing-table 200.10.20.2
# 配置ospf
system-view
ospf 1 router-id 2.2.2.2
area 0.0.0.0
network 10.1.2.0 0.0.0.255
network 10.1.7.0 0.0.0.255
network 10.1.5.0 0.0.0.255
network 10.1.6.0 0.0.0.255
R4
# ospf
system-view
ospf 1 router-id 4.4.4.4
area 0.0.0.0
network 200.10.10.0 0.0.0.255
network 200.10.20.0 0.0.0.255
防火墙
FW3
# 接口配置
system-view
interface GigabitEthernet0/0/1
ip address 10.1.7.2 255.255.255.0
undo shutdown
quit
system-view
interface GigabitEthernet0/0/4
ip address 200.10.10.1 255.255.255.0
undo shutdown
quit
# 安全区域配置
firewall zone trust
add interface GigabitEthernet0/0/1
quit
firewall zone untrust
add interface GigabitEthernet0/0/4
quit
display ip interface brief
display zone
# 接口响应ping
interface GigabitEthernet0/0/1
service-manage ping permit
interface GigabitEthernet0/0/4
service-manage ping permit
# 配置回程路由
system-view
ip route-static 10.1.2.0 255.255.255.0 10.1.7.1
ip route-static 192.168.0.0 255.255.255.0 10.1.7.1
# ospf
system-view
ospf 1 router-id 3.3.3.3
area 0.0.0.0
network 10.1.7.0 0.0.0.255
network 200.10.10.0 0.0.0.255