以前項目中常常會涉及到批量配置交換機的場景,現分享給你們。華爲交換機 S5700-LI 接入模板配置以下(x.x.x.x 爲ip, xxxxxxx爲密碼) :
system sysname xxxx-S5700-LI-14 clock timezone BJ add 08:00:00 snmp-agent community read abcdtest snmp-agent sys-info version v2c v3 dhcp enable dhcp snooping enable error-down auto-recovery cause bpdu-protection interval 30 error-down auto-recovery cause efm-threshold-event interval 30 undo nap slave enable y dhcp option82 circuit-id format user-defined "%portname" dhcp option82 remote-id format user-defined "%sysname" # vlan 499 quit vlan 955 quit # mstp config stp enable stp mode mstp stp region-configuration region-name bj-lskb revision-level 1 instance 0 vlan 499 955 active region-configuration vlan 955 dhcp snooping enable dhcp snooping arp security enable quit interface ran GigabitEthernet 0/0/1 to GigabitEthernet 0/0/22 port link-type access port-security enable port-security aging-time 40 port-security protect-action restrict stp edged-port enable stp bpdu-filter enable dhcp option82 insert enable quit vlan 955 port GigabitEthernet 0/0/1 to 0/0/22 quit interface GigabitEthernet 0/0/24 des up-to-201.190 dhcp snooping trusted port link-type trunk port trunk allow-pass vlan 499 955 interface GigabitEthernet 0/0/23 port link-type trunk dhcp snooping trusted port trunk allow-pass vlan 499 955 int vlanif 1 undo ip add dhcp-all quit undo int vl 1 interface Vlan499 undo shut ip address x.x.x.x 255.255.255.0 ip route-static 0.0.0.0 0.0.0.0 x.x.x.x ntp unicast-server x.x.x.x ntp unicast-server x.x.x.x preference telnet server enable aaa local-user admin password cipher xxxxxxxx local-user admin service-type telnet local-user admin privilege level 15 quit user-interface vty 0 4 authentication-mode aaa