Switch(config)#linevty 04 允许5个用户登陆
Switch(config-line)#password 123456 设置telnet时的登陆密码
Switch(config-line)#login 使登陆密码生效
Switch(config-line)#exit 退出到特权模式
Switch(config)#lineconsole 0 设置console口连接密码
Switch(config-line)#password 123456
Switch(config-line)#login
Switch(config-line)#exit
Switch (config)#interface f0/0
Switch (config-if)#switchport trunk encapsulation dot1q //改封装类型
Switch (config-if)#switchport mode trunk //改端口模式
Switch (config-if)#exit
Switch #vlan database
Switch (vlan)#vlan 10 name vlan10
Switch (vlan)#exit
Switch (config)#interface f0/0
Switch (config-if)#switchport mode access
Switch (config-if)#switchport access vlan 10 //添加端口到VLAN
Switch (config-if)#exit
Switch (config)#spanning-tree portfast (配置速端口)
Switch (config)#ip dhcp excluded-address192.168.63.1 192.168.63.50
Switch (config)#ip dhcp excluded-address192.168.63.254
Switch (config)#ip dhcp pool vlan63 \\配置DHCP服务器
Switch (dhcp-config)#network 192.168.63.0255.255.255.0
Switch (dhcp-config)#default-router192.168.63.254
Switch (dhcp-config)#dns-server192.168.64.104 192.168.60.3
Switch (dhcp-config)#lease 0 4
Switch (dhcp-config)#exit
Switch (config)#interface Vlan10
Switch (config-if)#ip address 192.168.64.254 255.255.255.0 配置VLAN ip地址
Switch (config-if)#no shutdown
Switch (config-if)#ip helper-address 192.168.60.3 //DHCP中继
Switch (config)#ip classless (告诉路由器当收到无法转发的包时将其传递给默认
路由,而不是简单地丢弃。)
Switch (config)#ip route 0.0.0.0 0.0.0.0219.235.225.50 默认路由
Switch (config)#ip route 192.168.10.0255.255.255.0 172.16.0.253
Switch (config)#ip routing \\三层交换机启用路由功能
Switch (config)#interface f0/0
Switch (config-if)#no switchport //改为路由接口
Switch (config-if)#ip address192.168.64.254 255.255.255.0
Switch (config-if)#no shutdown
IP地址和mac地址绑定
C3750(config)#ip dhcpexcluded-address 192.168.63.15 192.168.63.20
C3750(config)#ip dhcp pool statmac1
C3750(dhcp-config)#host 192.168.63.15 255.255.255.0
C3750(dhcp-config)#client-identifier 0128.d244.3832.9c (mac地址前加上01)
C3750(dhcp-config)#default-router192.168.63.254
C3750(dhcp-config)#dns-server 192.168.64.104 192.168.60.3
C3750#clear ip dhcp binding * (清楚dhcp地址池缓存)
注意:要想让上面的statmac1地址池立即生效,需要清除dhcp地址池缓存。
C3750(config)#arp 192.168.63.15 28d2.4438.329c arpa (其他pc设置此ip不能通信)
配置命名的扩展ACL
C3750(config)#ip access-list extended limit65
C3750(config-ext-nacl)#deny ip 192.168.65.0 0.0.0.255 192.168.62.0 0.0.0.255
C3750(config-ext-nacl)#deny ip 192.168.65.0 0.0.0.255 192.168.63.0 0.0.0.255
C3750(config-ext-nacl)#deny ip 192.168.65.0 0.0.0.255 192.168.64.0 0.0.0.255
C3750(config-ext-nacl)#deny ip 192.168.65.0 0.0.0.255 172.16.0.0 0.0.255.255
C3750(config-ext-nacl)#permit ip any any
应用到接口
C3750(config)#interface vlan 65
C3750(config-if)#ip access-group limit65 out