我这里都没有写enable和conf t这些要记得敲
switch0:
valn 101
valn 102
int f0/1
sw mode access
sw acess vlan 101
int f0/2
sw mode access
sw access vlan 102
int range f0/23-24
sw mode trunk
sw trunk allowed vlan all
Multilay switch1:
ip routing
vlan 101
vlan 102
int vlan 101
ip add 192.168.1.1 255.255.255.0
int vlan 102
ip add 192.168.2.1 255.255.255.0
ip dhcp pool c10
network 192.168.1.0 255.255.255.0
default-router 192.168.1.1
dns-server 8.8.8.8
ip dhcp pool c20
network 192.168.2.0 255.255.255.0
default-router 192.168.2.1
dns-server 8.8.8.8
int rang f0/23-24
sw mode trunk
sw trunk allowed vlan all
链路聚合:
int port-channel 1
int rang f0/23-24
sw trunk encap dot1q
sw mode trunk
channel-group 1 mode on
int g0/1
no sw
no shut
ip add 192.168.10.1 255.255.255.0
开启pc的dhcp服务,左边就可以获取到ip地址了
Multilay switch2:
ip routing
int g0/2
sw trunk en do
sw mode trunk
sw trunk allowed vlan all
int g0/1
no sw
no shut
ip add 192.168.10.3 255.255.255.0
int g0/2
sw trunk en do
sw mode trunk
sw trunk all vlan all
vlan 103
vlan 104
vlan 105
vlan 106
int vlan 103
ip add 192.168.3.1 255.255.255.0
int vlan 104
ip add 192.168.4.1 255.255.255.0
int vlan 105
ip add 192.168.5.1 255.255.255.0
int vlan 106
ip add 192.168.6.1 255.255.255.0
int vlan 103
ip helper-address 192.168.5.2
int vlan 104
ip helper-adress 192.168.5.2
access-list 1 deny 192.168.3.0 0.0.0.255
access-list 1 permit any
int vlan 106
ip access-group 1 out
access-list 101 deny icmp 192.168.1.0 0.0.0.255 eq www 192.168.5.2 255.255.255.0
access-list 101 permit icmp any any
int vlan 105
ip access-group 101 in
server0:
server1:
server2
switch1:
vlan 103
vlan 104
vlan 105
vlan 106
int fa0/1
sw mode access
sw access vlan 103
int fa0/2
sw mode access
sw access vlan 104
int fa0/3
sw mode access
sw access vlan 105
int fa0/4
sw mode access
sw access vlan 106
int g1/1
sw mode trunk
sw trunk allowed vlan all
打开pc的dhcp服务,就可以获取IP地址了
Multilay switch0:
ip routing
int f0/1
no shutdown
router0:
int f0/0
ip add 192.168.10.2 255.255.255.0
int s1/0
ip add 100.100.100.2 255.255.255.0
route rip
v 2
net 100.100.100.0
静态nat:
ip nat inside source static 192.168.6.2 100.100.100.3
动态nat:
ip nat pool isp 100.100.100.3 100.100.100.5 netmask 255.255.255.0
access-list 1 permit any
ip nat inside source list 1 pool isp overload
ip route 0.0.0.0 0.0.0.0 192.168.10.3
ip route 0.0.0.0 0.0.0.0 192.168.10.1
int f0/0
ip nat inside
int s1/0
ip nat outside
router1:
int s1/1
ip add 100.100.100.1 255.255.255.0
int f0/0
ip add 150.150.150.1 255.255.255.0
int s1/0
ip add 160.160.160.1 255.255.255.0
route rip
v 2
net 100.100.100.0
net 150.150.150.0
net 160.160.160.0
ip route 0.0.0.0 0.0.0.0 100.100.100.1
router2:
itn s1/0
ip add 160.160.160.2 255.255.255.0
int f0/0
ip add 200.200.200.1 255.255.255.0
route rip
v 2
net 160.160.160.0
net 200.200.200.0
ip route 0.0.0.0 0.0.0.0 160.160.160.1
静态路由如下图
router0:
Multilay switch0:
Multilay switch1:
Multilay switch2:
结果: