#家庭网络配置(华为路由与交换机)

#家庭网络配置(华为路由与交换机)_第1张图片

 

#家庭网络配置
#三层交换机配置
#打开HDCP功能
#进入系统视图
system-view
#关闭系统提示信息
[Huawei]undo info-center enable 
#打开DHCP 使能
[Huawei]dhcp enable
#创建vlan 10 vlan 20 vlan 2 
[Huawei]vlan batch 2 10 20
#进入 vlan 并配置ip 与 dhcp 
[Huawei]int vlan 10 
[Huawei-Vlanif10]ip address 192.168.10.254 24
[Huawei-Vlanif10]dhcp select interface 
[Huawei]int vlan 20 
[Huawei-Vlanif20]ip address 192.168.20.254 24
[Huawei-Vlanif20]dhcp select interface 
[Huawei]int vlan 2
[Huawei-Vlanif20]ip address 192.168.20.254 24
#配置端口类型并加入对应的vlan 
[Huawei]int g0/0/1
[Huawei-GigabitEthernet0/0/1]port link-type access
[Huawei-GigabitEthernet0/0/1]port default vlan 10
[Huawei]int g0/0/2
[Huawei-GigabitEthernet0/0/2]port link-type access
[Huawei-GigabitEthernet0/0/2]port default vlan 20
[Huawei]int g0/0/3
[Huawei-GigabitEthernet0/0/3]port link-type access
[Huawei-GigabitEthernet0/0/3]port default vlan 2
#配置静态路由表 0.0.0.0 0.0.0.0 为缺省路由,192.168.1.1为下一跳路由器端口IP地址
[Huawei] ip route-static 0.0.0.0 0.0.0.0 192.168.1.1

#一层路由配置
system-view
#关闭系统提示信息
[Huawei]undo info-center enable 
#配置端口ip
[Huawei]int g0/0/0
[Huawei-GigabitEthernet0/0/0]ip address 192.168.1.1 24
[Huawei]int g0/0/1
[Huawei-GigabitEthernet0/0/1]ip address 100.1.1.2 24
[Huawei]ip route-static 0.0.0.0 0.0.0.0 100.1.1.1
[Huawei]ip route-static 192.168.10.0 255.255.255.0 192.168.1.2
[Huawei]ip route-static 192.168.20.0 255.255.255.0 192.168.1.2

#二层路由
system-view
#关闭系统提示信息
[Huawei]undo info-center enable 
#配置端口ip
[Huawei]int g0/0/0
[Huawei-GigabitEthernet0/0/0]ip address 100.1.1.1 24
#创建环回端口并配置IP地址 
[Huawei]interface LoopBack0
 [Huawei-LoopBack0]ip address 114.114.114.114 24
#添加静态环回路由表
[Huawei]ip route-static 192.168.10.0 255.255.255.0 192.168.1.2
[Huawei]ip route-static 192.168.10.0 255.255.255.0 100.1.1.2
[Huawei]ip route-static 192.168.20.0 255.255.255.0 100.1.1.2

#家庭网络配置(华为路由与交换机)_第2张图片

 

你可能感兴趣的:(华为)