This article uses 4 pcs (more and less PC, the principle is the same, so here I only use 4 pcs), Huawei Router (R2621), switch (s3026e) each one, build a VLAN, realize the connection between virtual network and physical network. Implement firewall policies, and access control (ACLs).
Programme description:
The IP addresses and masks of the four PCs are listed below:
P1 192.168.1.1 255.255.255.0 gateway IP is 192.168.1.5
P2 192.168.1.2 255.255.255.0 gateway IP 192.168.1.5 P3
255.255.255.0 gateway IP for 192.168.1.6
P4 192.168.1.4 255.255.255.0 gateway IP for 192.168.1.6
Ethernet0 IP on the router is 192.168.1.5
Ethernet1 IP for 192.168.1.6
Firewall setting defaults to deny
Implementation Command list:
Set up on the switch, divide the VLAN:
SYS
//switch to System view
[Quidway]vlan enable
[Quidway]vlan 2
[Quidway-vlan2]port E0/1 to E0/8
[ Quidway-vlan2]quit
//default all ports belong to VLAN1, the E0/1 to E0/8 of the specified switch is VLAN2
[Quidway]vlan 3
[Quidway-vlan3]port E0/9 to E0/16
[quidway-vlan3]quit
//designated switch E0/9 to E0/16 eight ports are VLAN3
[Quidway]dis vlan all
[Quidway ]dis CU
Set on the router to implement access control:
[router]interface Ethernet 0 [router-ethernet0]ip address 192.168.1.5 255.255.255.0 [router-ethernet0]quit// Specify Ethernet 0 IP [router]interface Ethernet 1 [router-ethernet1]ip address 192.168.1.6 255.255.255.0 [Router-ethernet1] Quit//Open firewall and set default to deny [Router]fire enable [Router]fire default Deny//Allow 192.168.1.1 access 192.168.1.3// The firewall policy can be added as needed [ROUTER]ACL [router-acl-101]rule permit IP Source 192.168.1.1 255.255.255.0-Destination 192.168.1.3 255.255.255.0 [router-acl-101]quit//Enable 101 rule [Router-ethernet0]fire pa [Router-ethernet0]quit [ Router-ethernet1]fire PA [Router-ethernet1]quit