题目:
首先对SW 1和SW2创建vlan2和vlan3:
[SW1]vlan 2
[SW1-vlan2]q
[SW1]vlan 3
[SW1-vlan3]q
[SW2]vlan 2
[SW2-vlan2]q
[SW2]vlan 3
[SW2-vlan3]q
然后判断接口的链路:
[SW1]interface g 0/0/2
[SW1-GigabitEthernet0/0/2]port
[SW1-GigabitEthernet0/0/2]portswitch
[SW1-GigabitEthernet0/0/2]port-auto-sleep
[SW1-GigabitEthernet0/0/2]port l
[SW1-GigabitEthernet0/0/2]port link-t
[SW1-GigabitEthernet0/0/2]port link-type a
[SW1-GigabitEthernet0/0/2]port link-type access
[SW1-GigabitEthernet0/0/2]
Jan 30 2024 21:58:18-08:00 SW1 DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.25
.191.3.1 configurations have been changed. The current change number is 8, the c
hange loop count is 0, and the maximum number of records is 4095.
[SW1-GigabitEthernet0/0/2]
[SW1-GigabitEthernet0/0/2]port d
[SW1-GigabitEthernet0/0/2]port discard
[SW1-GigabitEthernet0/0/2]port default vlan 2
[SW1-GigabitEthernet0/0/2]
Jan 30 2024 21:58:48-08:00 SW1 DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.25
.191.3.1 configurations have been changed. The current change number is 9, the c
hange loop count is 0, and the maximum number of records is 4095.
[SW1-GigabitEthernet0/0/2]q
[SW1]inter
[SW1]interface g 0/0/3
[SW1-GigabitEthernet0/0/3]port l
[SW1-GigabitEthernet0/0/3]port link-t
[SW1-GigabitEthernet0/0/3]port link-type a
[SW1-GigabitEthernet0/0/3]port link-type access
[SW1-GigabitEthernet0/0/3]port d
[SW1-GigabitEthernet0/0/3]port discard
[SW1-GigabitEthernet0/0/3]port default
Jan 30 2024 21:59:58-08:00 SW1 DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.25
.191.3.1 configurations have been changed. The current change number is 10, the
change loop count is 0, and the maximum number of records is 4095.
[SW1-port-group-default]port d
[SW1-port-group-default]port discard
[SW1-port-group-default]port default
Jan 30 2024 22:00:08-08:00 SW1 DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.25
.191.3.1 configurations have been changed. The current change number is 11, the
change loop count is 0, and the maximum number of records is 4095.
^
Error:Incomplete command found at '^' position.
[SW1-port-group-default]port d
[SW1-port-group-default]port discard
[SW1-port-group-default]port default vlan 3
[SW1-port-group-default]q
[SW1]inter
[SW1]interface g 0/0/4
[SW1-GigabitEthernet0/0/4]port l
[SW1-GigabitEthernet0/0/4]port link-t
[SW1-GigabitEthernet0/0/4]port link-type tr
[SW1-GigabitEthernet0/0/4]port link-type trunk
[SW1-GigabitEthernet0/0/4]
Jan 30 2024 22:01:28-08:00 SW1 DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.25
.191.3.1 configurations have been changed. The current change number is 12, the
change loop count is 0, and the maximum number of records is 4095.
[SW1-GigabitEthernet0/0/4]port trunk all
[SW1-GigabitEthernet0/0/4]port trunk allow-pass vlan all
[SW1-GigabitEthernet0/0/4]
Jan 30 2024 22:02:08-08:00 SW1 DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.25
.191.3.1 configurations have been changed. The current change number is 13, the
change loop count is 0, and the maximum number of records is 4095.
[SW1-GigabitEthernet0/0/4]q
[SW1]iinter
[SW1]inter
[SW1]interface g 0/0/1
[SW1-GigabitEthernet0/0/1]port l
[SW1-GigabitEthernet0/0/1]port link-t
[SW1-GigabitEthernet0/0/1]port link-type trunk
[SW1-GigabitEthernet0/0/1]port d
[SW1-GigabitEthernet0/0/1]port discard
Jan 30 2024 22:03:08-08:00 SW1 DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.25
.191.3.1 configurations have been changed. The current change number is 14, the
change loop count is 0, and the maximum number of records is 4095.
[SW1-port-group-discard]port trunk a
Jan 30 2024 22:03:18-08:00 SW1 DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.25
.191.3.1 configurations have been changed. The current change number is 15, the
change loop count is 0, and the maximum number of records is 4095.
[SW1-port-group-discard]port trunk allow-pass vlan all
[SW2]interface g 0/0/1
[SW2-GigabitEthernet0/0/1]port tr
[SW2-GigabitEthernet0/0/1]port trunk a
[SW2-GigabitEthernet0/0/1]port trunk allow-pass vlan all
^
Error: Unrecognized command found at '^' position.
[SW2-GigabitEthernet0/0/1]port l
[SW2-GigabitEthernet0/0/1]port link-t
[SW2-GigabitEthernet0/0/1]port link-type trunk
[SW2-GigabitEthernet0/0/1]
Jan 30 2024 22:05:28-08:00 SW2 DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.25
.191.3.1 configurations have been changed. The current change number is 7, the c
hange loop count is 0, and the maximum number of records is 4095.port tr
[SW2-GigabitEthernet0/0/1]port trunk a
[SW2-GigabitEthernet0/0/1]port trunk allow-pass v
[SW2-GigabitEthernet0/0/1]port trunk allow-pass vlan a
[SW2-GigabitEthernet0/0/1]port trunk allow-pass vlan all
[SW2-GigabitEthernet0/0/1]
Jan 30 2024 22:05:48-08:00 SW2 DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.25
.191.3.1 configurations have been changed. The current change number is 8, the c
hange loop count is 0, and the maximum number of records is 4095.
[SW2-GigabitEthernet0/0/1]q
[SW2]inter
[SW2]interface g 0/0/2
[SW2-GigabitEthernet0/0/2]port t
[SW2-GigabitEthernet0/0/2]port l
[SW2-GigabitEthernet0/0/2]port link-t
[SW2-GigabitEthernet0/0/2]port link-type a
[SW2-GigabitEthernet0/0/2]port link-type access
[SW2-GigabitEthernet0/0/2]port d
Jan 30 2024 22:06:48-08:00 SW2 DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.25
.191.3.1 configurations have been changed. The current change number is 9, the c
hange loop count is 0, and the maximum number of records is 4095.
[SW2-GigabitEthernet0/0/2]port discard
[SW2-GigabitEthernet0/0/2]port default vlan 2
[SW2-GigabitEthernet0/0/2]
Jan 30 2024 22:06:58-08:00 SW2 DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.25
.191.3.1 configurations have been changed. The current change number is 10, the
change loop count is 0, and the maximum number of records is 4095.q
[SW2]inter
[SW2]interface g 0/0/1
[SW2-GigabitEthernet0/0/1]port l
[SW2-GigabitEthernet0/0/1]port link-t
[SW2-GigabitEthernet0/0/1]port link-type a
[SW2-GigabitEthernet0/0/1]port link-type access
Error: Please renew the default configurations.
[SW2-GigabitEthernet0/0/1]q
[SW2]inter
[SW2]interface g 0/0/3
[SW2-GigabitEthernet0/0/3]port l
[SW2-GigabitEthernet0/0/3]port link-t
[SW2-GigabitEthernet0/0/3]port link-type a
[SW2-GigabitEthernet0/0/3]port link-type access
[SW2-GigabitEthernet0/0/3]port d
[SW2-GigabitEthernet0/0/3]port discard
[SW2-GigabitEthernet0/0/3]port default
Jan 30 2024 22:08:08-08:00 SW2 DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.25
.191.3.1 configurations have been changed. The current change number is 11, the
change loop count is 0, and the maximum number of records is 4095.
[SW2-GigabitEthernet0/0/3]port discard
[SW2-GigabitEthernet0/0/3]port default vlan 3
[SW2-GigabitEthernet0/0/3]
Jan 30 2024 22:08:28-08:00 SW2 DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.25
.191.3.1 configurations have been changed. The current change number is 12, the
change loop count is 0, and the maximum number of records is 4095.
[SW2-GigabitEthernet0/0/3]q
进行配置虚拟子接口:
[R1]interface g 0/0/0.1
[R1-GigabitEthernet0/0/0.1]ip ad
[R1-GigabitEthernet0/0/0.1]ip address 192.168.1.1 24
[R1-GigabitEthernet0/0/0.1]do
[R1-GigabitEthernet0/0/0.1]dot1q te
[R1-GigabitEthernet0/0/0.1]dot1q termination vid 2
Jan 30 2024 22:11:39-08:00 R1 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
on the interface GigabitEthernet0/0/0.1 has entered the UP state.
[R1-GigabitEthernet0/0/0.1]arp b
[R1-GigabitEthernet0/0/0.1]arp broadcast en
[R1-GigabitEthernet0/0/0.1]arp broadcast enable
[R1-GigabitEthernet0/0/0.1]q
[R1]inter
[R1]interface g 0/0/0.2
[R1-GigabitEthernet0/0/0.2]ip ad
[R1-GigabitEthernet0/0/0.2]ip address 192.168.2.1 24
[R1-GigabitEthernet0/0/0.2]do
[R1-GigabitEthernet0/0/0.2]dot1q te
[R1-GigabitEthernet0/0/0.2]dot1q termination vid 3
Jan 30 2024 22:13:24-08:00 R1 %%01IFNET/4/LINK_STATE(l)[1]:The line protocol IP
on the interface GigabitEthernet0/0/0.2 has entered the UP state.
[R1-GigabitEthernet0/0/0.2]arp b
[R1-GigabitEthernet0/0/0.2]arp broadcast en
[R1-GigabitEthernet0/0/0.2]arp broadcast enable
[R1-GigabitEthernet0/0/0.2]
[R1-GigabitEthernet0/0/0.2]q
开启DHCP:
[R1]dhcp en
[R1]dhcp enable
Info: The operation may take a few seconds. Please wait for a moment.done.
[R1]
[R1]
[R1]ip po
[R1]ip policy-based-route
[R1]ip pool AA
Info: It's successful to create an IP address pool.
[R1-ip-pool-AA]netwo
[R1-ip-pool-AA]network 192.168.1.0 mask 24
[R1-ip-pool-AA]ga
[R1-ip-pool-AA]gateway-list 192.168.1.1
[R1-ip-pool-AA]q
[R1]inter
[R1]interface g 0/0/0.1
[R1-GigabitEthernet0/0/0.1]dhcp se
[R1-GigabitEthernet0/0/0.1]dhcp select gl
[R1-GigabitEthernet0/0/0.1]dhcp select global
[R1-GigabitEthernet0/0/0.1]
[R1-GigabitEthernet0/0/0.1]q
[R1]ip po
[R1]ip policy-based-route
[R1]ip pool BB
Info: It's successful to create an IP address pool.
[R1-ip-pool-BB]netw
[R1-ip-pool-BB]network 192.168.2.0 mask 24
[R1-ip-pool-BB]ga
[R1-ip-pool-BB]gateway-list 192.168.2.1
[R1-ip-pool-BB]q
[R1]inter
[R1]interface g 0/0/0.2
[R1-GigabitEthernet0/0/0.2]dhcp select g
[R1-GigabitEthernet0/0/0.2]dhcp select global
[R1-GigabitEthernet0/0/0.2]
进行测试是否全网通: