求告诉完整的步骤😭😭

 

  1. 在开始配置网络设备之前,需要为各个设备配置基础信息,例如设备名称,登录密码等等。下面是基础配置命令:
    ```
    //配置S31基础信息
    enable
    configure terminal
    hostname S31
    enable secret class
    line console 0
    password cisco
    login
    exit
    line vty 0 4
    password cisco
    login
    exit

//配置R1基础信息
enable
configure terminal
hostname R1
enable secret class
line console 0
password cisco
login
exit
line vty 0 4
password cisco
login
exit

//配置OUT基础信息
enable
configure terminal
hostname OUT
enable secret class
line console 0
password cisco
login
exit
line vty 0 4
password cisco
login
exit

//配置R2基础信息
enable
configure terminal
hostname R2
enable secret class
line console 0
password cisco
login
exit
line vty 0 4
password cisco
login
exit

//配置INTERNET基础信息
enable
configure terminal
hostname INTERNET
enable secret class
line console 0
password cisco
login
exit
line vty 0 4
password cisco
login
exit



2.在 S21 上进行如下配置:

1.创建 VLAN 10,20 和 30
S21# configure terminal
S21(config)# vlan 10
S21(config-vlan)# name VLAN10
S21(config-vlan)# exit

S21(config)# vlan 20
S21(config-vlan)# name VLAN20
S21(config-vlan)# exit

S21(config)# vlan 30
S21(config-vlan)# name VLAN30
S21(config-vlan)# exit

2.划分端口
S21(config)# interface range FastEthernet0/1-5
S21(config-if-range)# switchport mode access
S21(config-if-range)# switchport access vlan 10
S21(config-if-range)# exit

S21(config)# interface range FastEthernet0/6-10
S21(config-if-range)# switchport mode access
S21(config-if-range)# switchport access vlan 20
S21(config-if-range)# exit

S21(config)# interface range FastEthernet0/11-15
S21(config-if-range)# switchport mode access
S21(config-if-range)# switchport access vlan 30
S21(config-if-range)# exit

S22上进行配置:
  1. 创建VLAN 100 和 VLAN 200
    S22# configure terminal
    S22(config)# vlan 100
    S22(config-vlan)# name VLAN100
    S22(config-vlan)# exit

S22(config)# vlan 200
S22(config-vlan)# name VLAN200
S22(config-vlan)# exit
2. 划分端口:
S22(config)# interface range FastEthernet0/1-5
S22(config-if-range)# switchport mode access
S22(config-if-range)# switchport access vlan 100
S22(config-if-range)# exit

S22(config)# interface range FastEthernet0/6-10
S22(config-if-range)# switchport mode access
S22(config-if-range)# switchport access vlan 200
S22(config-if-range)# exit

这样 S21S22 上的 VLAN 就被创建并配置好了。如果有需要可以在交换机上配置管理 IP 地址。

注意:为了实现不同 VLAN 之间的互访,需要在交换机之间进行 VTP 的配置,并且需要在 R1R2 上配置 VLAN 接口,为不同 VLAN 提供互访的路由。同时还需要在防火墙上进行相应的安全策略配置。

3. 在S31上创建和配置vlan时,可以使用以下命令:
  1. 创建vlan:
    S31(config)# vlan 10
    S31(config-vlan)# name VLAN10
    S31(config)# vlan 20
    S31(config-vlan)# name VLAN20
    S31(config)# vlan 30
    S31(config-vlan)# name VLAN30
  2. 为每个VLAN配置IP地址:
    S31(config)# interface vlan 10
    S31(config-if)# ip address 192.168.10.1 255.255.255.0
    S31(config-if)# no shutdown
    S31(config)# interface vlan 20
    S31(config-if)# ip address 192.168.20.1 255.255.255.0
    S31(config-if)# no shutdown
    S31(config)# interface vlan 30
    S31(config-if)# ip address 192.168.30.1 255.255.255.0
    S31(config-if)# no shutdown
  3. 配置vlan的默认网关:
    S31(config)# ip default-gateway 192.168.14.1
  4. 配置跨vlan路由,允许vlan间通信:
    S31(config)# interface fa0/1
    S31(config-if)# no switchport
    S31(config-if)# ip address 192.168.14.4 255.255.255.0
    S31(config-if)# no shutdown
    S31(config)# interface vlan 10
    S31(config-if)# ip address 192.168.10.1 255.255.255.0
    S31(config-if)# no shutdown
    S31(config)# interface vlan 20
    S31(config-if)# ip address 192.168.20.1 255.255.255.0
    S31(config-if)# no shutdown
    S31(config)# interface vlan 30
    S31(config-if)# ip address 192.168.30.1 255.255.255.0
    S31(config-if)# no shutdown
    S31(config)# ip routing
    使用这些命令,您应该能够在S31上配置并启用VLAN10、VLAN20和VLAN30之间的通信。

4. 要在R2上配置单臂路由,以实现VLAN100和VLAN200的互访,可以按照以下步骤进行配置:

  1. 配置VLAN100和VLAN200接口的IP地址:

interface FastEthernet0/0.1
ip address 192.168.100.1 255.255.255.0
!
interface FastEthernet0/0.2
ip address 192.168.200.1 255.255.255.0

  1. 配置VLAN100和VLAN200接口为802.1Q trunk口:

interface FastEthernet0/0
no ip address
!
interface FastEthernet0/0.1
encapsulation dot1Q 100
!
interface FastEthernet0/0.2
encapsulation dot1Q 200

  1. 配置R2为单臂路由:

interface FastEthernet0/0
no ip address
no shutdown
!
interface FastEthernet0/0.1
encapsulation dot1Q 100
no shutdown
!
interface FastEthernet0/0.2
encapsulation dot1Q 200
no shutdown
!
interface FastEthernet1/0
ip address 192.168.20.2 255.255.255.0
no shutdown
!
ip route 0.0.0.0 0.0.0.0 FastEthernet1/0

在上述配置中,FastEthernet1/0是连接到局域网的接口,IP地址为192.168.20.2。最后一行配置了一个默认路由,
以便R2可以将所有非本地子网的数据包发送到Internet设备(OUT)进行路由。

5.在S31上配置DHCP服务,为VLAN10、VLAN20、VLAN30分配IP地址的具体步骤如下:
  1. 进入S31的全局配置模式:

S31# configure terminal

  1. 配置DHCP池:

S31(config)# ip dhcp pool VLAN10
S31(dhcp-config)# network 192.168.10.0 255.255.255.0
S31(dhcp-config)# default-router 192.168.10.1
S31(dhcp-config)# exit

S31(config)# ip dhcp pool VLAN20
S31(dhcp-config)# network 192.168.20.0 255.255.255.0
S31(dhcp-config)# default-router 192.168.20.1
S31(dhcp-config)# exit

S31(config)# ip dhcp pool VLAN30
S31(dhcp-config)# network 192.168.30.0 255.255.255.0
S31(dhcp-config)# default-router 192.168.30.1
S31(dhcp-config)# exit

  1. 在VLAN10、VLAN20、VLAN30接口上启用DHCP服务:

S31(config)# interface vlan 10
S31(config-if)# ip dhcp server
S31(config-if)# exit

S31(config)# interface vlan 20
S31(config-if)# ip dhcp server
S31(config-if)# exit

S31(config)# interface vlan 30
S31(config-if)# ip dhcp server
S31(config-if)# exit

R2.上配置DHCP服务,分别给VLAN100和VL AN200分配IP地址。需要使用DHCP服务。以下是在R2上为两个VLAN设置DHCP服务的步骤和命令:

  1. 进入R2的全局配置模式:

R2> enable
R2# configure terminal

  1. 创建两个DHCP池,一个用于VLAN100,另一个用于VLAN200。池名可以是任意名称。

R2(config)# ip dhcp pool VLAN100_POOL
R2(dhcp-config)# network 192.168.100.0 255.255.255.0
R2(dhcp-config)# default-router 192.168.100.1
R2(dhcp-config)# dns-server 8.8.8.8

R2(config)# ip dhcp pool VLAN200_POOL
R2(dhcp-config)# network 192.168.200.0 255.255.255.0
R2(dhcp-config)# default-router 192.168.200.1
R2(dhcp-config)# dns-server 8.8.8.8

  1. 分配IP地址给客户端,使用“ip dhcp excluded-address”命令来防止DHCP服务器分配给客户端的IP地址与网络中的其他设备冲突。
    在这里,我们将从192.168.100.2到192.168.100.254之间的IP地址排除在VLAN100池中;
    从192.168.200.2到192.168.200.254之间的IP地址排除在VLAN200池中。

R2(config)# ip dhcp excluded-address 192.168.100.1 192.168.100.254
R2(config)# ip dhcp excluded-address 192.168.200.1 192.168.200.254

6. 为了实现全网互连,可以使用RIP或OSPF这样的动态路由协议。这里我以OSPF为例进行配置。
下面是每个设备的OSPF配置:


S21:

router ospf 1
network 10.0.0.0 0.255.255.255 area 0
S22:
router ospf 1
network 172.16.0.0 0.0.255.255 area 0 #

S31:
router ospf 1
network 192.168.10.0 0.0.0.255 area 0
network 192.168.20.0 0.0.0.255 area 0
network 192.168.30.0 0.0.0.255 area 0
R1:
router ospf 1
network 192.168.14.0 0.0.0.255 area 0
network 192.168.50.0 0.0.0.255 area 0
R2:
router ospf 1
network 192.168.100.0 0.0.0.255 area 0
network 192.168.200.0 0.0.0.255 area 0
OUT:
router ospf 1
network 63.1.1.0 0.0.0.255 area 0
network 200.1.1.0 0.0.0.255 area 0
network 192.168.13.0 0.0.0.255 area 0
network 192.168.23.0 0.0.0.255 area 0
通过以上配置,每个设备都在OSPF进程中,并将每个接口加入相应的区域。当链路状态发生变化时,OSPF将自动更新路由表,确保所有设备都能够互相通信。

7. 为了实现VLAN10、VLAN20可以和VLAN100实现互访,但不能访问VLAN200,以及VLAN30和VLAN200之间实现互访,但不能访问VLAN100,可以在合适的设备上配置ACL。

针对题目所述的要求,需要在 S21 和 S22 上配置相应的 ACL,具体命令如下:
  1. S21 上配置 ACL:

S21(config)# ip access-list extended VLAN10-VLAN100
S21(config-ext-nacl)# permit ip 192.168.10.0 0.0.0.255 192.168.100.0 0.0.0.255
S21(config-ext-nacl)# permit ip 192.168.20.0 0.0.0.255 192.168.100.0 0.0.0.255
S21(config-ext-nacl)# deny ip any 192.168.200.0 0.0.0.255

S21(config)# ip access-list extended VLAN20-VLAN100
S21(config-ext-nacl)# permit ip 192.168.20.0 0.0.0.255 192.168.100.0 0.0.0.255
S21(config-ext-nacl)# permit ip 192.168.10.0 0.0.0.255 192.168.100.0 0.0.0.255
S21(config-ext-nacl)# deny ip any 192.168.200.0 0.0.0.255

  1. S22 上配置 ACL:

S22(config)# ip access-list extended VLAN200-VLAN30
S22(config-ext-nacl)# permit ip 192.168.200.0 0.0.0.255 192.168.30.0 0.0.0.255
S22(config-ext-nacl)# permit ip 192.168.30.0 0.0.0.255 192.168.200.0 0.0.0.255
S22(config-ext-nacl)# deny ip any 192.168.100.0 0.0.0.255

S22(config)# ip access-list extended VLAN200-VLAN10
S22(config-ext-nacl)# permit ip 192.168.200.0 0.0.0.255 192.168.10.0 0.0.0.255
S22(config-ext-nacl)# permit ip 192.168.10.0 0.0.0.255 192.168.200.0 0.0.0.255
S22(config-ext-nacl)# deny ip any 192.168.100.0 0.0.0.255

最后,在 S21 和 S22 对应的 VLAN 接口上应用 ACL,如下所示:

S21(config)# interface vlan 10
S21(config-if)# ip access-group VLAN10-VLAN100 in
S21(config-if)# interface vlan 20
S21(config-if)# ip access-group VLAN20-VLAN100 in

S22(config)# interface vlan 100
S22(config-if)# ip access-group VLAN200-VLAN10 in
S22(config-if)# interface vlan 200
S22(config-if)# ip access-group VLAN200-VLAN30 in

这样,就能实现 VLAN10、VLAN20 可以访问 VLAN100,但不能访问 VLAN200;VLAN30 可以访问 VLAN200,但不能访问 VLAN100。


8. 利用SERVER2模拟外网服务器,要求在0UT路由器上进行合适的配
置,以实现VLAN10、VLAN20、 VLAN1 00的用户可以访问外网服务器SERVER


  1. 在OUT路由器上进行如下配置:

access-list 101 permit ip any any
access-list 102 permit ip 192.168.10.0 0.0.0.255 any
access-list 102 permit ip 192.168.20.0 0.0.0.255 any
access-list 102 permit ip 192.168.100.0 0.0.0.255 any
access-list 103 deny ip 192.168.200.0 0.0.0.255 any
access-list 103 permit ip any any

interface S1/2
ip address 200.1.1.1 255.255.255.0
ip access-group 101 in

interface S1/0
ip access-group 102 in

interface S1/1
ip access-group 103 in

以上配置实现了VLAN10、VLAN20、VLAN100用户可以访问外网服务器,而VLAN200用户不能访问外网服务器。这是通过在S1/0和S1/1接口上分别应用不同的ACL实现的。ACL 102允许VLAN10、VLAN20、VLAN100用户通过S1/0接口访问外网服务器,ACL 103则在S1/1接口上阻止了VLAN200用户访问外网服务器。同时在S1/2接口应用ACL 101允许所有IP流量通过,相当于没有任何限制。