1. 高亮效果
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241
|
Router# show running-config 设备提示符 Router Switch> enable 设备提示符 Switch> Core-SW-01# display version 设备提示符含短横线
%BGP-5-ADJCHANGE: Neighbor 10.0.0.1 Up %LINK-3-UPDOWN: Interface GigabitEthernet0/1 changed state to up %SYS-5-CONFIG_I: Configured from console
ip address 192.168.1.1 255.255.255.0 IPv4 + 掩码 ip address 10.0.0.1/24 IPv4 + CIDR ip address 172.16.0.1:8080 IPv4 + 端口号 neighbor 10.255.255.1 remote-as 65001 BGP neighbor IP
mac-address aabb.cc00.0100 Cisco 格式 xxxx.xxxx.xxxx mac-address aa:bb:cc:00:01:00 标准格式 xx:xx (冒号) mac-address aa-bb-cc-00-01-00 标准格式 xx-xx (短横线)
wwn 10:00:00:00:c9:ab:cd:ef FC WWN(8 组 × 2 位 hex,固定 16 位)
ipv6 address 2001:0db8:85a3:0000:0000:8a2e:0370:7334/64 IPv6 全格式 ipv6 address FE80:0000:0000:0000:0202:B3FF:FE1E:8329 IPv6 全格式 注:IPv6 必须先于 FC WWN 注册(否则 IPv6 正则会先吃掉 WWN 格式)
interface Eth-Trunk1 Eth-Trunk 带编号 interface Eth-Trunk 10 Eth-Trunk 带空格 interface MEth 0/0/1 Huawei 管理口(注意有空格) interface TenGigabitEthernet1/0/1 interface GigabitEthernet0/1 interface FastEthernet0/1 interface Ethernet0/1 interface Serial0/0/0 interface Loopback0 interface Tunnel0 interface Vlan10 Cisco L2 VLAN interface Vlanif10 Huawei L3 VLAN 接口 interface Vlanif 100 Huawei L3 VLAN 接口带空格 interface Port-channel1 interface Portchannel1 interface NVI0 interface Virtual-Template1 interface Virtual-Access1 interface Multilink1 interface Dialer1 interface BVI1 interface Gi0/1 interface Fa0/1 interface Et0/1 interface Se0/0 interface Lo0 interface Tu0 interface Vl10 interface Po1 interface Vi0 interface Mu1 interface Di0 line con 0 line vty 0 4 line aux 0
port: up forwarding synchronized active FULL connected port: learning listening SUCCESS success permit passed state: Complete yes enabled running OK rapid-pvst state: established normal reachable master primary open ready online healthy stable
port: down fail failed invalid not bad never BLK notconnect port: blocking denied err-disabled disabled unusable inaccessible stats: wrong error ERR reset unsup mismatch drops dropped stats: runts CRC collisions deny administratively shut shutdown state: initializing half-duplex standby backup inactive reject timeout unknown unreachable stats: discard discarded overrun ignored throttles exceed exceeded discarding broken unstable
routing: bgp ospf eigrp rip ripng isis pim msdp igmp ibgp ebgp layer2: stp mstp rstp pvst vrrp hsrp gre lacp lldp services: dhcp nat ftp tcp udp tftp scp ssh ntp snmp icmp dns overlay: vxlan evpn nvgre mpls ldp rsvp bfd security: ipsec isakmp ike dot1x radius tacacs monitoring: sflow netflow datacenter: mlag trill spb macsec discovery: cdp arp ndp glbp
access-list 100 permit ip any any access-class 10 in access-group VLAN-FILTER in class-map match-all VOICE policy-map QOS-OUT route-map SET-NEXT-HOP permit 10 route-policy ALLOW-DEFAULT prefix-list RFC1918 seq 5 permit 10.0.0.0/8 time-range WORK-HOURS object-group network INTERNAL-NETS use-acl service-policy input MARKING traffic-policy WAN-EDGE traffic-filter ACL-IN inbound inspect FTP
boot system flash:/image.bin copy tftp://server/file.tar flash: copy running-config config.cfg copy package.pkg flash:
policy (hitcnt=0) applied 圆括号内容 status [OK] verified 方括号内容
uptime is 1d03h uptime is 1d3h count 100
router bgp 65001 interface Loopback0 int Gi0/1 user-interface vty 0 4 vlan batch 10 20 switchport mode access tunnel source Loopback0 tunnel-protocol gre ip route 0.0.0.0 0.0.0.0 192.168.1.254 ip route-static 0.0.0.0 0 Null0 ipv6 enable mac-address static 0050.7966.6800 firewall enable set community 65001:100 match ip address ACL-100 crypto isakmp policy 10 ipsec proposal PRO-1 spanning-tree mode pvst description To-Core-Switch no shutdown system-view sys Core-Router display interface brief show version ping 8.8.8.8 tracert 8.8.8.8 hostname Core-Router username admin password secret key chain EIGRP-KEY erase startup-config remove flash:/old-file delete flash:/config.bak version 7.1.070 MTU 1500 BW 100000 DLY 10 undo shutdown quit save reset counters reboot reload copy running-config startup-config configure terminal enable iStack stack cluster css undo default trunk hybrid access
vendor: cisco huawei h3c juniper arista
security-policy 安全策略视图入口 nat-policy 地址转换策略视图入口 action permit 策略动作关键字 action source-nat NAT 动作关键字 mask 255.255.255.0 掩码关键字 mode pat 运行模式 mode no-pat local NAT 模式 section 0 10.1.1.0 10.1.1.255 地址池子网段 firewall zone trust 安全区域视图 firewall interzone trust untrust 域间策略视图 firewall detect ftp ASPF 探测视图 firewall detect smtp ASPF 探测 hrp enable 双机热备启用 hrp interface GigabitEthernet1/0/0 HRP 接口 hrp mirror session enable HRP 镜像 hrp nat resource primary-group 1 HRP NAT vrid 1 virtual-ip 10.1.1.254 VRRP 组 service ftp 防火墙业务协议 service http 防火墙业务协议 service icmp 防火墙业务协议 service protocol tcp destination-port 2121 协议端口指定 service-manage ping permit 接口服务管理 service-manage https permit 接口服务管理 service-scheme 业务方案 protocol inbound all 协议方向 address-group 1 地址组引用 stelnet server enable SSH Telnet 启用 zone trust 安全区域引用 zone untrust 安全区域引用 zone dmz 安全区域引用 detect ftp ASPF 协议探测
source-zone trust 安全策略源区域 source-zone untrust 安全策略源区域 destination-zone dmz 安全策略目标区域 destination-zone trust 安全策略目标区域 source-address 192.168.0.0 mask 24 安全策略源地址 source-address 10.1.0.0 mask 16 安全策略源地址 destination-address 172.16.0.0 mask 24 安全策略目标地址 destination-address any 安全策略目标地址
l2tp enable L2TP 协议 l2tp-group 1 L2TP 组 ppp PPP 协议 ppp authentication-mode pap PPP 认证模式 http HTTP 协议 https HTTPS 协议
|
2. 安装扩展
2.1. 源码编译安装
1 2 3 4 5
| git clone git@github.com:lololowe/network-syntax-highlighter.git cd network-syntax-highlighter npm install npx @vscode/vsce package --out lololowe.network-syntax-highlighter.vsix code --install-extension lololowe.network-syntax-highlighter.vsix
|
2.2. vsix安装
下载预编译vsix扩展文件:https://github.com/lololowe/network-syntax-highlighter/releases/download/v1.0/lololowe.network-syntax-highlighter.vsix

3. 使用
3.1. 文件后缀自动识别
新建或打开 .network、.ncfg、.nconf 文件会自动启用语法高亮。
3.2. Markdown代码块使用
使用 network 围栏代码块:
1 2 3 4 5 6
| interface Eth-Trunk1 port link-type trunk port trunk allow-pass vlan 10 mode lacp-static trunkport GE 1/0/9 trunkport GE 1/0/10
|