以R1为例:
[Huawei]interface GigabitEthernet0/0/1.1
[Huawei-GigabitEthernet0/0/1.1]ip address 192.168.1.65 27
[Huawei-GigabitEthernet0/0/1.1]Q
[Huawei]interface GigabitEthernet 0/0/1.2
[Huawei-GigabitEthernet0/0/1.2]ip address 192.168.1.97 27
创建vlan2 vlan3,将两台pc划入vlan2中,将http服务器划入vlan3中;
以LSW1为例:
[Huawei]vlan 2
[Huawei-vlan2]vlan 3
[Huawei-vlan3]q
[Huawei]interface Ethernet 0/0/2
[Huawei-Ethernet0/0/2]port link-type access
[Huawei-Ethernet0/0/2]port default vlan 2
[Huawei]interface Ethernet 0/0/3
[Huawei-Ethernet0/0/3]port link-type access
[Huawei-Ethernet0/0/3]port default vlan 2
[Huawei]interface Ethernet 0/0/4
[Huawei-Ethernet0/0/4]port link-type access
[Huawei-Ethernet0/0/4]port default vlan 3
以R1为例:
[Huawei]dhcp enable
[Huawei]ip pool a
Info:It’s successful to create an IP address pool.
[Huawei-ip-pool-a]network 192.168.1.64 mask 27
[Huawei-ip-pool-a]gateway-list 192.168.1.65
[Huawei-ip-pool-a]dns-list 114.114.114.114 8.8.8.8
[Huawei]ip pool b
Info:It’s successful to create an IP address pool.
[Huawei-ip-pool-a]network 192.168.1.96 mask 27
[Huawei-ip-pool-a]gateway-list 192.168.1.97
[Huawei-ip-pool-a]dns-list 114.114.114.114 8.8.8.8
开启该dhcp服务:
[Huawei]interface GigabitEthernet0/0/1.1
[Huawei-GigabitEthernet0/0/1.1]dhcp select global
[Huawei]interface GigabitEthernet0/0/1.2
[Huawei-GigabitEthernet0/0/1.2]dhcp select global
路由器R2的配置与上面相同。
在R1上配置如下:
[Huawei]ospf 1 router-id 192.168.1.1
[Huawei-ospf-1]area 0
[Huawei-ospf-1-area-0.0.0.0]network 192.168.1.0 0.0.0.255
在R2上配置如下:
[R2]ospf 1 router-id 192.168.1.129
[R2-ospf-1]area 0
[R2-ospf-1-area-0.0.0.0]network 192.168.1.0 0.0.0.255
[LSW1]interface Ethernet 0/0/1
[LSW1-Ethernet0/0/1]port link-type trunk
[LSW1-Ethernet0/0/1]port trunk allow-pass vlan all
[LSW2]interface GigabitEthernet 0/0/1
[LSW2-GigabitEthernet0/0/1]port link-type trunk
[LSW2-GigabitEthernet0/0/1]port trunk allow-pass vlan all
[r1]aaa
[r1-aaa]local-user chen privilege level 15 password cipher 123456
[r1-aaa]local-user chen service-type telnet
[r1]user-interface vty 0 4
[r1-ui-vty0-4]authentication-mode aaa
[r2]aaa
[r2-aaa]local-user yu privilege level 15 password cipher 123456
[r2-aaa]local-user yu service-type telnet
[r2]user-interface vty 0 4
[r2-ui-vty0-4]authentication-mode aaa
[r1-acl-adv-3001]rule deny tcp source 192.168.1.93 0 destination 192.168.1.1 0 destination-port eq 23
[r1-acl-adv-3001]rule deny tcp source 192.168.1.93 0 destination 192.168.1.65 0 destination-port eq 23
[r1-acl-adv-3001]rule deny tcp source 192.168.1.93 0 destination 192.168.1.97 0 destination-port eq 23
然后在接口上调用该命令
[r1-GigabitEthernet0/0/1]traffic-filter inbound acl 3000
注:由于华为模拟器的pc不支持telnet所以我们通过路由器模拟pc
在路由器上设置网关,并且配置静态路由使得模仿pc的路由器可以ping通内网的所有端口;
到了这一步已经完成了该实验的前五项要求了;
[r2-acl-basic-2000]rule permit source 192.168.0.0 0.0.255.255
[r2]interface GigabitEthernet 0/0/2
[r2-GigabitEthernet0/0/2]nat outbound 2000
在R2上写一条缺省路由
[r2]ip route-static 0.0.0.0 0.0.0.0 1.1.1.0
这样PC1-PC4就可以访问PC5
client配置如下:
在内网中的服务器进行端口映射;
在r2上配置如下:
[r2-GigabitEthernet0/0/2]nat static protocol tcp global current-interface 80 inside 192.168.1.98 80
Warning:The port 80 is well-known port. If you continue it may cause function failure.
Are you sure to continue?[Y/N]:y
这样配置了以后就可以通过client通过域名访问httpserver
6、的时候已经在r1和r2上设置的telnet登录服务,所以通过先登录12.1.1.1登录在r2路由器上,再通过r2路由器登录r1路由器;
实验到此结束