思科3层交换机自动分配IP给pc,2台3层做链路聚合,pc0和pc2在VLAN10中,pc1,3在VLAN20 中 求配置详情

2025-03-31 21:45:27
推荐回答(1个)
回答1:

楼主,你好

配置如下,手打

L3 SW1:

ip dhcp excluded-address 192.168.10.1

ip dhcp excluded-address 192.168.20.1

ip dhcp excluded-address 192.168.10.2

ip dhcp excluded-address 192.168.20.2

ip dhcp pool 10

   network 192.168.10.0 255.255.255.0

   default-router 192.168.10.1 

   dns-server 202.103.24.68 202.103.44.150 

!

ip dhcp pool 20

   network 192.168.20.0 255.255.255.0

   default-router 192.168.20.2 

   dns-server 202.103.24.68 202.103.44.150 

spanning-tree vlan 10 priority 8192

spanning-tree vlan 20 priority 16384

interface Port-channel1

 switchport mode trunk

!

interface FastEthernet0/1

 switchport mode trunk

!

interface FastEthernet0/2

 switchport mode trunk

!

interface FastEthernet0/3

 switchport mode trunk

 channel-group 1 mode on

!

interface FastEthernet0/4

 switchport mode trunk

 channel-group 1 mode on

interface Vlan10

 ip address 192.168.10.1 255.255.255.0

!

interface Vlan20

 ip address 192.168.20.1 255.255.255.0

 ip ospf cost 65535

spanning-tree vlan 10 priority 8192

spanning-tree vlan 20 priority 16384

interface Port-channel1

 switchport mode trunk

!

interface FastEthernet0/1

 switchport mode trunk

!

interface FastEthernet0/2

 switchport mode trunk

!

interface FastEthernet0/3

 switchport mode trunk

 channel-group 1 mode on

!

interface FastEthernet0/4

 switchport mode trunk

 channel-group 1 mode on

interface Vlan10

 ip address 192.168.10.1 255.255.255.0

!

interface Vlan20

 ip address 192.168.20.1 255.255.255.0

 ip ospf cost 65535

L3 SW 2:

spanning-tree vlan 10 priority 16384

spanning-tree vlan 20 priority 8192

interface Port-channel1

 switchport mode trunk

!

interface FastEthernet1/1

 switchport mode trunk

!

interface FastEthernet1/2

 switchport mode trunk

!

interface FastEthernet0/3

 switchport mode trunk

 channel-group 1 mode on

!

interface FastEthernet0/4

 switchport mode trunk

 channel-group 1 mode on

interface Vlan10

 ip address 192.168.10.2 255.255.255.0

 ip ospf cost 65535

!

interface Vlan20

 ip address 192.168.20.2 255.255.255.0

L2 SW 1:

inter f0/3

no shutdown

sw mode trunk

inter f0/4

no shutdown

sw mode trunk

inter f0/1

sw mode access

sw access vlan 10

inter f0/2

sw mode access

sw access vlan 20

L2  SW2:

inter f0/3

no shutdown

sw mode trunk

inter f0/4

no shutdown

sw mode trunk

inter f0/1

no shutdown 

sw mode access

sw access vlan 10

inter f0/2

no shutdown 

sw mode access

sw access vlan 20

PC 自动获取ip即可。