三层交换机与路由器对接上网教程
交换机作为网关,实现跨网段转发。同时作为DHCP服务器分配IP。路由器做NAT转换,使用户可以上外网。下面是小编带来的配置过程:
1、配置连接用户的接口和对应的VLANIF接口
system-view
[Huawei]vlan batch 2 3
[Huawei]interface g0/0/2
[Huawei-GigabitEthernet0/0/2]portlink-type access
[Huawei-GigabitEthernet0/0/2]portdefault vlan 2
[Huawei-GigabitEthernet0/0/2]quit
[Huawei]int g0/0/3
[Huawei-GigabitEthernet0/0/3]portlink-type access
[Huawei-GigabitEthernet0/0/3]portdefault vlan 3
[Huawei-GigabitEthernet0/0/3]q
[Huawei]int Vlanif 2
[Huawei-Vlanif2]ip address192.168.1.1 24
[Huawei-Vlanif2]quit
[Huawei]int vlanif 3
[Huawei-Vlanif3]ip address192.168.2.1 24
[Huawei-Vlanif3]quit
2、配置连接路由器的接口和对应的`VLANIF接口
[Huawei]vlan 100
[Huawei-vlan100]int g0/0/1
[Huawei-GigabitEthernet0/0/1]portlink-type access
[Huawei-port-group-default]portdefault vlan 100
[Huawei-port-group-default]quit
[Huawei]int Vlanif 100
[Huawei-Vlanif100]ip address192.168.100.2 24
[Huawei-Vlanif100]quit
3、配置缺省路由(下一跳地址为路由器内网口地址)
[Huawei]iproute-static 0.0.0.0 0.0.0.0 192.168.100.1
4、配置DHCP服务
[Huawei]dhcp enable
[Huawei]
[Huawei]int vlanif 2
[Huawei-Vlanif2]dhcp selectinterface
[Huawei-Vlanif2]dhcp serverdns-list 202.102.128.68 114.114.114.114
[Huawei-Vlanif2]quit
[Huawei]int vlanif 3
[Huawei-Vlanif3]dhcp selectinterface
[Huawei-Vlanif3]dhcp serverdns-list 202.102.128.68 114.114.114.114
[Huawei-Vlanif3]quit
路由器配置(共4步)
1、配置连接交换机的接口对应的IP地址
sys
[Huawei]int g0/0/1
[Huawei-GigabitEthernet0/0/1]ipaddress 192.168.100.1 24
[Huawei-GigabitEthernet0/0/1]quit
2、配置连接公网的接口对应的IP地址
[Huawei]int g0/0/2
[Huawei-GigabitEthernet0/0/2]ipaddress 222.134.95.58 30
[Huawei-GigabitEthernet0/0/2]q
3、配置缺省路由和回程路由(路由器访问内网段192.168.0.0,接口为连接路由器的VLANIF地址)
[Huawei]ip route-static 0.0.0.00.0.0.0 222.134.95.57
[Huawei]ip route-static192.168.0.0 255.255.0.0 192.168.100.2
4、配置NAT转换
[Huawei]acl number 2001
[Huawei-acl-basic-2001]rule 5permit source 192.168.0.0 0.0.255.255
[Huawei-acl-basic-2001]quit
[Huawei]int g0/0/2
[Huawei-GigabitEthernet0/0/2]natoutbound 2001
[Huawei-GigabitEthernet0/0/2]quit
【三层交换机与路由器对接上网教程】相关文章:
8.三层交换机的应用