三層交換機 S5500與 路由器ER5200G2 相關配置bash
設定3個VLAN VLAN十、 VLAN20、 VLAN30tcp
VLAN10與VLAN30相互互通、可是與VLAN20不通ide
項目需求三層交換機 建立三個VLAN oop
vlan 10 :192.168.10.1 255.255.255.0ui
vlan 20 :192.168.20.1 255.255.255.0spa
vlan 30 :192.168.30.1 255.255.255.0server
開啓DHCP 功能容許客戶端設備經過三層交換機自動獲取IP地址dns
設定vlan10與vlan30能夠相互通信訪問,可是不能與vlan20互通接口
容許全部IP能夠訪問vlan20的2598端口ip
容許全部IP能夠訪問192.168.20.150 443 端口
容許全部IP能夠訪問192.168.20.110 443 端口
容許全部IP能夠訪問192.168.20.110 80 端口
容許全部IP能夠訪問192.168.20.160 27000 端口
禁止any訪問vlan 20
禁止vlan20訪問any
項目需求路由器設定
wan01 設定固定公網IP
wan02 設定DHCP 獲取IP (或已經知道的PPPOE設備提供的IP)
<H3C>system-view [H3C]vlan 10//建立vlan 十、20、 30 [H3C]vlan 20 [H3C]vlan 30 [H3C]interface vlan10//進入vlan10 配置ip地址 [H3C-Vlan-interface10]ip address 192.168.10.1 255.255.255.0 [H3C-Vlan-interface10]quit [H3C]interface vlan20//進入vlan20 配置ip地址 [H3C-Vlan-interface20]ip address 192.168.20.1 255.255.255.0 [H3C-Vlan-interface20]quit [H3C]interface vlan30//進入vlan30 配置ip地址 [H3C-Vlan-interface30]ip address 192.168.30.1 255.255.255.0 [H3C-Vlan-interface30]quit [H3C]inter range g1/0/1 to g1/0/16 //進入多端口1-16 設置接口模式 而且加入vlan10 [H3C]port link-mode bridge [H3C]port access vlan 10 [H3C]inter range g1/0/17 to g1/0/20 //進入多端口17-20 設置接口模式 而且加入vlan20 [H3C]port link-mode bridge [H3C]port access vlan 20 [H3C]dhcp enable//開啓DHCP服務 [H3C]dhcp server ip-pool vlan10 //爲vlan10 開啓DHCP 而且設置地址池 [H3C-ip-pool-vlan10] network 192.168.10.0 mask 255.255.255.0 //設置地址池 [H3C-ip-pool-vlan10] gateway-list 192.168.10.1 //設置網關 [H3C-ip-pool-vlan10] dns-list 192.168.5.1 //設置dns 由於我這邊的路由器的地址是192.168.5.1 [H3C-ip-pool-vlan10] expired day 8//設置有效期8天 [H3C-ip-pool-vlan10] quit [H3C]dhcp server ip-pool vlan20 //爲vlan10 開啓DHCP 而且設置地址池 [H3C-ip-pool-vlan20] network 192.168.20.0 mask 255.255.255.0 //設置地址池 [H3C-ip-pool-vlan20] gateway-list 192.168.20.1 //設置網關 [H3C-ip-pool-vlan20] dns-list 192.168.5.1 //設置dns 由於我這邊的路由器的地址是192.168.5.1 [H3C-ip-pool-vlan20] expired day 8//設置有效期8天 [H3C-ip-pool-vlan20] quit [H3C]dhcp server ip-pool vlan30 //爲vlan10 開啓DHCP 而且設置地址池 [H3C-ip-pool-vlan30] network 192.168.30.0 mask 255.255.255.0 //設置地址池 [H3C-ip-pool-vlan30] gateway-list 192.168.30.1 //設置網關 [H3C-ip-pool-vlan30] dns-list 192.168.5.1 //設置dns 由於我這邊的路由器的地址是192.168.5.1 [H3C-ip-pool-vlan30] expired day 8//設置有效期8天 [H3C-ip-pool-vlan30] quit [H3C]interface GigabitEthernet1/0/23//設置23號端口鏈接路由器開啓route模式並設置ip [H3C]port link-mode route [H3C]ip address 192.168.5.2 255.255.255.0 [H3C]quit [H3C]ip route-static 0.0.0.0 0.0.0.0 192.168.5.1//設置靜態路由器 全部訪問下一跳地址是路由器192.168.5.1 [H3C]interface GigabitEthernet1/0/24//設置24號端口 開啓trunk模式運行全部vlan經過,而且開啓dhcp-snooping trust [H3C] port link-mode bridge [H3C] port link-type trunk [H3C] port trunk permit vlan all [H3C] dhcp-snooping trust [H3C]acl number 3000//設置高級策略3000 [H3C-acl-number-3000]rule 20 permit tcp source any destination 192.168.20.0 0.0.0.255 destination-port eq 2598 //設置 策略20 全部ip能夠訪問vlan20的2598端口 [H3C-acl-number-3000]rule 21 permit tcp source any destination 192.168.20.150 0 destination-port eq 443 //設置 策略21 全部ip能夠訪問192.168.20.150的443端口 [H3C-acl-number-3000]rule 22 permit tcp source any destination 192.168.20.110 0 destination-port eq 443 //設置 策略22 全部ip能夠訪問192.168.20.110的443端口 [H3C-acl-number-3000]rule 23 permit tcp source any destination 192.168.20.110 0 destination-port eq 80//設置 策略23 全部ip能夠訪問192.168.20.110的80端口 [H3C-acl-number-3000]rule 24 permit tcp source any destination 192.168.20.160 0 destination-port eq 27000 //設置 策略24 全部ip能夠訪問192.168.20.160的27000端口 [H3C-acl-number-3000]rule 30 deny ip source any destination 192.168.20.0 0.0.0.255 //設置 策略30 禁用全部ip訪問vlan20 [H3C-acl-number-3000]rule 31 deny ip source 192.168.20.0 0.0.0.255 destination any//設置 策略31 禁用vlan20訪問全部ip [H3C-acl-number-3000]quit [H3C]acl number 3001//設置高級策略3001 [H3C-acl-number-3001] rule 10 permit tcp source 192.168.20.0 0.0.0.255 source-port eq 2598 destination any//設置 策略10 vlan20的2598端口能夠被全部ip訪問 [H3C-acl-number-3001] rule 11 permit tcp source 192.168.20.150 0 source-port eq 443 destination any//設置 策略11 192.168.5.150的443端口能夠被全部ip訪問 [H3C-acl-number-3001] rule 12 permit tcp source 192.168.20.110 0 source-port eq 443 destination any//設置 策略12 192.168.5.110的443端口能夠被全部ip訪問 [H3C-acl-number-3001] rule 13 permit tcp source 192.168.20.160 0 source-port eq 27000 destination any//設置 策略13 192.168.5.160的27000端口能夠被全部ip訪問 [H3C-acl-number-3001] rule 14 permit tcp source 192.168.20.110 0 source-port eq www destination any//設置 策略11 192.168.5.110的80端口能夠被全部ip訪問 [H3C-acl-number-3001] rule 20 deny ip source any destination 192.168.20.0 0.0.0.255 //設置 策略20 禁用全部ip訪問vlan20 [H3C-acl-number-3001] rule 21 deny ip source 192.168.20.0 0.0.0.255 destination any//設置 策略21 禁用vlan20訪問全部ip [H3C-acl-number-3001]quit [H3C] interface Vlan-interface10//進入vlan10 [H3C-Vlan-interface10]packet-filter 3000 inbound//應用策略3000到vlan上面 [H3C-Vlan-interface10]quit [H3C] interface Vlan-interface20//進入vlan20 [H3C-Vlan-interface20]packet-filter 3000 inbound//應用策略3000到vlan上面 [H3C-Vlan-interface20]quit [H3C] interface Vlan-interface30//進入vlan30 [H3C-Vlan-interface30]packet-filter 3001 inbound//應用策略3001到vlan上面 [H3C-Vlan-interface30]quit [H3C]save//保存配置
到此三層交換機已經配置好
路由器設置
登入網頁版
配置wan1 設置爲固定IP
IP:192.168.1.199
子網掩碼:255.255.255.0
網關:192.168.1.1
DNS:192.168.1.1
配置wan2 設置爲DHCP
配置vlan一、 二、 三、 四、 容許全部的vlan經過
設置高級-靜態路由容許那個網段上網vlan10 30
192.168.10.0 255.255.255.0 下一跳 192.168.5.2 vlan1
192.168.30.0 255.255.255.0 下一跳 192.168.5.2 vlan1
保存路由器 便可