路由器常用命令

说明

华为

H3C

思科

锐捷

配置默认路由

ip route-static 0.0.0.0 0.0.0.0 192.168.1.254

ip route-static 0.0.0.0 0.0.0.0 192.168.1.254

ip route 0.0.0.0 0.0.0.0 192.168.1.254

ip route 0.0.0.0 0.0.0.0 192.168.1.254

配置静态路由

ip route-static 192.168.2.0 255.255.255.0 10.1.1.1

ip route-static 192.168.2.0 255.255.255.0 10.1.1.1

ip route 192.168.2.0 0.0.0.0 10.1.1.1

ip route 192.168.2.0 0.0.0.0 10.1.1.1

配置基础ACL

acl 2000

acl basic 2000

不需要先创建

不需要先创建

允许上网的网段

rule 5 permit source 192.168.0.0 0.0.255.255

rule 5 permit source 192.168.0.0 0.0.255.255

access-list 1 permit 192.168.0.0 0.0.255.255

access-list 1 permit 192.168.0.0 0.0.255.255

配置NAT

外网口nat outbound 2000

外网口nat outbound 2000

内网口ip nat inside /内网口ip nat outside/全局ip nat inside source list 1 interface 外网口 overload

内网口ip nat inside /内网口ip nat outside/全局ip nat inside source list 1 interface 外网口 overload

端口映射

外网口nat server protocol tcp global current-interface 8080 inside 172.16.1.1 80

外网口nat server protocol tcp global current-interface 8080 inside 172.16.1.1 80

全局ip nat inside source static tcp 192.168.1.1 8080 120.1.1.1 80

全局ip nat inside source static tcp 192.168.1.1 8080 120.1.1.1 80

开启DHCP服务

dhcp enable

dhcp enable

service dhcp

service dhcp

配置DHCP 地址池

ip pool dhcp test

dhcp server ip-pool test

ip dhcp pool test

ip dhcp pool test

分配网段

network 192.168.1.0 mask 255.255.255.0

network 192.168.1.0 24

network 192.168.1.0 /24

network 192.168.1.0 255.255.255.0

配置网关

gateway-list 192.168.1.254

gateway-list 192.168.1.254

default-router 192.168.1.254

default-router 192.168.1.254

配置DNS

dns-list 8.8.8.8

dns-list 8.8.8.8

dns-server 8.8.8.8

dns-server 8.8.8.8

常用巡检命令

说明

华为

H3C

思科

锐捷

巡检视图/模式

用户模式<>

用户模式<>

特权模式#

特权模式#

设置命令不分页显示

进入vty 和console口 配置 screen-length 0

screen-length disable

terminal length 0

terminal length 0

显示当前时间

dis clock

dis clock

show clock

terminal length 0

查看设备序列号

dis device manuinfo

dis device manuinfo

show version 有些设备可显示序列号

show clock

查看设备版本

dis version

dis version

show version

show manuinfo

查看设备信息

dis device

dis device

\

show version

查看CPU利用率

dis cpu-usage

dis cpu

show processes cpu

show cpu

查看内存利用率

dis memory-usage

dis memory

show processes mem

show memory

查看设备温度

dis environment

dis environment

show environment all

show temperature

查看风扇状态

dis fan

dis fan

show environment all

show fan

查看电源状态

dis power

dis power

show environment all

show power

查看系统和告警日志

dis logbuffer

dis logbuffer

show logging

show logging

查看物理端口状态

dis int bri

dis int bri

show interfaces status

show interfaces status

查看三层接口状态

dis ip int bri

dis ip int bri

show ip interface brief

show ip interface brief

查看路由表

display ip routing-table

display ip routing-table

show ip route

show ip route

查看vlan

dis vlan

dis vlan

show vlan

show vlan

查看ARP表

dis arp

dis arp

show arp

show arp

查看MAC表

dis mac-address

dis mac-address

show mac address-table

show mac

查看当前配置

dis curr

dis curr

show run

show run